Add in Invincibility Cheat Code
- added a toggleable invincibility cheat code - video showcasing toggling attached!
This commit is contained in:
parent
3c80dc8b69
commit
9caceae408
|
@ -14,6 +14,10 @@ struct CheatCodePattern gCheatCodes[CheatCodeCount] = {
|
||||||
{'u', 'd', 'u', 'd', 'u', 'd', 'r', 'r'},
|
{'u', 'd', 'u', 'd', 'u', 'd', 'r', 'r'},
|
||||||
SOUNDS_BUTTONCLICKRELEASE,
|
SOUNDS_BUTTONCLICKRELEASE,
|
||||||
},
|
},
|
||||||
|
[CheatCodeInvincibility] = {
|
||||||
|
{'u', 'd', 'u', 'd', 'u', 'd', 'l', 'l'},
|
||||||
|
SOUNDS_BUTTONCLICKRELEASE,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned char gCheatProgress[CheatCodeCount];
|
unsigned char gCheatProgress[CheatCodeCount];
|
||||||
|
@ -32,6 +36,9 @@ void cheatCodeApply(enum CheatCode cheat) {
|
||||||
case CheatCodeHighJump:
|
case CheatCodeHighJump:
|
||||||
playerToggleJumpImpulse(&gScene.player, 6.5f);
|
playerToggleJumpImpulse(&gScene.player, 6.5f);
|
||||||
break;
|
break;
|
||||||
|
case CheatCodeInvincibility:
|
||||||
|
playerToggleInvincibility(&gScene.player);
|
||||||
|
break;
|
||||||
case CheatCodeCount:
|
case CheatCodeCount:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
enum CheatCode {
|
enum CheatCode {
|
||||||
CheatCodeUnlockGun,
|
CheatCodeUnlockGun,
|
||||||
CheatCodeHighJump,
|
CheatCodeHighJump,
|
||||||
|
CheatCodeInvincibility,
|
||||||
CheatCodeCount,
|
CheatCodeCount,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -459,6 +459,10 @@ void playerUpdateSpeedSound(struct Player* player) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void playerKill(struct Player* player, int isUnderwater) {
|
void playerKill(struct Player* player, int isUnderwater) {
|
||||||
|
if (player->flags & PlayerIsInvincible){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isUnderwater) {
|
if (isUnderwater) {
|
||||||
player->flags |= PlayerIsUnderwater;
|
player->flags |= PlayerIsUnderwater;
|
||||||
player->drownTimer = DROWN_TIME;
|
player->drownTimer = DROWN_TIME;
|
||||||
|
@ -968,3 +972,11 @@ void playerToggleJumpImpulse(struct Player* player, float newJumpImpulse){
|
||||||
player->jumpImpulse = JUMP_IMPULSE;
|
player->jumpImpulse = JUMP_IMPULSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void playerToggleInvincibility(struct Player* player){
|
||||||
|
if (player->flags & PlayerIsInvincible){
|
||||||
|
player->flags &= ~PlayerIsInvincible;
|
||||||
|
}else{
|
||||||
|
player->flags |= PlayerIsInvincible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ enum PlayerFlags {
|
||||||
PlayerJustDeniedSelect = (1 << 10),
|
PlayerJustDeniedSelect = (1 << 10),
|
||||||
PlayerJustShotPortalGun = (1 << 11),
|
PlayerJustShotPortalGun = (1 << 11),
|
||||||
PlayerInCutscene = (1 << 12),
|
PlayerInCutscene = (1 << 12),
|
||||||
|
PlayerIsInvincible = (1 << 13),
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Player {
|
struct Player {
|
||||||
|
@ -76,5 +77,6 @@ int playerIsGrabbing(struct Player* player);
|
||||||
void playerSerialize(struct Serializer* serializer, SerializeAction action, struct Player* player);
|
void playerSerialize(struct Serializer* serializer, SerializeAction action, struct Player* player);
|
||||||
void playerDeserialize(struct Serializer* serializer, struct Player* player);
|
void playerDeserialize(struct Serializer* serializer, struct Player* player);
|
||||||
void playerToggleJumpImpulse(struct Player* player, float newJumpImpulse);
|
void playerToggleJumpImpulse(struct Player* player, float newJumpImpulse);
|
||||||
|
void playerToggleInvincibility(struct Player* player);
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in a new issue