X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_em%2Finit.c;h=2033b2dbd49f3873384f61daa7527e29fb77e02f;hb=7ecf99096c7c23909ada034e05d971464f66552f;hp=54759eefbe5a12ca785365e6fca8817e1a079f58;hpb=ceb7ded99fc9cc9519adeea07808a344678c196e;p=rocksndiamonds.git diff --git a/src/game_em/init.c b/src/game_em/init.c index 54759eef..2033b2db 100644 --- a/src/game_em/init.c +++ b/src/game_em/init.c @@ -3,19 +3,15 @@ * open X11 display and sound */ +#include "main_em.h" + + #include #if !defined(TARGET_SDL) #include #endif -#include "main_em.h" - -#include "global.h" -#include "display.h" -#include "sample.h" -#include "level.h" - Bitmap *objBitmap; Bitmap *sprBitmap; @@ -44,12 +40,13 @@ int play_element[SAMPLE_MAX]; static boolean use_native_em_sound = 0; struct GlobalInfo_EM global_em_info; +struct GameInfo_EM game_em; #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 */ +int sound_length[SAMPLE_MAX]; /* length of sound data */ static const char *sound_names[SAMPLE_MAX] = { @@ -157,10 +154,15 @@ int open_all(void) sprmaskBitmap = emc_bitmaps[1]->clip_mask; #endif +#if 0 + printf("::: CreateBitmap: %d, %d => %d\n", + MAX_BUF_XSIZE, TILEX, MAX_BUF_XSIZE * TILEX); + screenBitmap = CreateBitmap(MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY, DEFAULT_DEPTH); global_em_info.screenbuffer = screenBitmap; +#endif #endif @@ -248,6 +250,33 @@ int open_all(void) return(0); } +void InitGfxBuffers_EM() +{ + +#if 1 + +#if 0 + printf("::: InitGfxBuffers_EM: %d, %d => %d\n", + MAX_BUF_XSIZE, TILEX, MAX_BUF_XSIZE * TILEX); +#endif + + ReCreateBitmap(&screenBitmap, MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY, + DEFAULT_DEPTH); + + global_em_info.screenbuffer = screenBitmap; + +#else + + printf("::: CreateBitmap: %d, %d => %d\n", + MAX_BUF_XSIZE, TILEX, MAX_BUF_XSIZE * TILEX); + + screenBitmap = CreateBitmap(MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY, + DEFAULT_DEPTH); + + global_em_info.screenbuffer = screenBitmap; +#endif +} + void em_open_all() { /* pre-calculate some data */ @@ -299,18 +328,18 @@ void em_close_all(void) /* ---------------------------------------------------------------------- */ -extern unsigned int screen_x; -extern unsigned int screen_y; +extern int screen_x; +extern int screen_y; void play_element_sound(int x, int y, int sample, int element) { #if 0 - unsigned int left = screen_x / TILEX; - unsigned int top = screen_y / TILEY; + int left = screen_x / TILEX; + int top = screen_y / TILEY; if ((x == -1 && y == -1) || /* play sound in the middle of the screen */ - ((unsigned int)(y - top) <= SCR_FIELDY && - (unsigned int)(x - left) <= SCR_FIELDX)) + ((int)(y - top) <= SCR_FIELDY && + (int)(x - left) <= SCR_FIELDX)) #endif { #if 1 @@ -369,14 +398,14 @@ void sound_play(void) #endif - memset(play, 0, sizeof(play)); + clear_mem(play, sizeof(play)); } -unsigned int InitEngineRND_EM(long seed) +unsigned int InitEngineRandom_EM(int seed) { if (seed == NEW_RANDOMIZE) { - int simple_rnd = SimpleRND(1000); + int simple_rnd = GetSimpleRandom(1000); int i; for (i = 0; i < simple_rnd || RandomEM == NEW_RANDOMIZE; i++)