From: Holger Schemel Date: Tue, 2 Mar 2010 23:59:56 +0000 (+0100) Subject: rnd-20100303-1-src X-Git-Tag: 3.3.0.0^2~28 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=9401cea7061b513534a3244edd8944e852a28c7b;p=rocksndiamonds.git rnd-20100303-1-src --- diff --git a/src/conftime.h b/src/conftime.h index 82b874ad..58e80c90 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2010-02-24 00:22" +#define COMPILE_DATE_STRING "2010-03-02 23:49" diff --git a/src/game.c b/src/game.c index cf7193f8..46f050d2 100644 --- a/src/game.c +++ b/src/game.c @@ -2221,17 +2221,25 @@ void UpdateGameControlValues() local_player->LevelSolved_CountingTime : level.game_engine_type == GAME_ENGINE_TYPE_EM ? level.native_em_level->lev->time : + level.game_engine_type == GAME_ENGINE_TYPE_SP ? + level.native_sp_level->game_sp->time_played : level.time == 0 ? TimePlayed : TimeLeft); int score = (local_player->LevelSolved ? local_player->LevelSolved_CountingScore : level.game_engine_type == GAME_ENGINE_TYPE_EM ? level.native_em_level->lev->score : + level.game_engine_type == GAME_ENGINE_TYPE_SP ? + level.native_sp_level->game_sp->score : local_player->score); int gems = (level.game_engine_type == GAME_ENGINE_TYPE_EM ? level.native_em_level->lev->required : + level.game_engine_type == GAME_ENGINE_TYPE_SP ? + level.native_sp_level->game_sp->infotrons_still_needed : local_player->gems_still_needed); int exit_closed = (level.game_engine_type == GAME_ENGINE_TYPE_EM ? level.native_em_level->lev->required > 0 : + level.game_engine_type == GAME_ENGINE_TYPE_SP ? + level.native_sp_level->game_sp->infotrons_still_needed > 0 : local_player->gems_still_needed > 0 || local_player->sokobanfields_still_needed > 0 || local_player->lights_still_needed > 0); @@ -2253,6 +2261,10 @@ void UpdateGameControlValues() { for (i = 0; i < MAX_PLAYERS; i++) { + /* only one player in Supaplex game engine */ + if (level.game_engine_type == GAME_ENGINE_TYPE_SP && i > 0) + break; + for (k = 0; k < MAX_NUM_KEYS; k++) { if (level.game_engine_type == GAME_ENGINE_TYPE_EM) @@ -2269,6 +2281,9 @@ void UpdateGameControlValues() if (level.game_engine_type == GAME_ENGINE_TYPE_EM) game_panel_controls[GAME_PANEL_INVENTORY_COUNT].value += level.native_em_level->ply[i]->dynamite; + else if (level.game_engine_type == GAME_ENGINE_TYPE_SP) + game_panel_controls[GAME_PANEL_INVENTORY_COUNT].value += + level.native_sp_level->game_sp->red_disk_count; else game_panel_controls[GAME_PANEL_INVENTORY_COUNT].value += stored_player[i].inventory_size; @@ -2301,6 +2316,9 @@ void UpdateGameControlValues() if (level.game_engine_type == GAME_ENGINE_TYPE_EM) game_panel_controls[GAME_PANEL_INVENTORY_COUNT].value += level.native_em_level->ply[player_nr]->dynamite; + else if (level.game_engine_type == GAME_ENGINE_TYPE_SP) + game_panel_controls[GAME_PANEL_INVENTORY_COUNT].value += + level.native_sp_level->game_sp->red_disk_count; else game_panel_controls[GAME_PANEL_INVENTORY_COUNT].value += stored_player[player_nr].inventory_size; diff --git a/src/game_sp/ASM.c b/src/game_sp/ASM.c index 9cad09d5..d31edfae 100644 --- a/src/game_sp/ASM.c +++ b/src/game_sp/ASM.c @@ -4,19 +4,6 @@ #include "ASM.h" -// static char *VB_Name = "modASM"; - -// --- Option Explicit - -// PseudoRegisters: -// Public ax%, bx% -// --- const int ByteMask = 0xFF; -int cmpFlag; - -void Neg(int *Val) -{ - *Val = -*Val; -} void Mov(int *Var, int Val) { @@ -34,6 +21,7 @@ void MovHighByte(int *Var, int Val) Tmp = Val & 0x7F; Tmp = 0x100 * Tmp; + if ((Val & 0x80) != 0) Tmp = Tmp | 0x8000; @@ -44,9 +32,7 @@ int LowByte(int Var) { int LowByte; - // Dim Tmp As Byte LowByte = (Var & 0xFF); - // LowByte = ByteToInt(Tmp) return LowByte; } @@ -56,13 +42,9 @@ int HighByte(int Var) int HighByte; if (Var & 0x8000) - { HighByte = ((Var & 0x7FFF) / 0x100) | 0x80; - } else - { HighByte = Var / 0x100; - } return HighByte; } @@ -76,57 +58,30 @@ int SgnHighByte(int Var) // extends the signum to 16 bit #endif if (Var & 0x8000) - { SgnHighByte = ((Var & 0x7FFF) / 0x100) | 0xFF80; - } else - { SgnHighByte = Var / 0x100; - } return SgnHighByte; } -boolean Less() -{ - boolean Less; - - Less = (cmpFlag < 0); - - return Less; -} - -boolean GreaterOrEqual() -{ - boolean GreaterOrEqual; - - GreaterOrEqual = (0 <= cmpFlag); - - return GreaterOrEqual; -} - -boolean Equal() +int SHL(int *Var, int Count) { - boolean Equal; - - Equal = (0 == cmpFlag); + int SHL; - return Equal; -} + int i; -void CMP(int A, int B) -{ - cmpFlag = A - B; -} + for (i = 1; i <= Count; i++) + { + *Var = *Var & 0x7FFF; -void Add(int *A, int B) -{ - *A = *A + B; -} + if ((*Var & 0x4000) != 0) + *Var = (2 * (*Var & 0x3FFF)) | 0x8000; + else + *Var = 2 * *Var; + } -void MySub(int *A, int B) -{ - *A = *A - B; + return SHL; } int SHR(int *Var, int Count) @@ -136,56 +91,24 @@ int SHR(int *Var, int Count) int i; if (*Var & 0x8000) - { *Var = ((*Var & 0x7FFF) / 2) | 0x4000; - } else - { *Var = *Var / 2; - } for (i = 2; i <= Count; i++) - { *Var = *Var / 2; - } return SHR; } -int SHL(int *Var, int Count) -{ - int SHL; - - int i; - - for (i = 1; i <= Count; i++) - { - *Var = *Var & 0x7FFF; - if ((*Var & 0x4000) != 0) - { - *Var = (2 * (*Var & 0x3FFF)) | 0x8000; - } - else - { - *Var = 2 * *Var; - } - } - - return SHL; -} - int ByteToInt(byte B) { int ByteToInt; if ((B & 0x80) == 0x80) - { ByteToInt = -(0xFF - B + 1); - } else - { ByteToInt = B; - } return ByteToInt; } @@ -194,17 +117,7 @@ byte IntToByte(int i) { byte IntToByte; - // IntToByte = CByte(i & 0xFF); IntToByte = (byte)(i & 0xFF); return IntToByte; } - -void XCHG(int A, int B) -{ - int Tmp; - - Tmp = B; - B = A; - A = Tmp; -} diff --git a/src/game_sp/ASM.h b/src/game_sp/ASM.h index 09bb3938..f1e4e4ac 100644 --- a/src/game_sp/ASM.h +++ b/src/game_sp/ASM.h @@ -12,27 +12,18 @@ #include "global.h" + #define ByteMask (0xFF) -extern void Add(int *A, int B); -extern int ByteToInt(byte B); -extern void CMP(int A, int B); -extern boolean Equal(); -extern boolean GreaterOrEqual(); -extern int HighByte(int Var); -extern byte IntToByte(int i); -extern boolean Less(); -extern int LowByte(int Var); extern void Mov(int *Var, int Val); -extern void MovHighByte(int *Var, int Val); extern void MovLowByte(int *Var, int Val); -extern void MySub(int *A, int B); -extern void Neg(int *Val); +extern void MovHighByte(int *Var, int Val); +extern int LowByte(int Var); +extern int HighByte(int Var); +extern int SgnHighByte(int Var); extern int SHL(int *Var, int Count); extern int SHR(int *Var, int Count); -extern int SgnHighByte(int Var); -extern void XCHG(int A, int B); - -extern int cmpFlag; +extern int ByteToInt(byte B); +extern byte IntToByte(int i); #endif /* ASM_H */ diff --git a/src/game_sp/InitGameConditions.c b/src/game_sp/InitGameConditions.c index 003cedc4..0afc9fa3 100644 --- a/src/game_sp/InitGameConditions.c +++ b/src/game_sp/InitGameConditions.c @@ -97,7 +97,7 @@ int InitMurphyPosB(int si) // To Do: draw Murphy in location ax #if 1 - StretchedSprites.BltImg(MurphyScreenXPos, MurphyScreenYPos, fiMurphy, 0); + StretchedSprites.BltImg(MurphyScreenXPos, MurphyScreenYPos, aniMurphy, 0); #else StretchedSprites.BltEx(MurphyScreenXPos, MurphyScreenYPos, fiMurphy); #endif diff --git a/src/game_sp/export.h b/src/game_sp/export.h index bfeab9dd..8abe983b 100644 --- a/src/game_sp/export.h +++ b/src/game_sp/export.h @@ -90,6 +90,12 @@ struct GameInfo_SP boolean LevelSolved; boolean GameOver; + /* needed for updating panel */ + int time_played; + int infotrons_still_needed; + int red_disk_count; + int score; + /* needed for engine snapshots */ int preceding_buffer_size; }; @@ -114,6 +120,9 @@ struct LevelInfo_SP byte playfield[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT]; struct DemoInfo_SP demo; + + /* used for runtime values */ + struct GameInfo_SP *game_sp; }; struct GraphicInfo_SP diff --git a/src/game_sp/file.c b/src/game_sp/file.c index 5a525214..26f74167 100644 --- a/src/game_sp/file.c +++ b/src/game_sp/file.c @@ -13,6 +13,8 @@ void setLevelInfoToDefaults_SP() char *empty_title = "-------- EMPTY --------"; int i, x, y; + native_sp_level.game_sp = &game_sp; + native_sp_level.width = SP_STD_PLAYFIELD_WIDTH; native_sp_level.height = SP_STD_PLAYFIELD_HEIGHT; diff --git a/src/game_sp/main.c b/src/game_sp/main.c index f30aa0db..b73da64f 100644 --- a/src/game_sp/main.c +++ b/src/game_sp/main.c @@ -22,6 +22,11 @@ void InitGameEngine_SP() game_sp.LevelSolved = FALSE; game_sp.GameOver = FALSE; + game_sp.time_played = 0; + game_sp.infotrons_still_needed = native_sp_level.header.InfotronsNeeded; + game_sp.red_disk_count = 0; + game_sp.score = 0; + menBorder.Checked = setup.sp_show_border_elements; for (x = 0; x < SP_MAX_PLAYFIELD_WIDTH; x++) @@ -73,6 +78,32 @@ void RedrawPlayfield_SP(boolean force_redraw) BackToFront_SP(); } +void DrawGameDoorValues_SP() +{ +#if 1 + + game_sp.time_played = TimerVar / setup.game_frame_delay; + game_sp.infotrons_still_needed = InfotronsNeeded; + game_sp.red_disk_count = RedDiskCount; + game_sp.score = 0; // (currently no score in Supaplex engine) + +#else + + int infotrons_still_needed = InfotronsNeeded; + int red_disks = RedDiskCount; + int no_score_in_supaplex = 0; +#if 1 + int level_time_played = TimerVar / setup.game_frame_delay; +#else + int level_time_played = TimerVar / 35; /* !!! CHECK THIS !!! */ +#endif + int no_keys_in_supaplex = 0; + + DrawAllGameValues(infotrons_still_needed, red_disks, no_score_in_supaplex, + level_time_played, no_keys_in_supaplex); +#endif +} + void GameActions_SP(byte action[MAX_PLAYERS], boolean warp_mode) { byte single_player_action = action[0]; @@ -82,6 +113,9 @@ void GameActions_SP(byte action[MAX_PLAYERS], boolean warp_mode) RedrawPlayfield_SP(FALSE); + if (!warp_mode) /* do not redraw values in warp mode */ + DrawGameDoorValues_SP(); + for (x = DisplayMinX; x <= DisplayMaxX; x++) for (y = DisplayMinY; y <= DisplayMaxY; y++) GfxFrame[x][y]++;