projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3599495
)
moved global random variable for EM engine to game structure
author
Holger Schemel
<info@artsoft.org>
Sun, 16 Feb 2020 20:20:32 +0000
(21:20 +0100)
committer
Holger Schemel
<info@artsoft.org>
Tue, 19 May 2020 16:19:57 +0000
(18:19 +0200)
src/game_em/export.h
patch
|
blob
|
history
src/game_em/global.h
patch
|
blob
|
history
src/game_em/init.c
patch
|
blob
|
history
src/game_em/input.c
patch
|
blob
|
history
src/game_em/logic.c
patch
|
blob
|
history
src/game_em/main_em.h
patch
|
blob
|
history
diff --git
a/src/game_em/export.h
b/src/game_em/export.h
index 3089d48f3f5e3e3c3b9051e00121434a5bcfa2d5..66dd13347f4e3a9c3318d51858bdd48baddc3e5f 100644
(file)
--- a/
src/game_em/export.h
+++ b/
src/game_em/export.h
@@
-28,6
+28,8
@@
struct GlobalInfo_EM
struct GameInfo_EM
{
struct GameInfo_EM
{
+ unsigned int random;
+
boolean level_solved;
boolean game_over;
boolean level_solved;
boolean game_over;
@@
-73,12
+75,12
@@
struct GraphicInfo_EM
struct EngineSnapshotInfo_EM
{
struct GameInfo_EM game_em;
struct EngineSnapshotInfo_EM
{
struct GameInfo_EM game_em;
- unsigned int RandomEM;
struct LOGIC lev;
struct PLAYER ply[MAX_PLAYERS];
struct LOGIC lev;
struct PLAYER ply[MAX_PLAYERS];
+
+ int frame;
int screen_x;
int screen_y;
int screen_x;
int screen_y;
- int frame;
};
};
diff --git
a/src/game_em/global.h
b/src/game_em/global.h
index 40d4e2ccb50d5425a96153d5667d1ae1538524f4..00b190c61abf1bc67bbcb99c640f0aa8ca33ec5e 100644
(file)
--- a/
src/game_em/global.h
+++ b/
src/game_em/global.h
@@
-3,9
+3,14
@@
#include "main_em.h"
#include "main_em.h"
+
+/* global variables */
+
extern int frame;
extern int frame;
+extern int screen_x, screen_y;
+
-/*
all
global function prototypes */
+/* global function prototypes */
void readjoy(byte, struct PLAYER *);
void readjoy(byte, struct PLAYER *);
diff --git
a/src/game_em/init.c
b/src/game_em/init.c
index c99cb8e746384745e54f5f3c15ad22d4d29f03bf..8be34d401503e144c1dd830f22dbf0e4cc2377cb 100644
(file)
--- a/
src/game_em/init.c
+++ b/
src/game_em/init.c
@@
-49,13
+49,13
@@
unsigned int InitEngineRandom_EM(int seed)
int simple_rnd = GetSimpleRandom(1000);
int i;
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;
}
}
diff --git
a/src/game_em/input.c
b/src/game_em/input.c
index 7eccf546178f894186ff1f0e9240cbcc70708e9e..6eadbbdf0d2ca4aec9d50b6442e9270659aab066 100644
(file)
--- a/
src/game_em/input.c
+++ b/
src/game_em/input.c
@@
-6,20
+6,15
@@
#include "main_em.h"
#include "main_em.h"
-unsigned int RandomEM;
-
struct CAVE cav;
struct LOGIC lev;
struct PLAYER ply[MAX_PLAYERS];
struct CAVE cav;
struct LOGIC lev;
struct PLAYER ply[MAX_PLAYERS];
-extern int screen_x;
-extern int screen_y;
-
struct EngineSnapshotInfo_EM engine_snapshot_em;
void game_init_random(void)
{
struct EngineSnapshotInfo_EM engine_snapshot_em;
void game_init_random(void)
{
-
RandomEM
= 1684108901;
+
game_em.random
= 1684108901;
}
void game_init_cave_buffers(void)
}
void game_init_cave_buffers(void)
@@
-72,7
+67,7
@@
void GameActions_EM(byte action[MAX_PLAYERS], boolean warp_mode)
int i;
boolean any_player_dropping = FALSE;
int i;
boolean any_player_dropping = FALSE;
-
RandomEM = RandomEM
* 129 + 1;
+
game_em.random = game_em.random
* 129 + 1;
frame = (frame - 1) & 7;
frame = (frame - 1) & 7;
@@
-169,9
+164,7
@@
void SaveEngineSnapshotValues_EM(void)
engine_snapshot_em.game_em = game_em;
engine_snapshot_em.lev = lev;
engine_snapshot_em.game_em = game_em;
engine_snapshot_em.lev = lev;
- engine_snapshot_em.RandomEM = RandomEM;
engine_snapshot_em.frame = frame;
engine_snapshot_em.frame = frame;
-
engine_snapshot_em.screen_x = screen_x;
engine_snapshot_em.screen_y = screen_y;
engine_snapshot_em.screen_x = screen_x;
engine_snapshot_em.screen_y = screen_y;
@@
-186,9
+179,7
@@
void LoadEngineSnapshotValues_EM(void)
game_em = engine_snapshot_em.game_em;
lev = engine_snapshot_em.lev;
game_em = engine_snapshot_em.game_em;
lev = engine_snapshot_em.lev;
- RandomEM = engine_snapshot_em.RandomEM;
frame = engine_snapshot_em.frame;
frame = engine_snapshot_em.frame;
-
screen_x = engine_snapshot_em.screen_x;
screen_y = engine_snapshot_em.screen_y;
screen_x = engine_snapshot_em.screen_x;
screen_y = engine_snapshot_em.screen_y;
diff --git
a/src/game_em/logic.c
b/src/game_em/logic.c
index 42166ebb9e802dc5a57b8ce0aa3f9f5135e3101e..73b2d94c21f98318f9de4633f5de9358218d3283 100644
(file)
--- a/
src/game_em/logic.c
+++ b/
src/game_em/logic.c
@@
-1313,7
+1313,8
@@
static void check_player(struct PLAYER *ply)
ply->dynamite_cnt = 0;
}
ply->dynamite_cnt = 0;
}
- RandomEM += 7; /* be a bit more random if the player doesn't move */
+ /* be a bit more random if the player doesn't move */
+ game_em.random += 7;
return;
}
return;
}
@@
-7157,7
+7158,8
@@
void logic_players(void)
ply[i].anim = PLY_still;
}
ply[i].anim = PLY_still;
}
- start_check_nr = (RandomEM & 128 ? 0 : 1) * 2 + (RandomEM & 256 ? 0 : 1);
+ start_check_nr = ((game_em.random & 128 ? 0 : 1) * 2 +
+ (game_em.random & 256 ? 0 : 1));
for (i = 0; i < MAX_PLAYERS; i++)
{
for (i = 0; i < MAX_PLAYERS; i++)
{
@@
-7194,7
+7196,7
@@
void logic_objects(void)
next = lev.next;
boom = lev.boom;
next = lev.next;
boom = lev.boom;
- seed =
RandomEM
;
+ seed =
game_em.random
;
score = 0;
for (y = lev.top; y < lev.bottom; y++)
score = 0;
for (y = lev.top; y < lev.bottom; y++)
@@
-7206,7
+7208,7
@@
void logic_objects(void)
else
game_em.game_over = TRUE;
else
game_em.game_over = TRUE;
-
RandomEM
= seed;
+
game_em.random
= seed;
/* triple buffering */
void *temp = lev.cave;
/* triple buffering */
void *temp = lev.cave;
@@
-7254,7
+7256,7
@@
void logic_globals(void)
/* grow amoeba */
/* grow amoeba */
- random =
RandomEM
;
+ random =
game_em.random
;
for (count = lev.amoeba_time; count--;)
{
for (count = lev.amoeba_time; count--;)
{
@@
-7268,7
+7270,7
@@
void logic_globals(void)
random = random * 129 + 1;
}
random = random * 129 + 1;
}
-
RandomEM
= random;
+
game_em.random
= random;
/* handle explosions */
/* handle explosions */
diff --git
a/src/game_em/main_em.h
b/src/game_em/main_em.h
index 0e988595552363b5fda805b893d31d2df7716ece..2daa1e86f574c7d070b72213f3b96d3cf3740322 100644
(file)
--- a/
src/game_em/main_em.h
+++ b/
src/game_em/main_em.h
@@
-85,8
+85,6
@@
extern int SX, SY;
// exported variables
// ----------------------------------------------------------------------------
// exported variables
// ----------------------------------------------------------------------------
-extern unsigned int RandomEM;
-
extern struct CAVE cav;
extern struct LOGIC lev;
extern struct PLAYER ply[MAX_PLAYERS];
extern struct CAVE cav;
extern struct LOGIC lev;
extern struct PLAYER ply[MAX_PLAYERS];