mirror of
https://github.com/pret/pmd-red.git
synced 2026-08-20 07:45:13 -05:00
file split status.c
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
.string "pksdir0\0"
|
||||
.string "pksdir0\0"
|
||||
.string "pksdir0\0"
|
||||
.string "pksdir0\0"
|
||||
@ HandleExplosion
|
||||
.string "pksdir0\0"
|
||||
|
||||
|
||||
@@ -588,6 +588,7 @@ SECTIONS {
|
||||
src/code_8075708.o(.rodata);
|
||||
src/dungeon_ai.o(.rodata);
|
||||
src/move_effects_target.o(.rodata);
|
||||
src/status.o(.rodata);
|
||||
data/data_8107010.o(.rodata);
|
||||
src/dungeon_serializer.o(.rodata);
|
||||
data/data_8107224.o(.rodata);
|
||||
|
||||
@@ -189,447 +189,6 @@ extern void sub_8041DD8(Entity *r0, s32 r1); // NOTE: is s16 in another file
|
||||
extern s32 sub_803D870(UnkDungeonGlobal_unk1CD98 *strPtr, s32 id);
|
||||
extern bool8 sub_806AA0C(s32, u32);
|
||||
|
||||
void MuzzleTarget(Entity *pokemon, Entity *target)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
if ((EntityIsValid(target)) && (!HasSafeguardStatus(pokemon, target, TRUE))) {
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
if (entityInfo->muzzled.muzzled != TRUE) {
|
||||
entityInfo->muzzled.muzzled = TRUE;
|
||||
entityInfo->muzzled.turns = CalculateStatusTurns(target,gMuzzledTurnRange, TRUE) + 1;
|
||||
nullsub_86(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FBF68);
|
||||
}
|
||||
else
|
||||
{
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FBF84);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
|
||||
void TransformStatusTarget(Entity * pokemon, Entity * target)
|
||||
{
|
||||
s16 species;
|
||||
s32 iVar5;
|
||||
s32 apparentID;
|
||||
s16 apparentID_s16;
|
||||
s32 index;
|
||||
EntityInfo *entityInfo;
|
||||
OpenedFile *sprite;
|
||||
UnkDungeonGlobal_unk1CD98 auStack544[64];
|
||||
|
||||
if (!EntityIsValid(target))
|
||||
return;
|
||||
|
||||
entityInfo = GetEntInfo(target);
|
||||
|
||||
if (entityInfo->invisibleClassStatus.status == STATUS_TRANSFORMED)
|
||||
TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FBF04);
|
||||
else {
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], target, 0);
|
||||
iVar5 = sub_803D870(auStack544, 0);
|
||||
|
||||
if (iVar5 == 0)
|
||||
TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FBEE4);
|
||||
else {
|
||||
sprite = NULL;
|
||||
|
||||
for (index = 0; index < DUNGEON_MAX_POKEMON; index++) {
|
||||
species = ExtractSpeciesIndex(&auStack544[DungeonRandInt(iVar5)]);
|
||||
apparentID_s16 = GetMonsterApparentID(target, species);
|
||||
apparentID = apparentID_s16;
|
||||
|
||||
if (apparentID != entityInfo->apparentID && sub_806AA0C(apparentID, 1)) {
|
||||
sprite = GetSpriteData(apparentID);
|
||||
if (sprite != NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (index == DUNGEON_MAX_POKEMON || sprite == NULL)
|
||||
TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FBEE4);
|
||||
else {
|
||||
entityInfo->apparentID = apparentID;
|
||||
target->axObj.spriteFile = sprite;
|
||||
entityInfo->invisibleClassStatus.status = STATUS_TRANSFORMED;
|
||||
entityInfo->invisibleClassStatus.turns = CalculateStatusTurns(target, gTransformedTurnRange, TRUE) + 1;
|
||||
sub_806CF98(target);
|
||||
nullsub_87(target);
|
||||
sub_806CCB4(target, sub_806CEBC(target));
|
||||
CopyCyanMonsterNametoBuffer(gFormatBuffer_Monsters[1], entityInfo->apparentID);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FBEC0);
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MobileStatusTarget(Entity * pokemon, Entity * target)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
|
||||
if (EntityIsValid(target)) {
|
||||
entityInfo = GetEntInfo(target);
|
||||
|
||||
if (entityInfo->invisibleClassStatus.status == STATUS_TRANSFORMED) {
|
||||
SendTransformEndMessage(pokemon,target);
|
||||
}
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
if (entityInfo->invisibleClassStatus.status != STATUS_MOBILE) {
|
||||
entityInfo->invisibleClassStatus.status = STATUS_MOBILE;
|
||||
entityInfo->invisibleClassStatus.turns = CalculateStatusTurns(target,gMobileTurnRange, FALSE) + 1;
|
||||
nullsub_88(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FBF28);
|
||||
}
|
||||
else {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FBF50);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
|
||||
void ExposeStatusTarget(Entity * pokemon, Entity * target, s16 param_3)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
s32 param_3_s16;
|
||||
s32 param_3_s16_2;
|
||||
bool32 flag;
|
||||
bool32 flag2;
|
||||
|
||||
param_3_s16 = param_3;
|
||||
param_3_s16_2 = param_3_s16;
|
||||
flag = FALSE;
|
||||
flag2 = FALSE;
|
||||
|
||||
if ((EntityIsValid(target)) && (!HasSafeguardStatus(pokemon,target,TRUE))) {
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
if (entityInfo->hitChanceStages[1] > 10) {
|
||||
entityInfo->hitChanceStages[1] = 10;
|
||||
flag = TRUE;
|
||||
}
|
||||
if(flag)
|
||||
{
|
||||
sub_8041DD8(target,param_3_s16);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC000);
|
||||
flag2 = TRUE;
|
||||
}
|
||||
if (entityInfo->exposed) {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FBFB8);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!flag2) {
|
||||
sub_8041DD8(target,param_3_s16_2);
|
||||
}
|
||||
if (!MonsterIsType(target, TYPE_GHOST)) {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FBFD8);
|
||||
}
|
||||
else {
|
||||
entityInfo->exposed = TRUE;
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FBF9C);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IdentityItemHolders(Entity *pokemon, Entity *target)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
if ((EntityIsValid(target)) && (!HasSafeguardStatus(pokemon, target, TRUE))) {
|
||||
entityInfo = GetEntInfo(target);
|
||||
if (!gDungeon->unk644.itemHoldersIdentified) {
|
||||
nullsub_89(target);
|
||||
gDungeon->unk644.itemHoldersIdentified = TRUE;
|
||||
EntityUpdateStatusSprites(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC028);
|
||||
}
|
||||
else
|
||||
{
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC054);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BlindTarget(Entity *pokemon, Entity *target)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
if ((EntityIsValid(target)) && (!HasSafeguardStatus(pokemon, target, TRUE))) {
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
if (entityInfo->blinkerClassStatus.status != STATUS_BLINKER) {
|
||||
entityInfo->blinkerClassStatus.status = STATUS_BLINKER;
|
||||
entityInfo->blinkerClassStatus.turns = CalculateStatusTurns(target,gBlinkerTurnRange, TRUE) + 1;
|
||||
sub_8041E0C(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FB7F4);
|
||||
DungeonRunFrameActions(0x31);
|
||||
sub_8049ED4();
|
||||
ShowWholeRevealedDungeonMap();
|
||||
}
|
||||
else
|
||||
{
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FB810);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
|
||||
void CrossEyeVisionTarget(Entity *pokemon, Entity *target)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
|
||||
if (EntityIsValid(target)) {
|
||||
if(!HasSafeguardStatus(pokemon, target, TRUE))
|
||||
{
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
if (entityInfo->blinkerClassStatus.status != STATUS_CROSS_EYED) {
|
||||
sub_8041E1C(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FB834);
|
||||
entityInfo->blinkerClassStatus.status = STATUS_CROSS_EYED;
|
||||
entityInfo->blinkerClassStatus.turns = CalculateStatusTurns(target,gCrossEyedTurnRange, TRUE) + 1;
|
||||
sub_803F580(0x1);
|
||||
sub_8049ED4();
|
||||
ShowWholeRevealedDungeonMap();
|
||||
}
|
||||
else
|
||||
{
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FB85C);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RestoreVisionTarget(Entity *pokemon, Entity *target)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
|
||||
if (EntityIsValid(target)) {
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
if (entityInfo->blinkerClassStatus.status != STATUS_EYEDROPS) {
|
||||
entityInfo->blinkerClassStatus.status = STATUS_EYEDROPS;
|
||||
entityInfo->blinkerClassStatus.turns = CalculateStatusTurns(target,gEyedropsTurnRange, FALSE) + 1;
|
||||
sub_8041E3C(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FB880);
|
||||
DungeonRunFrameActions(0x31);
|
||||
sub_8049ED4();
|
||||
ShowWholeRevealedDungeonMap();
|
||||
}
|
||||
else
|
||||
{
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FB89C);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
|
||||
void RestorePPTarget(Entity * pokemon,Entity * target, s32 param_3)
|
||||
{
|
||||
volatile s32 PP;
|
||||
volatile s32 basePP;
|
||||
Move *movePtr;
|
||||
Move *movePtr1;
|
||||
s32 index;
|
||||
bool8 PPChanged;
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
PPChanged = FALSE;
|
||||
if (EntityIsValid(target)) {
|
||||
entityInfo = GetEntInfo(target);
|
||||
|
||||
for(index = 0; index < MAX_MON_MOVES; index++)
|
||||
{
|
||||
movePtr = &entityInfo->moves.moves[index];
|
||||
movePtr1 = movePtr;
|
||||
if ((movePtr->moveFlags & MOVE_FLAG_EXISTS)) {
|
||||
PP = movePtr->PP;
|
||||
basePP = GetMoveBasePP(movePtr1);
|
||||
if (PP < basePP) {
|
||||
PP += param_3;
|
||||
if (PP > basePP) {
|
||||
PP = basePP;
|
||||
}
|
||||
movePtr->PP = PP;
|
||||
PPChanged = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (PPChanged) {
|
||||
sub_8041E4C(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FDBD0);
|
||||
}
|
||||
else {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FDBF0);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
|
||||
void RaiseAtkStatTarget(Entity * pokemon, Entity *target, s32 increment)
|
||||
{
|
||||
u32 oldStat;
|
||||
u32 oldStat1;
|
||||
s32 newStat;
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
if (EntityIsValid(target)) {
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
|
||||
entityInfo = GetEntInfo(target);
|
||||
oldStat = entityInfo->atk[0];
|
||||
oldStat1 = oldStat;
|
||||
|
||||
newStat = entityInfo->atk[0] + increment;
|
||||
if (0xfe < newStat) {
|
||||
newStat = 0xff;
|
||||
}
|
||||
entityInfo->atk[0] = newStat;
|
||||
if (oldStat1 < (u8)newStat) {
|
||||
sub_8041E60(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC33C);
|
||||
}
|
||||
else {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC360);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
|
||||
void RaiseSpAtkStatTarget(Entity * pokemon, Entity *target, s32 increment)
|
||||
{
|
||||
u32 oldStat;
|
||||
u32 oldStat1;
|
||||
s32 newStat;
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
if (EntityIsValid(target)) {
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
|
||||
entityInfo = GetEntInfo(target);
|
||||
oldStat = entityInfo->atk[1];
|
||||
oldStat1 = oldStat;
|
||||
|
||||
newStat = entityInfo->atk[1] + increment;
|
||||
if (0xfe < newStat) {
|
||||
newStat = 0xff;
|
||||
}
|
||||
entityInfo->atk[1] = newStat;
|
||||
if (oldStat1 < (u8)newStat) {
|
||||
sub_8041E74(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC388);
|
||||
}
|
||||
else {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC3B4);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
|
||||
void RaiseDefStatTarget(Entity * pokemon, Entity *target, s32 increment)
|
||||
{
|
||||
u32 oldStat;
|
||||
u32 oldStat1;
|
||||
s32 newStat;
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
if (EntityIsValid(target)) {
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
|
||||
entityInfo = GetEntInfo(target);
|
||||
oldStat = entityInfo->def[0];
|
||||
oldStat1 = oldStat;
|
||||
|
||||
newStat = entityInfo->def[0] + increment;
|
||||
if (0xfe < newStat) {
|
||||
newStat = 0xff;
|
||||
}
|
||||
entityInfo->def[0] = newStat;
|
||||
if (oldStat1 < (u8)newStat) {
|
||||
sub_8041E84(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC3D8);
|
||||
}
|
||||
else {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC3FC);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
|
||||
void RaiseSpDefStatTarget(Entity * pokemon, Entity *target, s32 increment)
|
||||
{
|
||||
u32 oldStat;
|
||||
u32 oldStat1;
|
||||
s32 newStat;
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
if (EntityIsValid(target)) {
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
|
||||
entityInfo = GetEntInfo(target);
|
||||
oldStat = entityInfo->def[1];
|
||||
oldStat1 = oldStat;
|
||||
|
||||
newStat = entityInfo->def[1] + increment;
|
||||
if (0xfe < newStat) {
|
||||
newStat = 0xff;
|
||||
}
|
||||
entityInfo->def[1] = newStat;
|
||||
if (oldStat1 < (u8)newStat) {
|
||||
sub_8041E94(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC428);
|
||||
}
|
||||
else {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC454);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
|
||||
void LongTossStatusTarget(Entity * pokemon, Entity * target)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[1],target,0);
|
||||
if (entityInfo->longTossClassStatus.status != STATUS_LONG_TOSS) {
|
||||
entityInfo->longTossClassStatus.status = STATUS_LONG_TOSS;
|
||||
sub_8041EA4(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FD20C);
|
||||
}
|
||||
else {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FD22C);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
|
||||
void PierceStatusTarget(Entity * pokemon, Entity * target)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[1],target,0);
|
||||
if (entityInfo->longTossClassStatus.status != STATUS_PIERCE) {
|
||||
entityInfo->longTossClassStatus.status = STATUS_PIERCE;
|
||||
sub_8041EB4(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FD254);
|
||||
}
|
||||
else {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FD27C);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
|
||||
void SetChargeStatusTarget(Entity *pokemon, Entity *target, u8 newStatus, Move *move, const u8 *message)
|
||||
{
|
||||
bool8 bVar2;
|
||||
|
||||
701
src/status.c
701
src/status.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user