projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20040206-B-src
[rocksndiamonds.git]
/
src
/
game.c
diff --git
a/src/game.c
b/src/game.c
index 61ea108f18c58ea077b96aa895d373cfec915323..0efc0328827c6ce3f65b309b3a1c92356c8ddea4 100644
(file)
--- a/
src/game.c
+++ b/
src/game.c
@@
-107,7
+107,7
@@
(condition) || \
(DONT_COLLIDE_WITH(e) && \
IS_PLAYER(x, y) && \
(condition) || \
(DONT_COLLIDE_WITH(e) && \
IS_PLAYER(x, y) && \
- !PLAYER_PROTECTED(x, y))))
+ !PLAYER_
ENEMY_
PROTECTED(x, y))))
#else
#define ELEMENT_CAN_ENTER_FIELD_GENERIC(e, x, y, condition) \
(IN_LEV_FIELD(x, y) && (IS_FREE(x, y) || \
#else
#define ELEMENT_CAN_ENTER_FIELD_GENERIC(e, x, y, condition) \
(IN_LEV_FIELD(x, y) && (IS_FREE(x, y) || \
@@
-216,7
+216,8
@@
static void ScrollScreen(struct PlayerInfo *, int);
static void InitBeltMovement(void);
static void CloseAllOpenTimegates(void);
static void CheckGravityMovement(struct PlayerInfo *);
static void InitBeltMovement(void);
static void CloseAllOpenTimegates(void);
static void CheckGravityMovement(struct PlayerInfo *);
-static void KillHeroUnlessProtected(int, int);
+static void KillHeroUnlessEnemyProtected(int, int);
+static void KillHeroUnlessExplosionProtected(int, int);
static void TestIfPlayerTouchesCustomElement(int, int);
static void TestIfElementTouchesCustomElement(int, int);
static void TestIfPlayerTouchesCustomElement(int, int);
static void TestIfElementTouchesCustomElement(int, int);
@@
-1793,15
+1794,15
@@
void InitMovDir(int x, int y)
int move_direction_initial = ei->move_direction_initial;
int move_pattern = ei->move_pattern;
int move_direction_initial = ei->move_direction_initial;
int move_pattern = ei->move_pattern;
- if (move_direction_initial == MV_PREVIOUS)
+ if (move_direction_initial == MV_
START_
PREVIOUS)
{
if (MovDir[x][y] != MV_NO_MOVING)
return;
{
if (MovDir[x][y] != MV_NO_MOVING)
return;
- move_direction_initial = MV_AUTOMATIC;
+ move_direction_initial = MV_
START_
AUTOMATIC;
}
}
- if (move_direction_initial == MV_RANDOM)
+ if (move_direction_initial == MV_
START_
RANDOM)
MovDir[x][y] = 1 << RND(4);
else if (move_direction_initial & MV_ANY_DIRECTION)
MovDir[x][y] = move_direction_initial;
MovDir[x][y] = 1 << RND(4);
else if (move_direction_initial & MV_ANY_DIRECTION)
MovDir[x][y] = move_direction_initial;
@@
-2536,7
+2537,7
@@
void Explode(int ex, int ey, int phase, int mode)
RemoveField(x, y);
#endif
RemoveField(x, y);
#endif
- if (IS_PLAYER(ex, ey) && !PLAYER_PROTECTED(ex, ey))
+ if (IS_PLAYER(ex, ey) && !PLAYER_
EXPLOSION_
PROTECTED(ex, ey))
{
switch(StorePlayer[ex][ey])
{
{
switch(StorePlayer[ex][ey])
{
@@
-2679,7
+2680,7
@@
void Explode(int ex, int ey, int phase, int mode)
int element = Store2[x][y];
if (IS_PLAYER(x, y))
int element = Store2[x][y];
if (IS_PLAYER(x, y))
- KillHeroUnlessProtected(x, y);
+ KillHeroUnless
Explosion
Protected(x, y);
else if (CAN_EXPLODE_BY_FIRE(element))
{
Feld[x][y] = Store2[x][y];
else if (CAN_EXPLODE_BY_FIRE(element))
{
Feld[x][y] = Store2[x][y];
@@
-2836,7
+2837,7
@@
void Bang(int x, int y)
#endif
#if 1
#endif
#if 1
- if (IS_PLAYER(x, y) && !PLAYER_PROTECTED(x, y))
+ if (IS_PLAYER(x, y) && !PLAYER_
EXPLOSION_
PROTECTED(x, y))
#else
if (IS_PLAYER(x, y))
#endif
#else
if (IS_PLAYER(x, y))
#endif
@@
-3327,7
+3328,7
@@
void Impact(int x, int y)
if (impact && element == EL_AMOEBA_DROP)
{
if (object_hit && IS_PLAYER(x, y + 1))
if (impact && element == EL_AMOEBA_DROP)
{
if (object_hit && IS_PLAYER(x, y + 1))
- KillHeroUnlessProtected(x, y + 1);
+ KillHeroUnless
Enemy
Protected(x, y + 1);
else if (object_hit && smashed == EL_PENGUIN)
Bang(x, y + 1);
else
else if (object_hit && smashed == EL_PENGUIN)
Bang(x, y + 1);
else
@@
-3369,7
+3370,7
@@
void Impact(int x, int y)
{
if (CAN_SMASH_PLAYER(element))
{
{
if (CAN_SMASH_PLAYER(element))
{
- KillHeroUnlessProtected(x, y + 1);
+ KillHeroUnless
Enemy
Protected(x, y + 1);
return;
}
}
return;
}
}
@@
-4710,7
+4711,7
@@
void StartMoving(int x, int y)
if (DONT_COLLIDE_WITH(element) &&
IN_LEV_FIELD(newx, newy) && IS_PLAYER(newx, newy) &&
if (DONT_COLLIDE_WITH(element) &&
IN_LEV_FIELD(newx, newy) && IS_PLAYER(newx, newy) &&
- !PLAYER_PROTECTED(newx, newy))
+ !PLAYER_
ENEMY_
PROTECTED(newx, newy))
{
#if 1
TestIfBadThingRunsIntoHero(x, y, MovDir[x][y]);
{
#if 1
TestIfBadThingRunsIntoHero(x, y, MovDir[x][y]);
@@
-5261,15
+5262,7
@@
void ContinueMoving(int x, int y)
#if 0
if (IN_LEV_FIELD(nextx, nexty))
{
#if 0
if (IN_LEV_FIELD(nextx, nexty))
{
- static int opposite_directions[] =
- {
- MV_RIGHT,
- MV_LEFT,
- MV_DOWN,
- MV_UP
- };
- int move_dir_bit = MV_DIR_BIT(direction);
- int opposite_direction = opposite_directions[move_dir_bit];
+ int opposite_direction = MV_DIR_OPPOSITE(direction);
int hitting_side = direction;
int touched_side = opposite_direction;
int touched_element = MovingOrBlocked2Element(nextx, nexty);
int hitting_side = direction;
int touched_side = opposite_direction;
int touched_element = MovingOrBlocked2Element(nextx, nexty);
@@
-6232,7
+6225,7
@@
static void ChangeElementNowExt(int x, int y, int target_element)
/* check if element under player changes from accessible to unaccessible
(needed for special case of dropping element which then changes) */
/* check if element under player changes from accessible to unaccessible
(needed for special case of dropping element which then changes) */
- if (IS_PLAYER(x, y) && !PLAYER_PROTECTED(x, y) &&
+ if (IS_PLAYER(x, y) && !PLAYER_
EXPLOSION_
PROTECTED(x, y) &&
IS_ACCESSIBLE(Feld[x][y]) && !IS_ACCESSIBLE(target_element))
{
Bang(x, y);
IS_ACCESSIBLE(Feld[x][y]) && !IS_ACCESSIBLE(target_element))
{
Bang(x, y);
@@
-6247,7
+6240,7
@@
static void ChangeElementNowExt(int x, int y, int target_element)
ResetGfxAnimation(x, y);
ResetRandomAnimationValue(x, y);
ResetGfxAnimation(x, y);
ResetRandomAnimationValue(x, y);
- if (element_info[Feld[x][y]].move_direction_initial == MV_PREVIOUS)
+ if (element_info[Feld[x][y]].move_direction_initial == MV_
START_
PREVIOUS)
MovDir[x][y] = previous_move_direction;
InitField(x, y, FALSE);
MovDir[x][y] = previous_move_direction;
InitField(x, y, FALSE);
@@
-8337,15
+8330,7
@@
void TestIfElementHitsCustomElement(int x, int y, int direction)
if (IN_LEV_FIELD(hitx, hity))
{
if (IN_LEV_FIELD(hitx, hity))
{
- static int opposite_directions[] =
- {
- MV_RIGHT,
- MV_LEFT,
- MV_DOWN,
- MV_UP
- };
- int move_dir_bit = MV_DIR_BIT(direction);
- int opposite_direction = opposite_directions[move_dir_bit];
+ int opposite_direction = MV_DIR_OPPOSITE(direction);
int hitting_side = direction;
int touched_side = opposite_direction;
int touched_element = MovingOrBlocked2Element(hitx, hity);
int hitting_side = direction;
int touched_side = opposite_direction;
int touched_element = MovingOrBlocked2Element(hitx, hity);
@@
-8474,7
+8459,7
@@
void TestIfGoodThingHitsBadThing(int good_x, int good_y, int good_move_dir)
if (player->shield_deadly_time_left > 0)
Bang(kill_x, kill_y);
if (player->shield_deadly_time_left > 0)
Bang(kill_x, kill_y);
- else if (!PLAYER_PROTECTED(good_x, good_y))
+ else if (!PLAYER_
ENEMY_
PROTECTED(good_x, good_y))
KillHero(player);
}
else
KillHero(player);
}
else
@@
-8566,7
+8551,7
@@
void TestIfBadThingHitsGoodThing(int bad_x, int bad_y, int bad_move_dir)
if (player->shield_deadly_time_left > 0)
Bang(bad_x, bad_y);
if (player->shield_deadly_time_left > 0)
Bang(bad_x, bad_y);
- else if (!PLAYER_PROTECTED(kill_x, kill_y))
+ else if (!PLAYER_
ENEMY_
PROTECTED(kill_x, kill_y))
KillHero(player);
}
else
KillHero(player);
}
else
@@
-8656,9
+8641,15
@@
void KillHero(struct PlayerInfo *player)
BuryHero(player);
}
BuryHero(player);
}
-static void KillHeroUnlessProtected(int x, int y)
+static void KillHeroUnlessEnemyProtected(int x, int y)
+{
+ if (!PLAYER_ENEMY_PROTECTED(x, y))
+ KillHero(PLAYERINFO(x, y));
+}
+
+static void KillHeroUnlessExplosionProtected(int x, int y)
{
{
- if (!PLAYER_PROTECTED(x, y))
+ if (!PLAYER_
EXPLOSION_
PROTECTED(x, y))
KillHero(PLAYERINFO(x, y));
}
KillHero(PLAYERINFO(x, y));
}
@@
-9569,7
+9560,7
@@
boolean DropElement(struct PlayerInfo *player)
int move_stepsize = element_info[new_element].move_stepsize;
int direction, dx, dy, nextx, nexty;
int move_stepsize = element_info[new_element].move_stepsize;
int direction, dx, dy, nextx, nexty;
- if (element_info[new_element].move_direction_initial == MV_AUTOMATIC)
+ if (element_info[new_element].move_direction_initial == MV_
START_
AUTOMATIC)
MovDir[jx][jy] = player->MovDir;
direction = MovDir[jx][jy];
MovDir[jx][jy] = player->MovDir;
direction = MovDir[jx][jy];