+2005-01-02
+ * fixed bug with not converting RND levels which are set to use native
+ engine to native level structure when loading
+
+2005-01-01
+ * uploaded pre-release (test) version 3.2.0-0 binary and source code
+
+2005-01-01
+ * version number set to 3.2.0
+
2004-12-30
* level data now reset to defaults after attempt to load invalid file
static void PrepareBackbuffer()
{
- /* Fill empty backbuffer for animation functions */
+ if (game_status == GAME_MODE_PLAYING &&
+ level.game_engine_type == GAME_ENGINE_TYPE_EM)
+ {
+ BlitScreenToBitmap_EM(backbuffer);
+
+ return;
+ }
+
+ /* fill empty backbuffer for animation functions */
if (setup.direct_draw && game_status == GAME_MODE_PLAYING)
{
int xx, yy;
-#define COMPILE_DATE_STRING "[2004-12-30 13:53]"
+#define COMPILE_DATE_STRING "[2005-01-03 01:18]"
extern void SetBitmaps_EM(Bitmap **);
extern void UpdateEngineValues(int, int);
-extern void DrawGameDoorValues_EM(int, int, int, int);
+extern void DrawAllGameValues(int, int, int, int, int);
extern int getGameFrameDelay_EM(int);
extern void PlayLevelSound_EM(int, int, int, int);
extern void InitGraphicInfo_EM(void);
if (level->game_engine_type == GAME_ENGINE_TYPE_UNKNOWN)
level->game_engine_type = GAME_ENGINE_TYPE_RND;
- CopyNativeLevel_Native_to_RND(level);
+ if (level_file_info->type == LEVEL_FILE_TYPE_RND)
+ CopyNativeLevel_RND_to_Native(level);
+ else
+ CopyNativeLevel_Native_to_RND(level);
}
void LoadLevelFromFilename(struct LevelInfo *level, char *filename)
DrawText(DX_DYNAMITE, DY_DYNAMITE, int2str(value, 3), FONT_TEXT_2);
}
-inline void DrawGameValue_Keys(struct PlayerInfo *player)
+inline void DrawGameValue_Keys(int key[4])
{
int i;
for (i = 0; i < MAX_KEYS; i++)
- if (player->key[i])
+ if (key[i])
DrawMiniGraphicExt(drawto, DX_KEYS + i * MINI_TILEX, DY_KEYS,
el2edimg(EL_KEY_1 + i));
}
}
}
+void DrawAllGameValues(int emeralds, int dynamite, int score, int time,
+ int key_bits)
+{
+ int key[4];
+ int i;
+
+ for (i = 0; i < MAX_KEYS; i++)
+ key[i] = key_bits & (1 << i);
+
+ DrawGameValue_Emeralds(emeralds);
+ DrawGameValue_Dynamite(dynamite);
+ DrawGameValue_Score(score);
+ DrawGameValue_Time(time);
+
+ DrawGameValue_Keys(key);
+}
+
void DrawGameDoorValues()
{
int i;
- DrawGameValue_Level(level_nr);
+ if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
+ {
+ DrawGameDoorValues_EM();
- for (i = 0; i < MAX_PLAYERS; i++)
- DrawGameValue_Keys(&stored_player[i]);
+ return;
+ }
+
+ DrawGameValue_Level(level_nr);
DrawGameValue_Emeralds(local_player->gems_still_needed);
DrawGameValue_Dynamite(local_player->inventory_size);
DrawGameValue_Score(local_player->score);
DrawGameValue_Time(TimeLeft);
-}
-void DrawGameDoorValues_EM(int emeralds, int dynamite, int score, int time)
-{
- DrawGameValue_Emeralds(emeralds);
- DrawGameValue_Dynamite(dynamite);
- DrawGameValue_Score(score);
- DrawGameValue_Time(time);
+ for (i = 0; i < MAX_PLAYERS; i++)
+ DrawGameValue_Keys(stored_player[i].key);
}
static void resolve_group_element(int group_element, int recursion_depth)
#endif
ZX = ZY = -1;
+ ExitX = ExitY = -1;
FrameCounter = 0;
TimeFrames = 0;
}
/* close exit door after last player */
- if ((Feld[ExitX][ExitY] == EL_EXIT_OPEN ||
- Feld[ExitX][ExitY] == EL_SP_EXIT_OPEN) && AllPlayersGone)
+ if (AllPlayersGone && ExitX >= 0 && ExitY >= 0 &&
+ (Feld[ExitX][ExitY] == EL_EXIT_OPEN ||
+ Feld[ExitX][ExitY] == EL_SP_EXIT_OPEN))
{
int element = Feld[ExitX][ExitY];
}
/* Hero disappears */
- DrawLevelField(ExitX, ExitY);
+ if (ExitX >= 0 && ExitY >= 0)
+ DrawLevelField(ExitX, ExitY);
+
BackToFront();
if (tape.playing)
player->key[key_nr] = TRUE;
- DrawGameValue_Keys(player);
+ DrawGameValue_Keys(player->key);
redraw_mask |= REDRAW_DOOR_1;
}
#include "main_em.h"
+extern struct GlobalInfo_EM global_em_info;
extern struct LevelInfo_EM native_em_level;
extern struct GraphicInfo_EM graphic_info_em_object[TILE_MAX][8];
extern struct GraphicInfo_EM graphic_info_em_player[2][SPR_MAX][8];
extern void setLevelInfoToDefaults_EM();
extern boolean LoadNativeLevel_EM(char *);
+extern void BlitScreenToBitmap_EM(Bitmap *);
+extern void RedrawPlayfield_EM();
+extern void DrawGameDoorValues_EM();
#endif /* GAME_EM_H */
void game_initscreen(void);
void game_animscreen(void);
+void DrawGameDoorValues_EM();
+
void play_sound(int, int, int);
void sound_play(void);
* perhaps use mit-shm to speed this up
*/
-void blitscreen(void)
+void BlitScreenToBitmap_EM(Bitmap *target_bitmap)
{
unsigned int x = screen_x % (MAX_BUF_XSIZE * TILEX);
unsigned int y = screen_y % (MAX_BUF_YSIZE * TILEY);
if (x < 2 * TILEX && y < 2 * TILEY)
{
- BlitBitmap(screenBitmap, window, x, y,
+ BlitBitmap(screenBitmap, target_bitmap, x, y,
SCR_FIELDX * TILEX, SCR_FIELDY * TILEY, SX, SY);
}
else if (x < 2 * TILEX && y >= 2 * TILEY)
{
- BlitBitmap(screenBitmap, window, x, y,
+ BlitBitmap(screenBitmap, target_bitmap, x, y,
SCR_FIELDX * TILEX, MAX_BUF_YSIZE * TILEY - y,
SX, SY);
- BlitBitmap(screenBitmap, window, x, 0,
+ BlitBitmap(screenBitmap, target_bitmap, x, 0,
SCR_FIELDX * TILEX, y - 2 * TILEY,
SX, SY + MAX_BUF_YSIZE * TILEY - y);
}
else if (x >= 2 * TILEX && y < 2 * TILEY)
{
- BlitBitmap(screenBitmap, window, x, y,
+ BlitBitmap(screenBitmap, target_bitmap, x, y,
MAX_BUF_XSIZE * TILEX - x, SCR_FIELDY * TILEY,
SX, SY);
- BlitBitmap(screenBitmap, window, 0, y,
+ BlitBitmap(screenBitmap, target_bitmap, 0, y,
x - 2 * TILEX, SCR_FIELDY * TILEY,
SX + MAX_BUF_XSIZE * TILEX - x, SY);
}
else
{
- BlitBitmap(screenBitmap, window, x, y,
+ BlitBitmap(screenBitmap, target_bitmap, x, y,
MAX_BUF_XSIZE * TILEX - x, MAX_BUF_YSIZE * TILEY - y,
SX, SY);
- BlitBitmap(screenBitmap, window, 0, y,
+ BlitBitmap(screenBitmap, target_bitmap, 0, y,
x - 2 * TILEX, MAX_BUF_YSIZE * TILEY - y,
SX + MAX_BUF_XSIZE * TILEX - x, SY);
- BlitBitmap(screenBitmap, window, x, 0,
+ BlitBitmap(screenBitmap, target_bitmap, x, 0,
MAX_BUF_XSIZE * TILEX - x, y - 2 * TILEY,
SX, SY + MAX_BUF_YSIZE * TILEY - y);
- BlitBitmap(screenBitmap, window, 0, 0,
+ BlitBitmap(screenBitmap, target_bitmap, 0, 0,
x - 2 * TILEX, y - 2 * TILEY,
SX + MAX_BUF_XSIZE * TILEX - x, SY + MAX_BUF_YSIZE * TILEY - y);
}
}
+void blitscreen(void)
+{
+ BlitScreenToBitmap_EM(window);
+}
+
static void DrawLevelField_EM(int x, int y, int sx, int sy,
boolean draw_masked)
{
}
}
- DrawGameDoorValues_EM(lev.required, ply1.dynamite, lev.score,
- DISPLAY_TIME(lev.time + 4));
+ DrawAllGameValues(lev.required, ply1.dynamite, lev.score,
+ DISPLAY_TIME(lev.time + 4), ply1.keys | ply2.keys);
}
-void game_animscreen(void)
+void RedrawPlayfield_EM()
{
unsigned int x,y;
FlushDisplay();
}
+
+void game_animscreen(void)
+{
+ RedrawPlayfield_EM();
+}
+
+void DrawGameDoorValues_EM()
+{
+ DrawAllGameValues(lev.required, ply1.dynamite, lev.score,
+ DISPLAY_TIME(lev.time), ply1.keys | ply2.keys);
+}
*/
#include <signal.h>
+
+#if !defined(TARGET_SDL)
#include <sys/wait.h>
+#endif
#include "main_em.h"
int play_y[SAMPLE_MAX];
int play_element[SAMPLE_MAX];
+static boolean use_native_em_sound = 0;
+
+struct GlobalInfo_EM global_em_info;
+
#if defined(AUDIO_UNIX_NATIVE)
static int sound_pid = -1;
int sound_pipe[2] = { -1, -1 }; /* for communication */
short *sound_data[SAMPLE_MAX]; /* pointer to sound data */
long sound_length[SAMPLE_MAX]; /* length of sound data */
-static boolean use_native_em_sound = 0;
-
static const char *sound_names[SAMPLE_MAX] =
{
"00.blank.au",
screenBitmap = CreateBitmap(MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY,
DEFAULT_DEPTH);
+
+ global_em_info.screenbuffer = screenBitmap;
+
#endif
#if 0
{
/* pre-calculate some data */
tab_generate();
+#if defined(PLATFORM_LINUX) || defined(PLATFORM_BSD)
ulaw_generate();
+#endif
progname = "emerald mine";
synchro_3();
sound_play();
- DrawGameDoorValues_EM(lev.required, ply1.dynamite, lev.score,
- DISPLAY_TIME(lev.time));
+ if (game_frame_delay_value > 0) /* do not redraw values in warp mode */
+ DrawGameDoorValues_EM();
}
}
#define FILE_VERSION_EM_ACTUAL FILE_VERSION_EM_V6
+struct GlobalInfo_EM
+{
+ Bitmap *screenbuffer;
+};
+
struct LevelInfo_EM
{
int file_version;
case Xexit_2:
case Xexit_3:
play_element_sound(x, y, SAMPLE_exit, Xexit_1);
- if (--lev.home == 0 && lev.time_initial > 0)
- lev.score += lev.time * lev.exit_score / 100;
+
+ if (--lev.home == 0 && lev.time_initial > 0) /* game won */
+ lev.score += lev.time * lev.exit_score / 100;
+
ply->anim = SPR_walk + anim;
ply->x = x;
ply->y = y;
+
break;
}
}
/* program information and versioning definitions */
#define PROGRAM_VERSION_MAJOR 3
-#define PROGRAM_VERSION_MINOR 1
-#define PROGRAM_VERSION_PATCH 1
-#define PROGRAM_VERSION_BUILD 0
+#define PROGRAM_VERSION_MINOR 2
+#define PROGRAM_VERSION_PATCH 0
+#define PROGRAM_VERSION_BUILD 1
#define PROGRAM_TITLE_STRING "Rocks'n'Diamonds"
#define PROGRAM_AUTHOR_STRING "Holger Schemel"
byte tape_action[MAX_PLAYERS];
int i;
+ if (level.native_em_level->lev->home == 0) /* all players at home */
+ {
+ GameWon();
+
+ if (!TAPE_IS_STOPPED(tape))
+ TapeStop();
+
+ if (game_status != GAME_MODE_PLAYING)
+ return;
+ }
+
+ /* --- game actions --- */
+
if (tape.pausing)
return;
if (!tape.playing || tape.pausing)
return NULL;
- if (tape.pause_before_death) /* STOP 10s BEFORE PLAYER GETS KILLED... */
+ if (tape.pause_before_death) /* stop 10 seconds before player gets killed */
{
if (!(FrameCounter % 20))
{
if (TapeTime > tape.length_seconds - TAPE_PAUSE_SECONDS_BEFORE_DEATH)
{
TapeTogglePause(TAPE_TOGGLE_MANUAL);
+
return NULL;
}
}
DrawVideoDisplay(VIDEO_STATE_WARP2_ON, VIDEO_DISPLAY_SYMBOL_ONLY);
}
}
+
#if 0
/* !!! this makes things much slower !!! */
else if (tape.warp_forward)
void RedrawPlayfield(boolean force_redraw, int x, int y, int width, int height)
{
+ if (game_status == GAME_MODE_PLAYING &&
+ level.game_engine_type == GAME_ENGINE_TYPE_EM)
+ {
+ RedrawPlayfield_EM();
+
+ return;
+ }
+
if (game_status == GAME_MODE_PLAYING && !game.envelope_active)
{
if (force_redraw)
}
}
+#if 1
+ if (game_status == GAME_MODE_PLAYING &&
+ level.game_engine_type == GAME_ENGINE_TYPE_EM)
+ BlitScreenToBitmap_EM(backbuffer);
+#endif
+
#if 1
/* disable deactivated drawing when quick-loading level tape recording */
if (tape.playing && tape.deactivate_display)
int getGameFrameDelay_EM(int native_em_game_frame_delay)
{
- return (GameFrameDelay == GAME_FRAME_DELAY ? native_em_game_frame_delay :
- GameFrameDelay);
+ int game_frame_delay_value;
+
+ game_frame_delay_value =
+ (tape.playing && tape.fast_forward ? FfwdFrameDelay :
+ GameFrameDelay == GAME_FRAME_DELAY ? native_em_game_frame_delay :
+ GameFrameDelay);
+
+ if (tape.playing && tape.warp_forward && !tape.pausing)
+ game_frame_delay_value = 0;
+
+ return game_frame_delay_value;
}
unsigned int InitRND(long seed)