X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_em%2Finit.c;h=70da7982cd8159f441c8a7b926ede395ea1f93cc;hb=527df81530ed2ddb9063bcd1575fa8f562aa6237;hp=e7a35d0940fa80e3df719a2a0eff9291637ead65;hpb=76c7db086c7dd6f1b125af054de72dc702f9cbb9;p=rocksndiamonds.git diff --git a/src/game_em/init.c b/src/game_em/init.c index e7a35d09..70da7982 100644 --- a/src/game_em/init.c +++ b/src/game_em/init.c @@ -1,6 +1,6 @@ -/* 2000-08-10T18:03:54Z +/* 2000-01-06 06:43:39 * - * open X11 display and sound + * set everything up and close everything down */ #include "main_em.h" @@ -18,12 +18,39 @@ void InitGfxBuffers_EM(void) global_em_info.screenbuffer = screenBitmap; } -void em_open_all(void) +void game_init_random(void) { - /* pre-calculate some data */ - tab_generate(); + game_em.random = 1684108901; /* what a nice seed */ +} + +void game_init_cave_buffers(void) +{ + int x, y; + + for (x = 0; x < CAVE_BUFFER_WIDTH; x++) + { + for (y = 0; y < CAVE_BUFFER_HEIGHT; y++) + { + lev.cavebuf[x][y] = Zborder; + lev.nextbuf[x][y] = Zborder; + lev.drawbuf[x][y] = Zborder; + lev.boombuf[x][y] = Xblank; + } + + lev.cavecol[x] = lev.cavebuf[x]; + lev.nextcol[x] = lev.nextbuf[x]; + lev.drawcol[x] = lev.drawbuf[x]; + lev.boomcol[x] = lev.boombuf[x]; + } - /* initialize graphics */ + lev.cave = lev.cavecol; + lev.next = lev.nextcol; + lev.draw = lev.drawcol; + lev.boom = lev.boomcol; +} + +void em_open_all(void) +{ InitGraphicInfo_EM(); game_init_random(); @@ -34,8 +61,6 @@ void em_close_all(void) { } -/* ---------------------------------------------------------------------- */ - void play_element_sound(int x, int y, int sample, int element) { PlayLevelSound_EM(x, y, element, sample); @@ -46,6 +71,20 @@ void play_sound(int x, int y, int sample) play_element_sound(x, y, sample, -1); } +int correctLevelPosX_EM(int lx) +{ + lx -= lev.left; + + return lx; +} + +int correctLevelPosY_EM(int ly) +{ + ly -= lev.top; + + return ly; +} + unsigned int InitEngineRandom_EM(int seed) { if (seed == NEW_RANDOMIZE) @@ -53,13 +92,13 @@ unsigned int InitEngineRandom_EM(int seed) int simple_rnd = GetSimpleRandom(1000); int i; - for (i = 0; i < simple_rnd || RandomEM == NEW_RANDOMIZE; i++) - RandomEM = RandomEM * 129 + 1; + for (i = 0; i < simple_rnd || game_em.random == NEW_RANDOMIZE; i++) + game_em.random = game_em.random * 129 + 1; - seed = RandomEM; + seed = game_em.random; } - RandomEM = seed; + game_em.random = seed; - return (unsigned int) seed; + return (unsigned int)seed; }