projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20051208-1-src
[rocksndiamonds.git]
/
src
/
game.c
diff --git
a/src/game.c
b/src/game.c
index a78e341f983a3e429518c8e8bff1647f0a96983b..1c606b528b6888d76720480a64b8cd0c9c8447cd 100644
(file)
--- a/
src/game.c
+++ b/
src/game.c
@@
-245,8
+245,8
@@
static void InitBeltMovement(void);
static void CloseAllOpenTimegates(void);
static void CheckGravityMovement(struct PlayerInfo *);
static void CheckGravityMovementWhenNotMoving(struct PlayerInfo *);
static void CloseAllOpenTimegates(void);
static void CheckGravityMovement(struct PlayerInfo *);
static void CheckGravityMovementWhenNotMoving(struct PlayerInfo *);
-static void Kill
Hero
UnlessEnemyProtected(int, int);
-static void Kill
Hero
UnlessExplosionProtected(int, int);
+static void Kill
Player
UnlessEnemyProtected(int, int);
+static void Kill
Player
UnlessExplosionProtected(int, int);
static void TestIfPlayerTouchesCustomElement(int, int);
static void TestIfElementTouchesCustomElement(int, int);
static void TestIfPlayerTouchesCustomElement(int, int);
static void TestIfElementTouchesCustomElement(int, int);
@@
-2331,7
+2331,7
@@
void GameWon()
PlayLevelSoundElementAction(ExitX, ExitY, element, ACTION_CLOSING);
}
PlayLevelSoundElementAction(ExitX, ExitY, element, ACTION_CLOSING);
}
- /*
Hero
disappears */
+ /*
player
disappears */
if (ExitX >= 0 && ExitY >= 0)
DrawLevelField(ExitX, ExitY);
if (ExitX >= 0 && ExitY >= 0)
DrawLevelField(ExitX, ExitY);
@@
-2899,7
+2899,7
@@
void RelocatePlayer(int jx, int jy, int el_player_raw)
if (player == local_player) /* only visually relocate local player */
DrawRelocatePlayer(player);
if (player == local_player) /* only visually relocate local player */
DrawRelocatePlayer(player);
- TestIf
Hero
TouchesBadThing(jx, jy);
+ TestIf
Player
TouchesBadThing(jx, jy);
TestIfPlayerTouchesCustomElement(jx, jy);
if (IS_CUSTOM_ELEMENT(element))
TestIfPlayerTouchesCustomElement(jx, jy);
if (IS_CUSTOM_ELEMENT(element))
@@
-3150,7
+3150,7
@@
void Explode(int ex, int ey, int phase, int mode)
if (IS_PLAYER(x, y) && PLAYERINFO(x, y)->present &&
!PLAYER_EXPLOSION_PROTECTED(x, y))
{
if (IS_PLAYER(x, y) && PLAYERINFO(x, y)->present &&
!PLAYER_EXPLOSION_PROTECTED(x, y))
{
- Kill
Hero
UnlessExplosionProtected(x, y);
+ Kill
Player
UnlessExplosionProtected(x, y);
border_explosion = TRUE;
}
else if (CAN_EXPLODE_BY_EXPLOSION(border_element))
border_explosion = TRUE;
}
else if (CAN_EXPLODE_BY_EXPLOSION(border_element))
@@
-3744,7
+3744,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))
- Kill
Hero
UnlessEnemyProtected(x, y + 1);
+ Kill
Player
UnlessEnemyProtected(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
@@
-3786,7
+3786,7
@@
void Impact(int x, int y)
{
if (CAN_SMASH_PLAYER(element))
{
{
if (CAN_SMASH_PLAYER(element))
{
- Kill
Hero
UnlessEnemyProtected(x, y + 1);
+ Kill
Player
UnlessEnemyProtected(x, y + 1);
return;
}
}
return;
}
}
@@
-5060,7
+5060,7
@@
void StartMoving(int x, int y)
IN_LEV_FIELD(newx, newy) && IS_PLAYER(newx, newy) &&
!PLAYER_ENEMY_PROTECTED(newx, newy))
{
IN_LEV_FIELD(newx, newy) && IS_PLAYER(newx, newy) &&
!PLAYER_ENEMY_PROTECTED(newx, newy))
{
- TestIfBadThingRunsInto
Hero
(x, y, MovDir[x][y]);
+ TestIfBadThingRunsInto
Player
(x, y, MovDir[x][y]);
return;
}
return;
}
@@
-5361,7
+5361,7
@@
void StartMoving(int x, int y)
DrawLevelElementAnimation(x, y, element);
if (DONT_TOUCH(element))
DrawLevelElementAnimation(x, y, element);
if (DONT_TOUCH(element))
- TestIfBadThingTouches
Hero
(x, y);
+ TestIfBadThingTouches
Player
(x, y);
return;
}
return;
}
@@
-5583,7
+5583,7
@@
void ContinueMoving(int x, int y)
if (DONT_TOUCH(element)) /* object may be nasty to player or others */
{
if (DONT_TOUCH(element)) /* object may be nasty to player or others */
{
- TestIfBadThingTouches
Hero
(newx, newy);
+ TestIfBadThingTouches
Player
(newx, newy);
TestIfBadThingTouchesFriend(newx, newy);
if (!IS_CUSTOM_ELEMENT(element))
TestIfBadThingTouchesFriend(newx, newy);
if (!IS_CUSTOM_ELEMENT(element))
@@
-6502,11
+6502,12
@@
static int getSpecialActionElement(int element, int number, int base_element)
static int getModifiedActionNumber(int value_old, int operator, int operand,
int value_min, int value_max)
{
static int getModifiedActionNumber(int value_old, int operator, int operand,
int value_min, int value_max)
{
- int value_new = (operator == CA_MODE_ADD ? value_old + operand :
+ int value_new = (operator == CA_MODE_SET ? operand :
+ operator == CA_MODE_ADD ? value_old + operand :
operator == CA_MODE_SUBTRACT ? value_old - operand :
operator == CA_MODE_MULTIPLY ? value_old * operand :
operator == CA_MODE_DIVIDE ? value_old / MAX(1, operand) :
operator == CA_MODE_SUBTRACT ? value_old - operand :
operator == CA_MODE_MULTIPLY ? value_old * operand :
operator == CA_MODE_DIVIDE ? value_old / MAX(1, operand) :
- operator == CA_MODE_
SET ? operand
:
+ operator == CA_MODE_
MODULO ? value_old % MAX(1, operand)
:
value_old);
return (value_new < value_min ? value_min :
value_old);
return (value_new < value_min ? value_min :
@@
-6629,7
+6630,7
@@
static void ExecuteCustomElementAction(int x, int y, int element, int page)
{
for (i = 0; i < MAX_PLAYERS; i++)
if (action_arg_player_bits & (1 << i))
{
for (i = 0; i < MAX_PLAYERS; i++)
if (action_arg_player_bits & (1 << i))
- Kill
Hero
(&stored_player[i]);
+ Kill
Player
(&stored_player[i]);
break;
}
break;
}
@@
-6755,7
+6756,7
@@
static void ExecuteCustomElementAction(int x, int y, int element, int page)
if (!TimeLeft && setup.time_limit)
for (i = 0; i < MAX_PLAYERS; i++)
if (!TimeLeft && setup.time_limit)
for (i = 0; i < MAX_PLAYERS; i++)
- Kill
Hero
(&stored_player[i]);
+ Kill
Player
(&stored_player[i]);
}
break;
}
break;
@@
-6898,7
+6899,7
@@
static void ChangeElementNowExt(struct ElementChangeInfo *change,
Changed[x][y] |= ChangeEvent[x][y]; /* ignore same changes in this frame */
#endif
Changed[x][y] |= ChangeEvent[x][y]; /* ignore same changes in this frame */
#endif
- TestIfBadThingTouches
Hero
(x, y);
+ TestIfBadThingTouches
Player
(x, y);
TestIfPlayerTouchesCustomElement(x, y);
TestIfElementTouchesCustomElement(x, y);
}
TestIfPlayerTouchesCustomElement(x, y);
TestIfElementTouchesCustomElement(x, y);
}
@@
-8032,7
+8033,7
@@
void GameActions()
if (!TimeLeft && setup.time_limit)
for (i = 0; i < MAX_PLAYERS; i++)
if (!TimeLeft && setup.time_limit)
for (i = 0; i < MAX_PLAYERS; i++)
- Kill
Hero
(&stored_player[i]);
+ Kill
Player
(&stored_player[i]);
}
else if (level.time == 0 && !AllPlayersGone) /* level w/o time limit */
DrawGameValue_Time(TimePlayed);
}
else if (level.time == 0 && !AllPlayersGone) /* level w/o time limit */
DrawGameValue_Time(TimePlayed);
@@
-8268,10
+8269,10
@@
boolean MovePlayerOneStep(struct PlayerInfo *player,
InitMovingField(jx, jy, MV_DOWN);
Store[jx][jy] = EL_ACID;
ContinueMoving(jx, jy);
InitMovingField(jx, jy, MV_DOWN);
Store[jx][jy] = EL_ACID;
ContinueMoving(jx, jy);
- Bury
Hero
(player);
+ Bury
Player
(player);
}
else
}
else
- TestIf
Hero
RunsIntoBadThing(jx, jy, player->MovDir);
+ TestIf
Player
RunsIntoBadThing(jx, jy, player->MovDir);
return MF_MOVING;
}
return MF_MOVING;
}
@@
-8486,12
+8487,12
@@
boolean MovePlayer(struct PlayerInfo *player, int dx, int dy)
if (game.engine_version < VERSION_IDENT(3,0,7,0))
{
if (game.engine_version < VERSION_IDENT(3,0,7,0))
{
- TestIf
Hero
TouchesBadThing(jx, jy);
+ TestIf
Player
TouchesBadThing(jx, jy);
TestIfPlayerTouchesCustomElement(jx, jy);
}
if (!player->active)
TestIfPlayerTouchesCustomElement(jx, jy);
}
if (!player->active)
- Remove
Hero
(player);
+ Remove
Player
(player);
return moved;
}
return moved;
}
@@
-8604,7
+8605,7
@@
void ScrollPlayer(struct PlayerInfo *player, int mode)
Feld[jx][jy] == EL_SP_EXIT_OPENING) /* <-- special case */
{
DrawPlayer(player); /* needed here only to cleanup last field */
Feld[jx][jy] == EL_SP_EXIT_OPENING) /* <-- special case */
{
DrawPlayer(player); /* needed here only to cleanup last field */
- Remove
Hero
(player);
+ Remove
Player
(player);
if (local_player->friends_still_needed == 0 ||
IS_SP_ELEMENT(Feld[jx][jy]))
if (local_player->friends_still_needed == 0 ||
IS_SP_ELEMENT(Feld[jx][jy]))
@@
-8639,7
+8640,7
@@
void ScrollPlayer(struct PlayerInfo *player, int mode)
if (game.engine_version >= VERSION_IDENT(3,0,7,0))
{
if (game.engine_version >= VERSION_IDENT(3,0,7,0))
{
- TestIf
Hero
TouchesBadThing(jx, jy);
+ TestIf
Player
TouchesBadThing(jx, jy);
TestIfPlayerTouchesCustomElement(jx, jy);
/* needed because pushed element has not yet reached its destination,
TestIfPlayerTouchesCustomElement(jx, jy);
/* needed because pushed element has not yet reached its destination,
@@
-8648,7
+8649,7
@@
void ScrollPlayer(struct PlayerInfo *player, int mode)
TestIfElementTouchesCustomElement(jx, jy); /* for empty space */
if (!player->active)
TestIfElementTouchesCustomElement(jx, jy); /* for empty space */
if (!player->active)
- Remove
Hero
(player);
+ Remove
Player
(player);
}
if (level.use_step_counter)
}
if (level.use_step_counter)
@@
-8668,7
+8669,7
@@
void ScrollPlayer(struct PlayerInfo *player, int mode)
if (!TimeLeft && setup.time_limit)
for (i = 0; i < MAX_PLAYERS; i++)
if (!TimeLeft && setup.time_limit)
for (i = 0; i < MAX_PLAYERS; i++)
- Kill
Hero
(&stored_player[i]);
+ Kill
Player
(&stored_player[i]);
}
else if (level.time == 0 && !AllPlayersGone) /* level w/o time limit */
DrawGameValue_Time(TimePlayed);
}
else if (level.time == 0 && !AllPlayersGone) /* level w/o time limit */
DrawGameValue_Time(TimePlayed);
@@
-9007,7
+9008,7
@@
void TestIfGoodThingHitsBadThing(int good_x, int good_y, int good_move_dir)
!IS_INDESTRUCTIBLE(bad_element))
Bang(kill_x, kill_y);
else if (!PLAYER_ENEMY_PROTECTED(good_x, good_y))
!IS_INDESTRUCTIBLE(bad_element))
Bang(kill_x, kill_y);
else if (!PLAYER_ENEMY_PROTECTED(good_x, good_y))
- Kill
Hero
(player);
+ Kill
Player
(player);
}
else
Bang(good_x, good_y);
}
else
Bang(good_x, good_y);
@@
-9100,29
+9101,29
@@
void TestIfBadThingHitsGoodThing(int bad_x, int bad_y, int bad_move_dir)
!IS_INDESTRUCTIBLE(bad_element))
Bang(bad_x, bad_y);
else if (!PLAYER_ENEMY_PROTECTED(kill_x, kill_y))
!IS_INDESTRUCTIBLE(bad_element))
Bang(bad_x, bad_y);
else if (!PLAYER_ENEMY_PROTECTED(kill_x, kill_y))
- Kill
Hero
(player);
+ Kill
Player
(player);
}
else
Bang(kill_x, kill_y);
}
}
}
else
Bang(kill_x, kill_y);
}
}
-void TestIf
Hero
TouchesBadThing(int x, int y)
+void TestIf
Player
TouchesBadThing(int x, int y)
{
TestIfGoodThingHitsBadThing(x, y, MV_NO_MOVING);
}
{
TestIfGoodThingHitsBadThing(x, y, MV_NO_MOVING);
}
-void TestIf
Hero
RunsIntoBadThing(int x, int y, int move_dir)
+void TestIf
Player
RunsIntoBadThing(int x, int y, int move_dir)
{
TestIfGoodThingHitsBadThing(x, y, move_dir);
}
{
TestIfGoodThingHitsBadThing(x, y, move_dir);
}
-void TestIfBadThingTouches
Hero
(int x, int y)
+void TestIfBadThingTouches
Player
(int x, int y)
{
TestIfBadThingHitsGoodThing(x, y, MV_NO_MOVING);
}
{
TestIfBadThingHitsGoodThing(x, y, MV_NO_MOVING);
}
-void TestIfBadThingRunsInto
Hero
(int x, int y, int move_dir)
+void TestIfBadThingRunsInto
Player
(int x, int y, int move_dir)
{
TestIfBadThingHitsGoodThing(x, y, move_dir);
}
{
TestIfBadThingHitsGoodThing(x, y, move_dir);
}
@@
-9171,7
+9172,7
@@
void TestIfBadThingTouchesOtherBadThing(int bad_x, int bad_y)
Bang(bad_x, bad_y);
}
Bang(bad_x, bad_y);
}
-void Kill
Hero
(struct PlayerInfo *player)
+void Kill
Player
(struct PlayerInfo *player)
{
int jx = player->jx, jy = player->jy;
{
int jx = player->jx, jy = player->jy;
@@
-9186,22
+9187,22
@@
void KillHero(struct PlayerInfo *player)
player->shield_deadly_time_left = 0;
Bang(jx, jy);
player->shield_deadly_time_left = 0;
Bang(jx, jy);
- Bury
Hero
(player);
+ Bury
Player
(player);
}
}
-static void Kill
Hero
UnlessEnemyProtected(int x, int y)
+static void Kill
Player
UnlessEnemyProtected(int x, int y)
{
if (!PLAYER_ENEMY_PROTECTED(x, y))
{
if (!PLAYER_ENEMY_PROTECTED(x, y))
- Kill
Hero
(PLAYERINFO(x, y));
+ Kill
Player
(PLAYERINFO(x, y));
}
}
-static void Kill
Hero
UnlessExplosionProtected(int x, int y)
+static void Kill
Player
UnlessExplosionProtected(int x, int y)
{
if (!PLAYER_EXPLOSION_PROTECTED(x, y))
{
if (!PLAYER_EXPLOSION_PROTECTED(x, y))
- Kill
Hero
(PLAYERINFO(x, y));
+ Kill
Player
(PLAYERINFO(x, y));
}
}
-void Bury
Hero
(struct PlayerInfo *player)
+void Bury
Player
(struct PlayerInfo *player)
{
int jx = player->jx, jy = player->jy;
{
int jx = player->jx, jy = player->jy;
@@
-9212,10
+9213,10
@@
void BuryHero(struct PlayerInfo *player)
PlayLevelSound(jx, jy, SND_GAME_LOSING);
player->GameOver = TRUE;
PlayLevelSound(jx, jy, SND_GAME_LOSING);
player->GameOver = TRUE;
- Remove
Hero
(player);
+ Remove
Player
(player);
}
}
-void Remove
Hero
(struct PlayerInfo *player)
+void Remove
Player
(struct PlayerInfo *player)
{
int jx = player->jx, jy = player->jy;
int i, found = FALSE;
{
int jx = player->jx, jy = player->jy;
int i, found = FALSE;
@@
-9226,6
+9227,9
@@
void RemoveHero(struct PlayerInfo *player)
if (!ExplodeField[jx][jy])
StorePlayer[jx][jy] = 0;
if (!ExplodeField[jx][jy])
StorePlayer[jx][jy] = 0;
+ if (player->is_moving)
+ DrawLevelField(player->last_jx, player->last_jy);
+
for (i = 0; i < MAX_PLAYERS; i++)
if (stored_player[i].active)
found = TRUE;
for (i = 0; i < MAX_PLAYERS; i++)
if (stored_player[i].active)
found = TRUE;