Skip to content

Commit

Permalink
Merge branch 'javierdlr-master' into amigaos4
Browse files Browse the repository at this point in the history
  • Loading branch information
NagyD committed Apr 15, 2023
2 parents 4247008 + 8fdc560 commit 7937625
Show file tree
Hide file tree
Showing 31 changed files with 4,489 additions and 3,513 deletions.
6 changes: 0 additions & 6 deletions README.md

This file was deleted.

497 changes: 497 additions & 0 deletions README.md

Large diffs are not rendered by default.

416 changes: 0 additions & 416 deletions doc/Readme.txt

This file was deleted.

2 changes: 1 addition & 1 deletion doc/bugs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ FIXED: Made compatible with 64-bit.
To be extra sure, I also added some compile time asserts about the sizes of all types that are used in the DAT files.
--- 2014-08-10
FIXED: If color 0 of a palette was not black, then it was not transparent.
For example, in Lost In The Forest ( http://www.popot.org/custom_levels.php?mod=0000082 ).
For example, in Lost In The Forest ( https://www.popot.org/custom_levels.php?mod=0000082 ).
FIXED: PNGs with alpha channel are drawn properly.
--- 2014-08-23
FIXED: make_loose_fall():
Expand Down
8 changes: 5 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ else()
# NOTE: Currently, the SDL2 and SDL2_image frameworks are not being correctly included/linked in the bundle!
# As long as this isn't fixed, these bundles will only work if SDL2 and SDL2_image are installed.

set (SDLPoP_VERSION "1.19")
set (SDLPoP_VERSION "1.20")
set (MACOSX_BUNDLE_INFO_STRING ${PROJECT_NAME})
set (MACOSX_BUNDLE_ICON_FILE "icon.icns")
set_source_files_properties(${MACOSX_BUNDLE_ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
Expand All @@ -114,7 +114,9 @@ else()
endif()

if(WIN32)
target_link_libraries(prince mingw32 SDL2main SDL2 SDL2.dll SDL2_image)
else()
target_link_libraries(prince mingw32 SDL2main SDL2 SDL2_image)
elif(APPLE)
target_link_libraries(prince SDL2main SDL2 SDL2_image m)
else() # Linux, *BSD, etc.
target_link_libraries(prince SDL2 SDL2_image m)
endif()
4 changes: 2 additions & 2 deletions src/GPLv3.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.
The authors of this program may be contacted at http://forum.princed.org
The authors of this program may be contacted at https://forum.princed.org
*/
12 changes: 7 additions & 5 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ BIN = ../prince

OS := $(shell uname)

CPPFLAGS += -Wall -D_GNU_SOURCE=1
CFLAGS += -std=gnu99 -O2

ifeq ($(OS),Darwin)
LIBS := $(shell sdl2-config --libs) -lSDL2_image
INCS := -I/opt/local/include
CFLAGS += $(INCS) -Wall -std=gnu99 -D_GNU_SOURCE=1 -D_THREAD_SAFE -DOSX -O2
CFLAGS += -I/opt/local/include
CPPFLAGS += -D_THREAD_SAFE -DOSX
else
LIBS := $(shell pkg-config --libs sdl2 SDL2_image)
INCS := $(shell pkg-config --cflags sdl2 SDL2_image)
CFLAGS += $(INCS) -Wall -std=gnu99 -O2
CFLAGS += $(shell pkg-config --cflags sdl2 SDL2_image)
endif

all: $(BIN)
Expand All @@ -34,7 +36,7 @@ $(BIN): $(OBJ)
$(CC) $(LDFLAGS) $(OBJ) -o $@ $(LIBS) -lm

%.o: %.c $(HFILES)
$(CC) $(CFLAGS) $(LDFLAGS) -c $<
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c $<

.PHONY: all clean

7 changes: 2 additions & 5 deletions src/Makefile.amigaos4
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@ OS := $(shell uname)

ifeq ($(strip $(OS)),AmigaOS)
AMIGADATE = $(shell c:date LFORMAT %d.%m.%Y)
CXXINC = -ISDK:Local/newlib/include/SDL2
else
AMIGADATE = $(shell date +"%-d.%-m.%Y")
CXXINC = -I/usr/local/amiga/ppc-amigaos/SDK/local/common/include/SDL2
endif

#LIBS = -use-dynld -lSDL2_image -lz -lm -ltiff -lwebp -lpng16 -ljpeg -lvorbisfile -lvorbis -lSDL2 -athread=native -lpthread
LIBS = -lSDL2_image -ltiff -lwebp -lpng -ljpeg -lz -lm -lvorbisfile -lvorbis -lSDL2 -lpthread
#INCS = -gstabs -ISDK:Local/newlib/include/SDL2 -D__AMIGADATE__=\"`c:date LFORMAT %d.%m.%Y`\" -D__USE_INLINE__
INCS = -gstabs $(CXXINC) -D__AMIGADATE__=\"$(AMIGADATE)\" -D__USE_INLINE__
#LIBS = -lSDL2_image -ltiff -lwebp -lpng -ljpeg -lz -lm -lvorbisfile -lvorbis -lSDL2 -lpthread -athread=native -use-dynld
INCS = -gstabs -ISDK:Local/newlib/include/SDL2 -D__AMIGADATE__=\"$(AMIGADATE)\" -D__USE_INLINE__
CFLAGS += $(INCS) -Wall -std=gnu99


Expand Down
77 changes: 67 additions & 10 deletions src/config.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
SDLPoP, a port/conversion of the DOS game Prince of Persia.
Copyright (C) 2013-2021 Dávid Nagy
Copyright (C) 2013-2023 Dávid Nagy
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -30,7 +30,7 @@ The authors of this program may be contacted at https://forum.princed.org
#define POP_MAX_PATH 256
#define POP_MAX_OPTIONS_SIZE 256

#define SDLPOP_VERSION "1.22"
#define SDLPOP_VERSION "1.23"
#define WINDOW_TITLE "Prince of Persia (SDLPoP) v" SDLPOP_VERSION

// Enable or disable the SDL hardware accelerated renderer backend
Expand Down Expand Up @@ -256,8 +256,57 @@ The authors of this program may be contacted at https://forum.princed.org
// Technical explanation: https://forum.princed.org/viewtopic.php?p=16408#p16408 (the second half of the post)
#define FIX_LEVEL_14_RESTARTING

// If a sprite's xpos is negative and divisible by 8, it will appear shifted 8 pixels to the left.
// Testcase: doc/replays-testcases/Original level 12 xpos glitch.p1r
// Explanation: https://forum.princed.org/viewtopic.php?p=33336#p33336
#define FIX_SPRITE_XPOS

// On the original level 5, if you leave the room while the shadow is drinking the potion, the shadow runs to the right.
// He will eventually fall into the wall, at this point a black rectangle appears on the wall.
// It's also related to the raise button next to the wall. The rectangle won't appear without that button.
// Testcase: doc/replays-testcases/Original level 5 shadow into wall.p1r
// See also: https://github.com/NagyD/SDLPoP/issues/254
#define FIX_BLACK_RECT
// TODO: Also fix the shadow not turning around and/or falling into the wall? Or would that break mods?

// The prince can jump over a guard with a properly timed running jump.
// His character's x coordinate ends up in the column behind the guard which causes the bump sequence
// not to work correctly.
#define FIX_JUMPING_OVER_GUARD

// The prince can fall down 2 rooms while climbing a loose tile located in the room above. (Trick 153)
// It happens when the player hangs on the loose tile holding Shift for a second before climbing up.
// The fix ensures the tile does not start to fall until the climbing sequence changes prince's current row.
// Testcase: doc/replays-testcases/trick_153.p1r
// See also: https://github.com/NagyD/SDLPoP/pull/272
#define FIX_DROP_2_ROOMS_CLIMBING_LOOSE_TILE

// The prince or a guard can fall through a floor during a sword strike even though there is a floor tile in front of him.
// A strike sequence consists of 4 important frames, 151-154. Frame 153 is different from the other 3 because has a flag
// that it "needs a floor". The problem is strike frames a pretty wide so the character's tile is not calculated correctly
// causing him to visually fall through the floor.
// This fix prevents falling during that frame treating it like it does not require a floor.
// Testcase: doc/replays-testcases/Falling through floor (PR274).p1r
// See also: https://github.com/NagyD/SDLPoP/pull/274
#define FIX_FALLING_THROUGH_FLOOR_DURING_SWORD_STRIKE

// When the player (re-)enters the currently shown room, the guard disappears from the screen.
// This can happen when:
// * A room is linked to itself (broken link).
// * The player used the "show other room" cheat.
// * A teleport and its pair are in the same room.
// There are two fixes for this:
//#define FIX_DISAPPEARING_GUARD_A // Inserts a black screen.
//#define FIX_DISAPPEARING_GUARD_B // Doesn't insert a black screen.

#endif // ifndef DISABLE_ALL_FIXES

// Prince can jump 2 stories up in feather fall mode
#define USE_SUPER_HIGH_JUMP

// Prince can grab tiles on the row above from a standing or a running jump
#define USE_JUMP_GRAB

// Debug features:

// When the program starts, check whether the deobfuscated sequence table (seqtbl.c) is correct.
Expand Down Expand Up @@ -307,6 +356,14 @@ The authors of this program may be contacted at https://forum.princed.org
// Mute the sound during fast forward.
//#define FAST_FORWARD_MUTE

// Briefly show a dark screen when changing rooms, like in the original game.
#define USE_DARK_TRANSITION

// Turn the balconies into teleports.
// Each balcony (whose left half has a non-zero modifier) will behave as a teleport to another balcony with the same modifier.
// The right half of such balconies must have modifier == 1.
#define USE_TELEPORTS


// Default SDL_Joystick button values
#define SDL_JOYSTICK_BUTTON_Y 2
Expand All @@ -316,15 +373,15 @@ The authors of this program may be contacted at https://forum.princed.org


#ifdef __amigaos4__
#define Rmsk 0x00ff0000
#define Gmsk 0x0000ff00
#define Bmsk 0x000000ff
#define Amsk 0xff000000
#define Rmsk 0x00ff0000
#define Gmsk 0x0000ff00
#define Bmsk 0x000000ff
#define Amsk 0xff000000
#else
#define Rmsk 0x000000ff
#define Gmsk 0x0000ff00
#define Bmsk 0x00ff0000
#define Amsk 0xff000000
#define Rmsk 0x000000ff
#define Gmsk 0x0000ff00
#define Bmsk 0x00ff0000
#define Amsk 0xff000000
#endif


Expand Down
49 changes: 37 additions & 12 deletions src/data.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
SDLPoP, a port/conversion of the DOS game Prince of Persia.
Copyright (C) 2013-2021 Dávid Nagy
Copyright (C) 2013-2023 Dávid Nagy
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -308,6 +308,13 @@ extern chtab_type* chtab_title50;
// data:405E
extern short hof_count;

#ifdef USE_SUPER_HIGH_JUMP
extern byte super_jump_timer INIT(=0);
extern byte super_jump_fall INIT(=0);
extern byte super_jump_room;
extern sbyte super_jump_col;
extern sbyte super_jump_row;
#endif

// data:009A
extern word demo_mode INIT(= 0);
Expand Down Expand Up @@ -419,7 +426,7 @@ extern word seamless;
// data:4CBC
extern trob_type trob;
// data:4382
extern trob_type trobs[30];
extern trob_type trobs[TROBS_MAX];
// data:431A
extern short redraw_height;
// data:24DA
Expand Down Expand Up @@ -494,12 +501,15 @@ extern mob_type mobs[14];
// data:4332
extern short tile_col;
// data:229C
// List of every floor position for the 3 rows on screen (and also the row above the screen and the row below the screen)
// These positions correspond to the standing position of characters on a floor
extern const short y_land[] INIT(= {-8, 55, 118, 181, 244});
// data:5888
extern word curr_guard_color;
// data:288C
extern byte key_states[SDL_NUM_SCANCODES];
// data:24A6
// List of the left-most position of every tile on the screen (and the 5 tiles to the left off-screen, and the 5 tiles to the right off-screen)
extern const byte x_bump[] INIT(= {-12, 2, 16, 30, 44, 58, 72, 86, 100, 114, 128, 142, 156, 170, 184, 198, 212, 226, 240, 254});
// data:42F4
extern word is_screaming;
Expand Down Expand Up @@ -624,13 +634,11 @@ extern SDL_Texture* target_texture;
extern SDL_GameController* sdl_controller_ INIT( = 0 );
extern SDL_Joystick* sdl_joystick_; // in case our joystick is not compatible with SDL_GameController
extern byte using_sdl_joystick_interface;
extern int joy_axis[6]; // hor/ver axes for left/right sticks + left and right triggers (in total 6 axes)
extern int joy_axis[JOY_AXIS_NUM]; // hor/ver axes for left/right sticks + left and right triggers (in total 6 axes)
extern int joy_axis_max[JOY_AXIS_NUM]; // Same as above, but stores the highest value reached between game updates
extern int joy_left_stick_states[2]; // horizontal, vertical
extern int joy_right_stick_states[2];
extern int joy_hat_states[2]; // horizontal, vertical
extern int joy_AY_buttons_state;
extern int joy_X_button_state;
extern int joy_B_button_state;
extern int joy_button_states[JOYINPUT_NUM];
extern SDL_Haptic* sdl_haptic;

extern Uint64 perf_counters_per_tick;
Expand Down Expand Up @@ -725,6 +733,7 @@ extern char gamecontrollerdb_file[POP_MAX_PATH] INIT(= "");
extern byte enable_quicksave INIT(= 1);
extern byte enable_quicksave_penalty INIT(= 1);
extern byte enable_replay INIT(= 1);
extern byte use_hardware_acceleration INIT(= 2);
extern byte use_correct_aspect_ratio INIT(= 0);
extern byte use_integer_scaling INIT(= 0);
extern byte scaling_type INIT(= 0);
Expand All @@ -746,14 +755,14 @@ extern custom_options_type custom_defaults INIT(= {
.saving_allowed_last_level = 13,
.start_upside_down = 0,
.start_in_blind_mode = 0,
// data:009E
.copyprot_level = 2,
// data:009E
.copyprot_level = 2,
.drawn_tile_top_level_edge = tiles_1_floor,
.drawn_tile_left_level_edge = tiles_20_wall,
.level_edge_hit_tile = tiles_20_wall,
.allow_triggering_any_tile = 0,
.enable_wda_in_palace = 0,
.vga_palette = VGA_PALETTE_DEFAULT,
.vga_palette = VGA_PALETTE_DEFAULT,
.first_level = 1,
.skip_title = 0,
.shift_L_allowed_until_level = 4,
Expand Down Expand Up @@ -788,6 +797,12 @@ extern custom_options_type custom_defaults INIT(= {
.mirror_row = 0,
.mirror_tile = tiles_13_mirror,
.show_mirror_image = 1,

.shadow_steal_level = 5,
.shadow_steal_room = 24,
.shadow_step_level = 6,
.shadow_step_room = 1,

.falling_exit_level = 6,
.falling_exit_room = 1,
.falling_entry_level = 7,
Expand All @@ -813,9 +828,9 @@ extern custom_options_type custom_defaults INIT(= {
// data:02B2
.tbl_level_type = {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0},
// 1.3
.tbl_level_color = {0, 0, 0, 1, 0, 0, 0, 1, 2, 2, 0, 0, 3, 3, 4, 0},
.tbl_level_color = {0, 0, 0, 1, 0, 0, 0, 1, 2, 2, 0, 0, 3, 3, 4, 0},
// data:03D4
.tbl_guard_type = {0, 0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 4, 3, -1, -1},
.tbl_guard_type = {0, 0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 4, 3, -1, -1},
// data:0EDA
.tbl_guard_hp = {4, 3, 3, 3, 3, 4, 5, 4, 4, 5, 5, 5, 4, 6, 0, 0},
.tbl_cutscenes_by_index = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
Expand Down Expand Up @@ -911,6 +926,16 @@ extern int play_demo_level;
#ifdef USE_REPLAY
extern int g_deprecation_number;
#endif
extern char mods_folder[POP_MAX_PATH] INIT(= "mods");

extern int play_demo_level;

#ifdef USE_REPLAY
extern int g_deprecation_number;
#endif

extern byte always_use_original_music;
extern byte always_use_original_graphics;

#undef INIT
#undef extern
Expand Down
4 changes: 2 additions & 2 deletions src/lighting.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
SDLPoP, a port/conversion of the DOS game Prince of Persia.
Copyright (C) 2013-2021 Dávid Nagy
Copyright (C) 2013-2023 Dávid Nagy
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -106,7 +106,7 @@ void redraw_lighting() {

// Copy a part of the lighting overlay onto the screen.
// Called when the screen is updated.
void update_lighting(const rect_type far *target_rect_ptr) {
void update_lighting(const rect_type* target_rect_ptr) {
if (!enable_lighting) return;
if (lighting_mask == NULL) return;
if (curr_room_tiles == NULL) return;
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
SDLPoP, a port/conversion of the DOS game Prince of Persia.
Copyright (C) 2013-20209 Dávid Nagy
Copyright (C) 2013-2023 Dávid Nagy
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
Loading

0 comments on commit 7937625

Please sign in to comment.