From: Holger Schemel Date: Fri, 3 Feb 2006 18:01:26 +0000 (+0100) Subject: rnd-20060203-1-src X-Git-Tag: 3.2.0^2~76 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=d4b0925a000fb490f5ade0feecdd4781fc8d0bd5;p=rocksndiamonds.git rnd-20060203-1-src --- diff --git a/src/conftime.h b/src/conftime.h index 34bfe4be..9b40c697 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-01-29 17:09]" +#define COMPILE_DATE_STRING "[2006-02-03 19:01]" diff --git a/src/game_em/cave.c b/src/game_em/cave.c index a811d03e..08c28ec2 100644 --- a/src/game_em/cave.c +++ b/src/game_em/cave.c @@ -47,7 +47,7 @@ void setLevelInfoToDefaults_EM(void) for (i = 0; i < TILE_MAX; i++) lev.android_array[i] = Xblank; - lev.home_initial = 1; /* initial number of players in this level */ + lev.home_initial = 2; /* initial number of players in this level */ ply1.alive_initial = (lev.home_initial >= 1); ply2.alive_initial = (lev.home_initial >= 2); diff --git a/src/game_em/game_em.h b/src/game_em/game_em.h index 820d7aa6..2ca711b4 100644 --- a/src/game_em/game_em.h +++ b/src/game_em/game_em.h @@ -32,7 +32,11 @@ extern void em_open_all(); extern void em_close_all(); extern void InitGameEngine_EM(); +#if 1 +extern void GameActions_EM(byte *); +#else extern void GameActions_EM(byte); +#endif extern unsigned int InitEngineRND_EM(long); diff --git a/src/game_em/global.h b/src/game_em/global.h index 2d30f24e..1a6e77ad 100644 --- a/src/game_em/global.h +++ b/src/game_em/global.h @@ -24,7 +24,11 @@ extern unsigned char linear_to_ulaw[65536]; int open_all(void); void close_all(void); +#if 1 +void readjoy(byte, int); +#else void readjoy(byte); +#endif void input_eventloop(void); void blitscreen(void); diff --git a/src/game_em/input.c b/src/game_em/input.c index 7418f0b6..b2a644c7 100644 --- a/src/game_em/input.c +++ b/src/game_em/input.c @@ -67,6 +67,67 @@ void InitGameEngine_EM() game_animscreen(); } +#if 1 + +void GameActions_EM(byte action[MAX_PLAYERS]) +{ + static unsigned long game_frame_delay = 0; +#if 1 + unsigned long game_frame_delay_value = getGameFrameDelay_EM(20); +#else + unsigned long game_frame_delay_value = getGameFrameDelay_EM(25); +#endif + int i; + +#if 0 + /* this is done in screens.c/HandleGameActions() by calling BackToFront() */ + XSync(display, False); /* block until all graphics are drawn */ +#endif + + WaitUntilDelayReached(&game_frame_delay, game_frame_delay_value); + + game_animscreen(); + + RandomEM = RandomEM * 129 + 1; + + frame = (frame - 1) & 7; + + for (i = 0; i < 2; i++) + readjoy(action[i], i); + + UpdateEngineValues(screen_x / TILEX, screen_y / TILEY); + + if (frame == 7) + { + synchro_1(); + synchro_2(); + } + + if (frame == 6) + { + synchro_3(); + sound_play(); + + if (game_frame_delay_value > 0) /* do not redraw values in warp mode */ + DrawGameDoorValues_EM(); + } + +#if 0 + if (lev.time_initial == 0) + lev.time++; + else if (lev.time > 0) + lev.time--; +#endif + +#if 0 + if (lev.time_initial > 0 && + lev.time > 0 && lev.time <= 50 && lev.time % 5 == 0 && setup.time_limit) + play_sound(-1, -1, SAMPLE_time); +#endif +} + +#else + void GameActions_EM(byte action) { static unsigned long game_frame_delay = 0; @@ -122,9 +183,64 @@ void GameActions_EM(byte action) #endif } +#endif + /* read input device for players */ +#if 1 + +void readjoy(byte action, int player_nr) +{ + unsigned int north = 0, east = 0, south = 0, west = 0; + unsigned int snap = 0, drop = 0; + + if (action & JOY_LEFT) + west = 1; + + if (action & JOY_RIGHT) + east = 1; + + if (action & JOY_UP) + north = 1; + + if (action & JOY_DOWN) + south = 1; + + if (action & JOY_BUTTON_1) + snap = 1; + + if (action & JOY_BUTTON_2) + drop = 1; + + if (player_nr == 0) + { + ply1.joy_snap = snap; + ply1.joy_drop = drop; + if (ply1.joy_stick || (north | east | south | west)) + { + ply1.joy_n = north; + ply1.joy_e = east; + ply1.joy_s = south; + ply1.joy_w = west; + } + } + else + { + ply2.joy_snap = snap; + ply2.joy_drop = drop; + if (ply2.joy_stick || (north | east | south | west)) + { + ply2.joy_n = north; + ply2.joy_e = east; + ply2.joy_s = south; + ply2.joy_w = west; + } + } +} + +#else + void readjoy(byte action) { unsigned int north = 0, east = 0, south = 0, west = 0; @@ -172,3 +288,5 @@ void readjoy(byte action) } #endif } + +#endif diff --git a/src/screens.c b/src/screens.c index 013993c0..c7382d07 100644 --- a/src/screens.c +++ b/src/screens.c @@ -3146,7 +3146,18 @@ void HandleGameActions() if (tape.recording) TapeRecordAction(tape_action); +#if 1 + { + byte effective_action[MAX_PLAYERS]; + + for (i = 0; i < MAX_PLAYERS; i++) + effective_action[i] = stored_player[i].effective_action; + + GameActions_EM(effective_action); + } +#else GameActions_EM(local_player->effective_action); +#endif if (TimeFrames >= FRAMES_PER_SECOND) {