From: Holger Schemel Date: Sat, 10 Feb 2024 17:13:37 +0000 (+0100) Subject: renamed game engine specific export files X-Git-Tag: 4.4.0.0-test-1~422 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=727a0d14dd73f3aaf539c6e3e2efc67c3d2b71e8;p=rocksndiamonds.git renamed game engine specific export files --- diff --git a/src/engines.h b/src/engines.h index 0aad9629..25c36d47 100644 --- a/src/engines.h +++ b/src/engines.h @@ -14,10 +14,10 @@ #include "libgame/libgame.h" -#include "game_bd/export.h" -#include "game_em/export.h" -#include "game_sp/export.h" -#include "game_mm/export.h" +#include "game_bd/export_bd.h" +#include "game_em/export_em.h" +#include "game_sp/export_sp.h" +#include "game_mm/export_mm.h" #include "game.h" diff --git a/src/game_bd/export.h b/src/game_bd/export.h deleted file mode 100644 index 07d3ff3f..00000000 --- a/src/game_bd/export.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef GAME_BD_EXPORT_H -#define GAME_BD_EXPORT_H - -// ============================================================================ -// functions and definitions exported from game_bd to main program -// ============================================================================ - - -// ---------------------------------------------------------------------------- -// constant definitions -// ---------------------------------------------------------------------------- - -#define BD_MAX_CAVE_WIDTH MAX_PLAYFIELD_WIDTH -#define BD_MAX_CAVE_HEIGHT MAX_PLAYFIELD_HEIGHT - - -// ---------------------------------------------------------------------------- -// data structure definitions -// ---------------------------------------------------------------------------- - -struct GameInfo_BD -{ - boolean level_solved; - boolean game_over; - - // needed for updating panel - int time_played; - int gems_still_needed; - int score; -}; - -struct LevelInfo_BD -{ - int width; - int height; - - int cave[BD_MAX_CAVE_WIDTH][BD_MAX_CAVE_HEIGHT]; -}; - -struct EngineSnapshotInfo_BD -{ -}; - - -// ---------------------------------------------------------------------------- -// exported functions -// ---------------------------------------------------------------------------- - -extern struct GameInfo_BD game_bd; -extern struct LevelInfo_BD native_bd_level; -extern struct EngineSnapshotInfo_BD engine_snapshot_bd; - -void setLevelInfoToDefaults_BD(void); - -#endif // GAME_BD_EXPORT_H diff --git a/src/game_bd/export_bd.h b/src/game_bd/export_bd.h new file mode 100644 index 00000000..4f7edfe9 --- /dev/null +++ b/src/game_bd/export_bd.h @@ -0,0 +1,66 @@ +// ============================================================================ +// Rocks'n'Diamonds - McDuffin Strikes Back! +// ---------------------------------------------------------------------------- +// (c) 1995-2024 by Artsoft Entertainment +// Holger Schemel +// info@artsoft.org +// https://www.artsoft.org/ +// ---------------------------------------------------------------------------- +// export_bd.h +// ============================================================================ + +#ifndef EXPORT_BD_H +#define EXPORT_BD_H + +// ============================================================================ +// functions and definitions exported from game_bd to main program +// ============================================================================ + + +// ---------------------------------------------------------------------------- +// constant definitions +// ---------------------------------------------------------------------------- + +#define BD_MAX_CAVE_WIDTH MAX_PLAYFIELD_WIDTH +#define BD_MAX_CAVE_HEIGHT MAX_PLAYFIELD_HEIGHT + + +// ---------------------------------------------------------------------------- +// data structure definitions +// ---------------------------------------------------------------------------- + +struct GameInfo_BD +{ + boolean level_solved; + boolean game_over; + + // needed for updating panel + int time_played; + int gems_still_needed; + int score; +}; + +struct LevelInfo_BD +{ + int width; + int height; + + int cave[BD_MAX_CAVE_WIDTH][BD_MAX_CAVE_HEIGHT]; +}; + +struct EngineSnapshotInfo_BD +{ +}; + + +// ---------------------------------------------------------------------------- +// exported functions +// ---------------------------------------------------------------------------- + +extern struct GameInfo_BD game_bd; +extern struct LevelInfo_BD native_bd_level; +extern struct EngineSnapshotInfo_BD engine_snapshot_bd; + +void setLevelInfoToDefaults_BD(void); + +#endif // EXPORT_BD_H diff --git a/src/game_bd/game_bd.h b/src/game_bd/game_bd.h index d897e381..3243ac25 100644 --- a/src/game_bd/game_bd.h +++ b/src/game_bd/game_bd.h @@ -14,6 +14,6 @@ #define GAME_BD_VERSION_1_0_0 -#include "export.h" +#include "export_bd.h" #endif // GAME_BD_H diff --git a/src/game_bd/main_bd.h b/src/game_bd/main_bd.h index 7d8ffced..65407b6a 100644 --- a/src/game_bd/main_bd.h +++ b/src/game_bd/main_bd.h @@ -12,7 +12,7 @@ // functions and definitions that are exported from game_bd to main program // ============================================================================ -#include "export.h" +#include "export_bd.h" // ============================================================================ diff --git a/src/game_em/export.h b/src/game_em/export.h deleted file mode 100644 index a2bbdef9..00000000 --- a/src/game_em/export.h +++ /dev/null @@ -1,133 +0,0 @@ -#ifndef EXPORT_H -#define EXPORT_H - -// ============================================================================ -// functions and definitions exported from game_em to main program -// ============================================================================ - -#include "emerald.h" -#include "cave.h" - - -// ---------------------------------------------------------------------------- -// constant definitions -// ---------------------------------------------------------------------------- - -#define EM_MAX_CAVE_WIDTH CAVE_WIDTH -#define EM_MAX_CAVE_HEIGHT CAVE_HEIGHT - - -// ---------------------------------------------------------------------------- -// exported structures -// ---------------------------------------------------------------------------- - -struct GlobalInfo_EM -{ - Bitmap *screenbuffer; -}; - -struct GameInfo_EM -{ - unsigned int random; - - boolean level_solved; - boolean game_over; - - boolean any_player_moving; - boolean any_player_snapping; - - int last_moving_player; - int last_player_direction[MAX_PLAYERS]; - - struct LOGIC *lev; - struct PLAYER *ply[MAX_PLAYERS]; - - // flags to handle bugs in and changes between different engine versions - boolean use_single_button; - boolean use_snap_key_bug; - boolean use_random_bug; - boolean use_old_explosions; - boolean use_old_android; - boolean use_old_push_elements; - boolean use_old_push_into_acid; - boolean use_wrap_around; - boolean use_push_delay; -}; - -struct LevelInfo_EM -{ - int file_version; - - struct CAVE *cav; -}; - -struct GraphicInfo_EM -{ - Bitmap *bitmap; - int src_x, src_y; - int src_offset_x, src_offset_y; - int dst_offset_x, dst_offset_y; - int width, height; - - Bitmap *crumbled_bitmap; - int crumbled_src_x, crumbled_src_y; - int crumbled_border_size; - int crumbled_tile_size; - - boolean has_crumbled_graphics; - boolean preserve_background; - - int unique_identifier; /* used to identify needed screen updates */ -}; - -struct EngineSnapshotInfo_EM -{ - struct GameInfo_EM game_em; - struct LOGIC lev; - struct PLAYER ply[MAX_PLAYERS]; - - int frame; - int screen_x; - int screen_y; -}; - - -// ---------------------------------------------------------------------------- -// exported functions -// ---------------------------------------------------------------------------- - -extern struct GlobalInfo_EM global_em_info; -extern struct GameInfo_EM game_em; -extern struct LevelInfo_EM native_em_level; -extern struct GraphicInfo_EM graphic_info_em_object[GAME_TILE_MAX][8]; -extern struct GraphicInfo_EM graphic_info_em_player[MAX_PLAYERS][PLY_MAX][8]; -extern struct EngineSnapshotInfo_EM engine_snapshot_em; - -void em_open_all(void); -void em_close_all(void); - -void InitGfxBuffers_EM(void); - -void InitGameEngine_EM(void); -void GameActions_EM(byte[MAX_PLAYERS]); - -unsigned int InitEngineRandom_EM(int); - -void setLevelInfoToDefaults_EM(void); -boolean LoadNativeLevel_EM(char *, boolean); - -int getFieldbufferOffsetX_EM(void); -int getFieldbufferOffsetY_EM(void); - -void BlitScreenToBitmap_EM(Bitmap *); -void RedrawPlayfield_EM(boolean); - -void LoadEngineSnapshotValues_EM(void); -void SaveEngineSnapshotValues_EM(void); - -boolean checkIfAllPlayersFitToScreen(void); - -int map_em_element_C_to_X(int); -int map_em_element_X_to_C(int); - -#endif // EXPORT_H diff --git a/src/game_em/export_em.h b/src/game_em/export_em.h new file mode 100644 index 00000000..8f32dcdb --- /dev/null +++ b/src/game_em/export_em.h @@ -0,0 +1,144 @@ +// ============================================================================ +// Rocks'n'Diamonds - McDuffin Strikes Back! +// ---------------------------------------------------------------------------- +// (c) 1995-2024 by Artsoft Entertainment +// Holger Schemel +// info@artsoft.org +// https://www.artsoft.org/ +// ---------------------------------------------------------------------------- +// export_em.h +// ============================================================================ + +#ifndef EXPORT_EM_H +#define EXPORT_EM_H + +// ============================================================================ +// functions and definitions exported from game_em to main program +// ============================================================================ + +#include "emerald.h" +#include "cave.h" + + +// ---------------------------------------------------------------------------- +// constant definitions +// ---------------------------------------------------------------------------- + +#define EM_MAX_CAVE_WIDTH CAVE_WIDTH +#define EM_MAX_CAVE_HEIGHT CAVE_HEIGHT + + +// ---------------------------------------------------------------------------- +// exported structures +// ---------------------------------------------------------------------------- + +struct GlobalInfo_EM +{ + Bitmap *screenbuffer; +}; + +struct GameInfo_EM +{ + unsigned int random; + + boolean level_solved; + boolean game_over; + + boolean any_player_moving; + boolean any_player_snapping; + + int last_moving_player; + int last_player_direction[MAX_PLAYERS]; + + struct LOGIC *lev; + struct PLAYER *ply[MAX_PLAYERS]; + + // flags to handle bugs in and changes between different engine versions + boolean use_single_button; + boolean use_snap_key_bug; + boolean use_random_bug; + boolean use_old_explosions; + boolean use_old_android; + boolean use_old_push_elements; + boolean use_old_push_into_acid; + boolean use_wrap_around; + boolean use_push_delay; +}; + +struct LevelInfo_EM +{ + int file_version; + + struct CAVE *cav; +}; + +struct GraphicInfo_EM +{ + Bitmap *bitmap; + int src_x, src_y; + int src_offset_x, src_offset_y; + int dst_offset_x, dst_offset_y; + int width, height; + + Bitmap *crumbled_bitmap; + int crumbled_src_x, crumbled_src_y; + int crumbled_border_size; + int crumbled_tile_size; + + boolean has_crumbled_graphics; + boolean preserve_background; + + int unique_identifier; /* used to identify needed screen updates */ +}; + +struct EngineSnapshotInfo_EM +{ + struct GameInfo_EM game_em; + struct LOGIC lev; + struct PLAYER ply[MAX_PLAYERS]; + + int frame; + int screen_x; + int screen_y; +}; + + +// ---------------------------------------------------------------------------- +// exported functions +// ---------------------------------------------------------------------------- + +extern struct GlobalInfo_EM global_em_info; +extern struct GameInfo_EM game_em; +extern struct LevelInfo_EM native_em_level; +extern struct GraphicInfo_EM graphic_info_em_object[GAME_TILE_MAX][8]; +extern struct GraphicInfo_EM graphic_info_em_player[MAX_PLAYERS][PLY_MAX][8]; +extern struct EngineSnapshotInfo_EM engine_snapshot_em; + +void em_open_all(void); +void em_close_all(void); + +void InitGfxBuffers_EM(void); + +void InitGameEngine_EM(void); +void GameActions_EM(byte[MAX_PLAYERS]); + +unsigned int InitEngineRandom_EM(int); + +void setLevelInfoToDefaults_EM(void); +boolean LoadNativeLevel_EM(char *, boolean); + +int getFieldbufferOffsetX_EM(void); +int getFieldbufferOffsetY_EM(void); + +void BlitScreenToBitmap_EM(Bitmap *); +void RedrawPlayfield_EM(boolean); + +void LoadEngineSnapshotValues_EM(void); +void SaveEngineSnapshotValues_EM(void); + +boolean checkIfAllPlayersFitToScreen(void); + +int map_em_element_C_to_X(int); +int map_em_element_X_to_C(int); + +#endif // EXPORT_EM_H diff --git a/src/game_em/game_em.h b/src/game_em/game_em.h index 6f090474..90a7d4e6 100644 --- a/src/game_em/game_em.h +++ b/src/game_em/game_em.h @@ -14,6 +14,6 @@ #define GAME_EM_VERSION_1_0_0 -#include "export.h" +#include "export_em.h" #endif /* GAME_EM_H */ diff --git a/src/game_em/main_em.h b/src/game_em/main_em.h index 84d5509b..3e815d5c 100644 --- a/src/game_em/main_em.h +++ b/src/game_em/main_em.h @@ -12,7 +12,7 @@ // functions and definitions that are exported from game_em to main program // ============================================================================ -#include "export.h" +#include "export_em.h" // ============================================================================ diff --git a/src/game_mm/export.h b/src/game_mm/export.h deleted file mode 100644 index 1d063969..00000000 --- a/src/game_mm/export.h +++ /dev/null @@ -1,267 +0,0 @@ -#ifndef GAME_MM_EXPORT_H -#define GAME_MM_EXPORT_H - -// ============================================================================ -// functions and definitions exported from game_mm to main program -// ============================================================================ - -// ---------------------------------------------------------------------------- -// constant definitions -// ---------------------------------------------------------------------------- - -#define MM_MAX_PLAYFIELD_WIDTH MAX_PLAYFIELD_WIDTH -#define MM_MAX_PLAYFIELD_HEIGHT MAX_PLAYFIELD_HEIGHT - -#define MM_STD_PLAYFIELD_WIDTH 16 -#define MM_STD_PLAYFIELD_HEIGHT 12 - -#define MM_MAX_PLAYFIELD_SIZE (MM_MAX_PLAYFIELD_WIDTH * \ - MM_MAX_PLAYFIELD_HEIGHT) - -#define MAX_NUM_AMOEBA 100 -#define MAX_NUM_BEAMERS 8 - -#define MAX_LASER_LEN 256 -#define MAX_LASER_ENERGY 100 -#define MAX_LASER_OVERLOAD 100 - -#define MM_LEVEL_SCORE_ELEMENTS 16 - -#define MM_MAX_BALL_CONTENTS 16 - -#define MM_MAX_LEVEL_NAME_LEN 32 -#define MM_MAX_LEVEL_AUTHOR_LEN 32 - - -#define EL_MM_START_1_NATIVE 0 -#define EL_MM_END_1_NATIVE 159 - -#define EL_MM_CHAR_START_NATIVE 160 -#define EL_MM_CHAR_END_NATIVE 239 - -#define EL_MM_START_2_NATIVE 240 -#define EL_MM_END_2_NATIVE 430 - -#define EL_MM_START_3_NATIVE 431 -#define EL_MM_END_3_NATIVE 450 - -#define EL_MM_RUNTIME_START_NATIVE 500 -#define EL_MM_RUNTIME_END_NATIVE 504 - -// elements to be specially mapped -#define EL_MM_EMPTY_NATIVE 0 -#define EL_DF_EMPTY_NATIVE 304 - -// sounds -#define SND_MM_GAME_LEVELTIME_CHARGING 0 -#define SND_MM_GAME_HEALTH_CHARGING 1 - - -// ---------------------------------------------------------------------------- -// data structure definitions -// ---------------------------------------------------------------------------- - -struct CycleList -{ - int x, y; - int steps; -}; - -struct MovingList -{ - int x, y; - int dir; -}; - -struct DamageList -{ - int x, y; - int edge, angle; - boolean is_mirror; -}; - -struct BeamerInfo -{ - int x, y; - int num; -}; - -struct PacMan -{ - int XP, YP; - int Dr; -}; - -struct LaserInfo -{ - struct XY start_edge; - int start_angle; - - int current_angle; - - struct DamageList damage[MAX_LASER_LEN + 10]; - int num_damages; - - struct XY edge[MAX_LASER_LEN + 10]; - int num_edges; - - struct BeamerInfo beamer[MAX_NUM_BEAMERS][2]; - int beamer_edge[MAX_NUM_BEAMERS]; - int beamer_nr[MAX_NUM_BEAMERS]; - int num_beamers; - - boolean overloaded; - int overload_value; - - boolean fuse_off; - int fuse_x, fuse_y; - - int dest_element; - int dest_element_last; - int dest_element_last_x; - int dest_element_last_y; - boolean stops_inside_element; - - boolean redraw; - - int wall_mask; -}; - -struct GameInfo_MM -{ - boolean LevelSolved; - boolean GameOver; - - struct CycleList cycle[MM_MAX_PLAYFIELD_SIZE]; - int num_cycle; - - struct MovingList pacman[MM_MAX_PLAYFIELD_SIZE]; - int num_pacman; - - int score; - int energy_left; - int kettles_still_needed; - int lights_still_needed; - int num_keys; - int ball_choice_pos; // current content element choice position - boolean laser_red, laser_green, laser_blue; - - boolean has_mcduffin; - boolean level_solved; - boolean game_over; - int game_over_cause; - char *game_over_message; - - boolean cheat_no_overload; - boolean cheat_no_explosion; - - int laser_overload_value; - boolean laser_enabled; -}; - -struct LevelInfo_MM -{ - int file_version; // version of file the level was stored with - int game_version; // version of game engine to play this level - boolean encoding_16bit_field; // level contains 16-bit elements - - int fieldx; - int fieldy; - int time; - int kettles_needed; - boolean auto_count_kettles; - boolean mm_laser_red, mm_laser_green, mm_laser_blue; - boolean df_laser_red, df_laser_green, df_laser_blue; - char name[MM_MAX_LEVEL_NAME_LEN + 1]; - char author[MM_MAX_LEVEL_AUTHOR_LEN + 1]; - int score[MM_LEVEL_SCORE_ELEMENTS]; - int amoeba_speed; - int time_fuse; - int time_bomb; - int time_ball; - int time_block; - - int num_ball_contents; - int ball_choice_mode; - int ball_content[MM_MAX_BALL_CONTENTS]; - boolean rotate_ball_content; - boolean explode_ball; - - short field[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT]; -}; - -struct EngineSnapshotInfo_MM -{ - struct GameInfo_MM game_mm; - - struct LaserInfo laser; - - short Ur[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT]; - short Hit[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT]; - short Box[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT]; - short Angle[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT]; - - short LX, LY; - short XS, YS; - short ELX, ELY; - short CT, Ct; - - int last_LX, last_LY, last_hit_mask; - int hold_x, hold_y; - int pacman_nr; - - DelayCounter rotate_delay; - DelayCounter pacman_delay; - DelayCounter energy_delay; - DelayCounter overload_delay; -}; - - -// ---------------------------------------------------------------------------- -// exported functions -// ---------------------------------------------------------------------------- - -extern struct GameInfo_MM game_mm; -extern struct LevelInfo_MM native_mm_level; -extern struct EngineSnapshotInfo_MM engine_snapshot_mm; - -extern short Ur[MM_MAX_PLAYFIELD_WIDTH][MM_MAX_PLAYFIELD_HEIGHT]; - -void mm_open_all(void); - -void InitElementProperties_MM(void); - -void InitGfxBuffers_MM(void); - -void InitGameEngine_MM(void); -void InitGameActions_MM(void); -void GameActions_MM(struct MouseActionInfo); - -void DrawLaser_MM(void); -void DrawTileCursor_MM(int, int, boolean); - -boolean ClickElement(int, int, int); - -unsigned int InitEngineRandom_MM(int); - -void setLevelInfoToDefaults_MM(void); -void copyInternalEngineVars_MM(void); -boolean LoadNativeLevel_MM(char *, boolean); -void SaveNativeLevel_MM(char *); - -int getFieldbufferOffsetX_MM(void); -int getFieldbufferOffsetY_MM(void); - -int getFlippedTileX_MM(int); -int getFlippedTileY_MM(int); -int getFlippedTileXY_MM(int); - -void BlitScreenToBitmap_MM(Bitmap *); -void RedrawPlayfield_MM(void); - -void LoadEngineSnapshotValues_MM(void); -void SaveEngineSnapshotValues_MM(void); - -int getButtonFromTouchPosition(int, int, int, int); - -#endif // GAME_MM_EXPORT_H diff --git a/src/game_mm/export_mm.h b/src/game_mm/export_mm.h new file mode 100644 index 00000000..47ced95c --- /dev/null +++ b/src/game_mm/export_mm.h @@ -0,0 +1,278 @@ +// ============================================================================ +// Rocks'n'Diamonds - McDuffin Strikes Back! +// ---------------------------------------------------------------------------- +// (c) 1995-2024 by Artsoft Entertainment +// Holger Schemel +// info@artsoft.org +// https://www.artsoft.org/ +// ---------------------------------------------------------------------------- +// export_mm.h +// ============================================================================ + +#ifndef EXPORT_MM_H +#define EXPORT_MM_H + +// ============================================================================ +// functions and definitions exported from game_mm to main program +// ============================================================================ + +// ---------------------------------------------------------------------------- +// constant definitions +// ---------------------------------------------------------------------------- + +#define MM_MAX_PLAYFIELD_WIDTH MAX_PLAYFIELD_WIDTH +#define MM_MAX_PLAYFIELD_HEIGHT MAX_PLAYFIELD_HEIGHT + +#define MM_STD_PLAYFIELD_WIDTH 16 +#define MM_STD_PLAYFIELD_HEIGHT 12 + +#define MM_MAX_PLAYFIELD_SIZE (MM_MAX_PLAYFIELD_WIDTH * \ + MM_MAX_PLAYFIELD_HEIGHT) + +#define MAX_NUM_AMOEBA 100 +#define MAX_NUM_BEAMERS 8 + +#define MAX_LASER_LEN 256 +#define MAX_LASER_ENERGY 100 +#define MAX_LASER_OVERLOAD 100 + +#define MM_LEVEL_SCORE_ELEMENTS 16 + +#define MM_MAX_BALL_CONTENTS 16 + +#define MM_MAX_LEVEL_NAME_LEN 32 +#define MM_MAX_LEVEL_AUTHOR_LEN 32 + + +#define EL_MM_START_1_NATIVE 0 +#define EL_MM_END_1_NATIVE 159 + +#define EL_MM_CHAR_START_NATIVE 160 +#define EL_MM_CHAR_END_NATIVE 239 + +#define EL_MM_START_2_NATIVE 240 +#define EL_MM_END_2_NATIVE 430 + +#define EL_MM_START_3_NATIVE 431 +#define EL_MM_END_3_NATIVE 450 + +#define EL_MM_RUNTIME_START_NATIVE 500 +#define EL_MM_RUNTIME_END_NATIVE 504 + +// elements to be specially mapped +#define EL_MM_EMPTY_NATIVE 0 +#define EL_DF_EMPTY_NATIVE 304 + +// sounds +#define SND_MM_GAME_LEVELTIME_CHARGING 0 +#define SND_MM_GAME_HEALTH_CHARGING 1 + + +// ---------------------------------------------------------------------------- +// data structure definitions +// ---------------------------------------------------------------------------- + +struct CycleList +{ + int x, y; + int steps; +}; + +struct MovingList +{ + int x, y; + int dir; +}; + +struct DamageList +{ + int x, y; + int edge, angle; + boolean is_mirror; +}; + +struct BeamerInfo +{ + int x, y; + int num; +}; + +struct PacMan +{ + int XP, YP; + int Dr; +}; + +struct LaserInfo +{ + struct XY start_edge; + int start_angle; + + int current_angle; + + struct DamageList damage[MAX_LASER_LEN + 10]; + int num_damages; + + struct XY edge[MAX_LASER_LEN + 10]; + int num_edges; + + struct BeamerInfo beamer[MAX_NUM_BEAMERS][2]; + int beamer_edge[MAX_NUM_BEAMERS]; + int beamer_nr[MAX_NUM_BEAMERS]; + int num_beamers; + + boolean overloaded; + int overload_value; + + boolean fuse_off; + int fuse_x, fuse_y; + + int dest_element; + int dest_element_last; + int dest_element_last_x; + int dest_element_last_y; + boolean stops_inside_element; + + boolean redraw; + + int wall_mask; +}; + +struct GameInfo_MM +{ + boolean LevelSolved; + boolean GameOver; + + struct CycleList cycle[MM_MAX_PLAYFIELD_SIZE]; + int num_cycle; + + struct MovingList pacman[MM_MAX_PLAYFIELD_SIZE]; + int num_pacman; + + int score; + int energy_left; + int kettles_still_needed; + int lights_still_needed; + int num_keys; + int ball_choice_pos; // current content element choice position + boolean laser_red, laser_green, laser_blue; + + boolean has_mcduffin; + boolean level_solved; + boolean game_over; + int game_over_cause; + char *game_over_message; + + boolean cheat_no_overload; + boolean cheat_no_explosion; + + int laser_overload_value; + boolean laser_enabled; +}; + +struct LevelInfo_MM +{ + int file_version; // version of file the level was stored with + int game_version; // version of game engine to play this level + boolean encoding_16bit_field; // level contains 16-bit elements + + int fieldx; + int fieldy; + int time; + int kettles_needed; + boolean auto_count_kettles; + boolean mm_laser_red, mm_laser_green, mm_laser_blue; + boolean df_laser_red, df_laser_green, df_laser_blue; + char name[MM_MAX_LEVEL_NAME_LEN + 1]; + char author[MM_MAX_LEVEL_AUTHOR_LEN + 1]; + int score[MM_LEVEL_SCORE_ELEMENTS]; + int amoeba_speed; + int time_fuse; + int time_bomb; + int time_ball; + int time_block; + + int num_ball_contents; + int ball_choice_mode; + int ball_content[MM_MAX_BALL_CONTENTS]; + boolean rotate_ball_content; + boolean explode_ball; + + short field[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT]; +}; + +struct EngineSnapshotInfo_MM +{ + struct GameInfo_MM game_mm; + + struct LaserInfo laser; + + short Ur[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT]; + short Hit[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT]; + short Box[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT]; + short Angle[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT]; + + short LX, LY; + short XS, YS; + short ELX, ELY; + short CT, Ct; + + int last_LX, last_LY, last_hit_mask; + int hold_x, hold_y; + int pacman_nr; + + DelayCounter rotate_delay; + DelayCounter pacman_delay; + DelayCounter energy_delay; + DelayCounter overload_delay; +}; + + +// ---------------------------------------------------------------------------- +// exported functions +// ---------------------------------------------------------------------------- + +extern struct GameInfo_MM game_mm; +extern struct LevelInfo_MM native_mm_level; +extern struct EngineSnapshotInfo_MM engine_snapshot_mm; + +extern short Ur[MM_MAX_PLAYFIELD_WIDTH][MM_MAX_PLAYFIELD_HEIGHT]; + +void mm_open_all(void); + +void InitElementProperties_MM(void); + +void InitGfxBuffers_MM(void); + +void InitGameEngine_MM(void); +void InitGameActions_MM(void); +void GameActions_MM(struct MouseActionInfo); + +void DrawLaser_MM(void); +void DrawTileCursor_MM(int, int, boolean); + +boolean ClickElement(int, int, int); + +unsigned int InitEngineRandom_MM(int); + +void setLevelInfoToDefaults_MM(void); +void copyInternalEngineVars_MM(void); +boolean LoadNativeLevel_MM(char *, boolean); +void SaveNativeLevel_MM(char *); + +int getFieldbufferOffsetX_MM(void); +int getFieldbufferOffsetY_MM(void); + +int getFlippedTileX_MM(int); +int getFlippedTileY_MM(int); +int getFlippedTileXY_MM(int); + +void BlitScreenToBitmap_MM(Bitmap *); +void RedrawPlayfield_MM(void); + +void LoadEngineSnapshotValues_MM(void); +void SaveEngineSnapshotValues_MM(void); + +int getButtonFromTouchPosition(int, int, int, int); + +#endif // EXPORT_MM_H diff --git a/src/game_mm/game_mm.h b/src/game_mm/game_mm.h index 5655f322..a5676cd8 100644 --- a/src/game_mm/game_mm.h +++ b/src/game_mm/game_mm.h @@ -14,6 +14,6 @@ #define GAME_MM_VERSION_1_0_0 -#include "export.h" +#include "export_mm.h" #endif // GAME_MM_H diff --git a/src/game_mm/main_mm.h b/src/game_mm/main_mm.h index 94ee023e..9d5c9023 100644 --- a/src/game_mm/main_mm.h +++ b/src/game_mm/main_mm.h @@ -13,7 +13,7 @@ // functions and definitions that are exported from game_mm to main program // ============================================================================ -#include "export.h" +#include "export_mm.h" // ============================================================================ diff --git a/src/game_sp/export.h b/src/game_sp/export.h deleted file mode 100644 index cd1804dd..00000000 --- a/src/game_sp/export.h +++ /dev/null @@ -1,198 +0,0 @@ -#ifndef GAME_SP_EXPORT_H -#define GAME_SP_EXPORT_H - -// ============================================================================ -// functions and definitions exported from game_sp to main program -// ============================================================================ - -// ---------------------------------------------------------------------------- -// constant definitions -// ---------------------------------------------------------------------------- - -#define SP_MAX_PLAYFIELD_WIDTH MAX_PLAYFIELD_WIDTH -#define SP_MAX_PLAYFIELD_HEIGHT MAX_PLAYFIELD_HEIGHT - -#define SP_NUM_LEVELS_PER_PACKAGE 111 - -#define SP_STD_PLAYFIELD_WIDTH 60 -#define SP_STD_PLAYFIELD_HEIGHT 24 -#define SP_LEVEL_NAME_LEN 23 -#define SP_MAX_SPECIAL_PORTS 10 - -#define SP_HEADER_SIZE 96 -#define SP_STD_PLAYFIELD_SIZE (SP_STD_PLAYFIELD_WIDTH * \ - SP_STD_PLAYFIELD_HEIGHT) -#define SP_MAX_PLAYFIELD_SIZE (SP_MAX_PLAYFIELD_WIDTH * \ - SP_MAX_PLAYFIELD_HEIGHT) -#define SP_STD_LEVEL_SIZE (SP_HEADER_SIZE + SP_STD_PLAYFIELD_SIZE) - -#define SP_FRAMES_PER_SECOND 35 - -// use a much higher value to be able to load ultra-long MPX demo files -// (like for level collection 78, level 88 ("WAITING FOR GODOT AGAIN")) -// #define SP_MAX_TAPE_LEN 500000 -#define SP_MAX_TAPE_LEN 64010 // (see "spfix63.doc") - - -// sound actions - -#define actActive 0 -#define actImpact 1 -#define actExploding 2 -#define actDigging 3 -#define actSnapping 4 -#define actCollecting 5 -#define actPassing 6 -#define actPushing 7 -#define actDropping 8 - - -// ---------------------------------------------------------------------------- -// data structure definitions -// ---------------------------------------------------------------------------- - -#ifndef HAS_SpecialPortType -typedef struct -{ - short PortLocation; // = 2*(x+(y*60)) // big endian format - byte Gravity; // 1 = turn on, anything else (0) = turn off - byte FreezeZonks; // 2 = turn on, anything else (0) = turn off (1=off!) - byte FreezeEnemies; // 1 = turn on, anything else (0) = turn off - byte UnUsed; -} SpecialPortType; -#define HAS_SpecialPortType -#endif - -#ifndef HAS_LevelInfoType -typedef struct -{ - byte UnUsed[4]; - byte InitialGravity; // 1=on, anything else (0) = off - byte Version; // SpeedFixVersion XOR &H20 - char LevelTitle[23]; - byte InitialFreezeZonks; // 2=on, anything else (0) = off. (1=off too!) - byte InfotronsNeeded; - - // Number of Infotrons needed. 0 means that Supaplex will count the total - // amount of Infotrons in the level, and use the low byte of that number. - // (A multiple of 256 Infotrons will then result in 0-to-eat, etc.!) - byte SpecialPortCount; // Maximum 10 allowed! - SpecialPortType SpecialPort[10]; - byte SpeedByte; // = Speed XOR Highbyte(RandomSeed) - byte CheckSumByte; // = CheckSum XOR SpeedByte - short DemoRandomSeed; // little endian format -} LevelInfoType; -#define HAS_LevelInfoType -#endif - -struct GameInfo_SP -{ - boolean level_solved; - boolean game_over; - - // needed for updating panel - int time_played; - int infotrons_still_needed; - int red_disk_count; - int score; - - // needed for engine snapshots - char **preceding_buffer; - int preceding_buffer_size; - - int scroll_xoffset, scroll_yoffset; -}; - -struct DemoInfo_SP -{ - boolean is_available; // structure contains valid demo - - int level_nr; // number of corresponding level - - int length; // number of demo entries - byte data[SP_MAX_TAPE_LEN]; // array of demo entries -}; - -struct LevelInfo_SP -{ - LevelInfoType header; - byte header_raw_bytes[SP_HEADER_SIZE]; - - int width, height; - - byte playfield[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT]; - - struct DemoInfo_SP demo; -}; - -struct GraphicInfo_SP -{ - Bitmap *bitmap; - int src_x, src_y; - int src_offset_x, src_offset_y; - int dst_offset_x, dst_offset_y; - int width, height; - - Bitmap *crumbled_bitmap; - int crumbled_src_x, crumbled_src_y; - int crumbled_border_size; - - boolean has_crumbled_graphics; - boolean preserve_background; - - int unique_identifier; // used to identify needed screen updates -}; - -struct EngineSnapshotInfo_SP -{ - struct GameInfo_SP game_sp; - - int PlayField16[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE]; - byte PlayField8[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE]; - byte DisPlayField[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE]; - - int AnimationPosTable[SP_MAX_PLAYFIELD_SIZE]; - byte AnimationSubTable[SP_MAX_PLAYFIELD_SIZE]; - byte TerminalState[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE]; -}; - - -// ---------------------------------------------------------------------------- -// exported functions -// ---------------------------------------------------------------------------- - -extern struct GameInfo_SP game_sp; -extern struct LevelInfo_SP native_sp_level; -extern struct EngineSnapshotInfo_SP engine_snapshot_sp; - -void sp_open_all(void); -void sp_close_all(void); - -void InitPrecedingPlayfieldMemory(void); -void InitGfxBuffers_SP(void); - -void InitGameEngine_SP(void); -void GameActions_SP(byte[MAX_PLAYERS]); - -unsigned int InitEngineRandom_SP(int); - -void setLevelInfoToDefaults_SP(void); -void copyInternalEngineVars_SP(void); -boolean LoadNativeLevel_SP(char *, int, boolean); -void SaveNativeLevel_SP(char *); - -int getFieldbufferOffsetX_SP(void); -int getFieldbufferOffsetY_SP(void); - -void BlitScreenToBitmap_SP(Bitmap *); -void RedrawPlayfield_SP(boolean); - -void LoadEngineSnapshotValues_SP(void); -void SaveEngineSnapshotValues_SP(ListNode **); - -int map_key_RND_to_SP(int); -int map_key_SP_to_RND(int); - -int getRedDiskReleaseFlag_SP(void); - -#endif // GAME_SP_EXPORT_H diff --git a/src/game_sp/export_sp.h b/src/game_sp/export_sp.h new file mode 100644 index 00000000..0b9f6de4 --- /dev/null +++ b/src/game_sp/export_sp.h @@ -0,0 +1,209 @@ +// ============================================================================ +// Rocks'n'Diamonds - McDuffin Strikes Back! +// ---------------------------------------------------------------------------- +// (c) 1995-2024 by Artsoft Entertainment +// Holger Schemel +// info@artsoft.org +// https://www.artsoft.org/ +// ---------------------------------------------------------------------------- +// export_sp.h +// ============================================================================ + +#ifndef EXPORT_SP_H +#define EXPORT_SP_H + +// ============================================================================ +// functions and definitions exported from game_sp to main program +// ============================================================================ + +// ---------------------------------------------------------------------------- +// constant definitions +// ---------------------------------------------------------------------------- + +#define SP_MAX_PLAYFIELD_WIDTH MAX_PLAYFIELD_WIDTH +#define SP_MAX_PLAYFIELD_HEIGHT MAX_PLAYFIELD_HEIGHT + +#define SP_NUM_LEVELS_PER_PACKAGE 111 + +#define SP_STD_PLAYFIELD_WIDTH 60 +#define SP_STD_PLAYFIELD_HEIGHT 24 +#define SP_LEVEL_NAME_LEN 23 +#define SP_MAX_SPECIAL_PORTS 10 + +#define SP_HEADER_SIZE 96 +#define SP_STD_PLAYFIELD_SIZE (SP_STD_PLAYFIELD_WIDTH * \ + SP_STD_PLAYFIELD_HEIGHT) +#define SP_MAX_PLAYFIELD_SIZE (SP_MAX_PLAYFIELD_WIDTH * \ + SP_MAX_PLAYFIELD_HEIGHT) +#define SP_STD_LEVEL_SIZE (SP_HEADER_SIZE + SP_STD_PLAYFIELD_SIZE) + +#define SP_FRAMES_PER_SECOND 35 + +// use a much higher value to be able to load ultra-long MPX demo files +// (like for level collection 78, level 88 ("WAITING FOR GODOT AGAIN")) +// #define SP_MAX_TAPE_LEN 500000 +#define SP_MAX_TAPE_LEN 64010 // (see "spfix63.doc") + + +// sound actions + +#define actActive 0 +#define actImpact 1 +#define actExploding 2 +#define actDigging 3 +#define actSnapping 4 +#define actCollecting 5 +#define actPassing 6 +#define actPushing 7 +#define actDropping 8 + + +// ---------------------------------------------------------------------------- +// data structure definitions +// ---------------------------------------------------------------------------- + +#ifndef HAS_SpecialPortType +typedef struct +{ + short PortLocation; // = 2*(x+(y*60)) // big endian format + byte Gravity; // 1 = turn on, anything else (0) = turn off + byte FreezeZonks; // 2 = turn on, anything else (0) = turn off (1=off!) + byte FreezeEnemies; // 1 = turn on, anything else (0) = turn off + byte UnUsed; +} SpecialPortType; +#define HAS_SpecialPortType +#endif + +#ifndef HAS_LevelInfoType +typedef struct +{ + byte UnUsed[4]; + byte InitialGravity; // 1=on, anything else (0) = off + byte Version; // SpeedFixVersion XOR &H20 + char LevelTitle[23]; + byte InitialFreezeZonks; // 2=on, anything else (0) = off. (1=off too!) + byte InfotronsNeeded; + + // Number of Infotrons needed. 0 means that Supaplex will count the total + // amount of Infotrons in the level, and use the low byte of that number. + // (A multiple of 256 Infotrons will then result in 0-to-eat, etc.!) + byte SpecialPortCount; // Maximum 10 allowed! + SpecialPortType SpecialPort[10]; + byte SpeedByte; // = Speed XOR Highbyte(RandomSeed) + byte CheckSumByte; // = CheckSum XOR SpeedByte + short DemoRandomSeed; // little endian format +} LevelInfoType; +#define HAS_LevelInfoType +#endif + +struct GameInfo_SP +{ + boolean level_solved; + boolean game_over; + + // needed for updating panel + int time_played; + int infotrons_still_needed; + int red_disk_count; + int score; + + // needed for engine snapshots + char **preceding_buffer; + int preceding_buffer_size; + + int scroll_xoffset, scroll_yoffset; +}; + +struct DemoInfo_SP +{ + boolean is_available; // structure contains valid demo + + int level_nr; // number of corresponding level + + int length; // number of demo entries + byte data[SP_MAX_TAPE_LEN]; // array of demo entries +}; + +struct LevelInfo_SP +{ + LevelInfoType header; + byte header_raw_bytes[SP_HEADER_SIZE]; + + int width, height; + + byte playfield[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT]; + + struct DemoInfo_SP demo; +}; + +struct GraphicInfo_SP +{ + Bitmap *bitmap; + int src_x, src_y; + int src_offset_x, src_offset_y; + int dst_offset_x, dst_offset_y; + int width, height; + + Bitmap *crumbled_bitmap; + int crumbled_src_x, crumbled_src_y; + int crumbled_border_size; + + boolean has_crumbled_graphics; + boolean preserve_background; + + int unique_identifier; // used to identify needed screen updates +}; + +struct EngineSnapshotInfo_SP +{ + struct GameInfo_SP game_sp; + + int PlayField16[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE]; + byte PlayField8[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE]; + byte DisPlayField[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE]; + + int AnimationPosTable[SP_MAX_PLAYFIELD_SIZE]; + byte AnimationSubTable[SP_MAX_PLAYFIELD_SIZE]; + byte TerminalState[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE]; +}; + + +// ---------------------------------------------------------------------------- +// exported functions +// ---------------------------------------------------------------------------- + +extern struct GameInfo_SP game_sp; +extern struct LevelInfo_SP native_sp_level; +extern struct EngineSnapshotInfo_SP engine_snapshot_sp; + +void sp_open_all(void); +void sp_close_all(void); + +void InitPrecedingPlayfieldMemory(void); +void InitGfxBuffers_SP(void); + +void InitGameEngine_SP(void); +void GameActions_SP(byte[MAX_PLAYERS]); + +unsigned int InitEngineRandom_SP(int); + +void setLevelInfoToDefaults_SP(void); +void copyInternalEngineVars_SP(void); +boolean LoadNativeLevel_SP(char *, int, boolean); +void SaveNativeLevel_SP(char *); + +int getFieldbufferOffsetX_SP(void); +int getFieldbufferOffsetY_SP(void); + +void BlitScreenToBitmap_SP(Bitmap *); +void RedrawPlayfield_SP(boolean); + +void LoadEngineSnapshotValues_SP(void); +void SaveEngineSnapshotValues_SP(ListNode **); + +int map_key_RND_to_SP(int); +int map_key_SP_to_RND(int); + +int getRedDiskReleaseFlag_SP(void); + +#endif // EXPORT_SP_H diff --git a/src/game_sp/game_sp.h b/src/game_sp/game_sp.h index 22c65728..797ef7d3 100644 --- a/src/game_sp/game_sp.h +++ b/src/game_sp/game_sp.h @@ -14,6 +14,6 @@ #define GAME_SP_VERSION_1_0_0 -#include "export.h" +#include "export_sp.h" #endif // GAME_SP_H diff --git a/src/game_sp/main_sp.h b/src/game_sp/main_sp.h index 58693d8d..8e31403a 100644 --- a/src/game_sp/main_sp.h +++ b/src/game_sp/main_sp.h @@ -13,7 +13,7 @@ // functions and definitions that are exported from game_sp to main program // ============================================================================ -#include "export.h" +#include "export_sp.h" // ============================================================================