slight fixes

This commit is contained in:
DizzyEggg 2024-10-18 09:05:22 +02:00
parent 7cf84b76f5
commit db22b0a484
8 changed files with 80 additions and 113 deletions

View File

@ -502,39 +502,39 @@ void DungeonHandlePlayerInput(void)
sub_806CDD4(leader, sub_806CEBC(leader), directionNew);
}
else {
u8 r4 = 0;
const u8 *msg = NULL;
u8 canMoveFlags = 0;
const u8 *immobilizedMsg = NULL;
if (sub_805EC4C(leader, 1))
break;
if (leaderInfo->immobilize.immobilizeStatus == 2) {
msg = gUnknown_80F8A84, r4 |= 1;
if (leaderInfo->immobilize.immobilizeStatus == STATUS_SHADOW_HOLD) {
immobilizedMsg = gUnknown_80F8A84, canMoveFlags |= 1;
}
else if (leaderInfo->immobilize.immobilizeStatus == 7) {
msg = gUnknown_80F8A6C, r4 |= 1;
else if (leaderInfo->immobilize.immobilizeStatus == STATUS_CONSTRICTION) {
immobilizedMsg = gUnknown_80F8A6C, canMoveFlags |= 1;
}
else if (leaderInfo->immobilize.immobilizeStatus == 5) {
msg = gUnknown_80F8AB0, r4 |= 1;
else if (leaderInfo->immobilize.immobilizeStatus == STATUS_INGRAIN) {
immobilizedMsg = gUnknown_80F8AB0, canMoveFlags |= 1;
}
else if (leaderInfo->immobilize.immobilizeStatus == 3) {
msg = gUnknown_80F8ADC, r4 |= 1;
else if (leaderInfo->immobilize.immobilizeStatus == STATUS_WRAP) {
immobilizedMsg = gUnknown_80F8ADC, canMoveFlags |= 1;
}
else if (leaderInfo->immobilize.immobilizeStatus == 4) {
msg = gUnknown_80F8B0C, r4 |= 1;
else if (leaderInfo->immobilize.immobilizeStatus == STATUS_WRAPPED) {
immobilizedMsg = gUnknown_80F8B0C, canMoveFlags |= 1;
}
if (!CanMoveInDirection(leader, directionNew))
r4 |= 2;
canMoveFlags |= 2;
if (directionChanged) {
sub_806CDD4(leader, sub_806CEBC(leader), directionNew);
}
if (!(r4 & 2)) {
if (r4 & 1) {
if (msg != NULL) {
SendMessage(leader, msg);
if (!(canMoveFlags & 2)) {
if (canMoveFlags & 1) {
if (immobilizedMsg != NULL) {
SendMessage(leader, immobilizedMsg);
}
sub_8044C50(1);
gDungeon->unk673 = 1;
@ -542,7 +542,7 @@ void DungeonHandlePlayerInput(void)
else {
sub_8044C50(2);
if ((gRealInputs.held & B_BUTTON || bPress) && FixedPointToInt(leaderInfo->belly) != 0) {
if (GetEntInfo(leader)->volatileStatus.volatileStatus != 2) {
if (GetEntInfo(leader)->volatileStatus.volatileStatus != STATUS_CONFUSED) {
gDungeon->unk66C = 1;
}
leaderInfo->action.unk4[0].actionUseIndex = 0;
@ -553,7 +553,7 @@ void DungeonHandlePlayerInput(void)
}
break;
}
else if (r4 & 1) {
else if (canMoveFlags & 1) {
sub_803E724(0x23);
}
@ -1536,7 +1536,7 @@ bool8 sub_805EC4C(Entity *a0, u8 a1)
Tile *tile;
EntityInfo *tileMonsterInfo;
Entity *tileMonster;
EntityInfo *entityInfo = a0->info;
EntityInfo *entityInfo = GetEntInfo(a0);
pos.x = a0->pos.x + gAdjacentTileOffsets[entityInfo->action.direction].x;
pos.y = a0->pos.y + gAdjacentTileOffsets[entityInfo->action.direction].y;
@ -1546,11 +1546,11 @@ bool8 sub_805EC4C(Entity *a0, u8 a1)
if (tileMonster == NULL) return FALSE;
if (GetEntityType(tileMonster) != ENTITY_MONSTER) return FALSE;
tileMonsterInfo = tileMonster->info;
tileMonsterInfo = GetEntInfo(tileMonster);
if (tileMonsterInfo->isNotTeamMember
&& (tileMonsterInfo->shopkeeper != 1 && tileMonsterInfo->shopkeeper != 2)
&& !IsClientOrTeamBase(tileMonsterInfo->joinedAt.joinedAt)
&& tileMonsterInfo->clientType != 1) {
&& tileMonsterInfo->clientType != CLIENT_TYPE_CLIENT) {
return FALSE;
}
@ -3441,7 +3441,7 @@ void sub_806145C(struct UnkFieldTeamMenuStruct *a0)
gUnknown_202EE6C = 0;
teamMon = gDungeon->teamPokemon[a0->unk4[gUnknown_202EE10.menuIndex]];
monInfo = teamMon->info;
monInfo = GetEntInfo(teamMon);
sub_8044F5C(0x1B, 0);
sub_8044F5C(0x19, 0);
if (!monInfo->isTeamLeader) {
@ -3453,28 +3453,27 @@ void sub_806145C(struct UnkFieldTeamMenuStruct *a0)
sub_8044F5C(0x30, 0);
if (!monInfo->isTeamLeader) {
sub_8044F5C(0x1A, 0);
// Why checking teamLeader again?
if (!monInfo->isTeamLeader && gDungeon->unk65C && CanLeaderSwitch(gDungeon->dungeonLocation.id)) {
bool32 r5;
}
if (!monInfo->isTeamLeader && gDungeon->unk65C && CanLeaderSwitch(gDungeon->dungeonLocation.id)) {
bool32 r5;
sub_8044F5C(0x3B, 0);
r5 = TRUE;
if (monInfo->teamIndex >= MAX_TEAM_MEMBERS) {
sub_8044F5C(0x3B, 0);
r5 = TRUE;
if (monInfo->teamIndex >= MAX_TEAM_MEMBERS) {
r5 = FALSE;
}
else {
PokemonStruct2 *mon = &gRecruitedPokemonRef->pokemon2[monInfo->teamIndex];
if (sub_806A538(mon->unkA)) {
r5 = FALSE;
}
else {
PokemonStruct2 *mon = &gRecruitedPokemonRef->pokemon2[monInfo->teamIndex];
if (sub_806A538(mon->unkA)) {
r5 = FALSE;
}
}
}
if (CheckVariousStatuses2(teamMon, FALSE)) {
r5 = FALSE;
}
if (!r5) {
sub_8044FF0(0x3B);
}
if (CheckVariousStatuses2(teamMon, FALSE)) {
r5 = FALSE;
}
if (!r5) {
sub_8044FF0(0x3B);
}
}

View File

@ -171,21 +171,18 @@ void sub_806CE94(Entity *entity, u32 newDir)
u8 sub_806CEBC(Entity *entity)
{
u8 sleep;
EntityInfo *entityInfo1;
EntityInfo *entityInfo2;
EntityInfo *entityInfo;
// NOTE: copy needed to match
entityInfo1 = entity->info;
entityInfo2 = entity->info;
sleep = entityInfo1->sleep.sleep;
entityInfo = GetEntInfo(entity);
sleep = entityInfo->sleep.sleep;
if (sleep == STATUS_SLEEP || sleep == STATUS_NAPPING || sleep == STATUS_NIGHTMARE) {
if (entityInfo2->apparentID != MONSTER_SUDOWOODO || entityInfo2->sleep.sleepTurns != 0x7F)
if (entityInfo->apparentID != MONSTER_SUDOWOODO || entityInfo->sleep.sleepTurns != 0x7F)
return 5;
else
return 7;
}
if (entityInfo2->charging.chargingStatus == STATUS_BIDE)
if (entityInfo->charging.chargingStatus == STATUS_BIDE)
return 11;
return 7;
}

View File

@ -508,14 +508,11 @@ void RaiseAtkStatTarget(Entity * pokemon, Entity *target, s32 increment)
u32 oldStat1;
s32 newStat;
EntityInfo *entityInfo;
EntityInfo *entityInfo1;
if (EntityExists(target)) {
SetMessageArgument(gAvailablePokemonNames,target,0);
// NOTE: had to have duplicates to match..
entityInfo = target->info;
entityInfo1 = entityInfo;
entityInfo = GetEntInfo(target);
oldStat = entityInfo->atk;
oldStat1 = oldStat;
@ -523,7 +520,7 @@ void RaiseAtkStatTarget(Entity * pokemon, Entity *target, s32 increment)
if (0xfe < newStat) {
newStat = 0xff;
}
entityInfo1->atk = newStat;
entityInfo->atk = newStat;
if (oldStat1 < (u8)newStat) {
sub_8041E60(target);
sub_80522F4(pokemon,target,*gUnknown_80FC33C);
@ -541,14 +538,11 @@ void RaiseSpAtkStatTarget(Entity * pokemon, Entity *target, s32 increment)
u32 oldStat1;
s32 newStat;
EntityInfo *entityInfo;
EntityInfo *entityInfo1;
if (EntityExists(target)) {
SetMessageArgument(gAvailablePokemonNames,target,0);
// NOTE: had to have duplicates to match..
entityInfo = target->info;
entityInfo1 = entityInfo;
entityInfo = GetEntInfo(target);
oldStat = entityInfo->spAtk;
oldStat1 = oldStat;
@ -556,7 +550,7 @@ void RaiseSpAtkStatTarget(Entity * pokemon, Entity *target, s32 increment)
if (0xfe < newStat) {
newStat = 0xff;
}
entityInfo1->spAtk = newStat;
entityInfo->spAtk = newStat;
if (oldStat1 < (u8)newStat) {
sub_8041E74(target);
sub_80522F4(pokemon,target,*gUnknown_80FC388);
@ -574,14 +568,11 @@ void RaiseDefStatTarget(Entity * pokemon, Entity *target, s32 increment)
u32 oldStat1;
s32 newStat;
EntityInfo *entityInfo;
EntityInfo *entityInfo1;
if (EntityExists(target)) {
SetMessageArgument(gAvailablePokemonNames,target,0);
// NOTE: had to have duplicates to match..
entityInfo = target->info;
entityInfo1 = entityInfo;
entityInfo = GetEntInfo(target);
oldStat = entityInfo->def;
oldStat1 = oldStat;
@ -589,7 +580,7 @@ void RaiseDefStatTarget(Entity * pokemon, Entity *target, s32 increment)
if (0xfe < newStat) {
newStat = 0xff;
}
entityInfo1->def = newStat;
entityInfo->def = newStat;
if (oldStat1 < (u8)newStat) {
sub_8041E84(target);
sub_80522F4(pokemon,target,*gUnknown_80FC3D8);
@ -607,14 +598,11 @@ void RaiseSpDefStatTarget(Entity * pokemon, Entity *target, s32 increment)
u32 oldStat1;
s32 newStat;
EntityInfo *entityInfo;
EntityInfo *entityInfo1;
if (EntityExists(target)) {
SetMessageArgument(gAvailablePokemonNames,target,0);
// NOTE: had to have duplicates to match..
entityInfo = target->info;
entityInfo1 = entityInfo;
entityInfo = GetEntInfo(target);
oldStat = entityInfo->spDef;
oldStat1 = oldStat;
@ -622,7 +610,7 @@ void RaiseSpDefStatTarget(Entity * pokemon, Entity *target, s32 increment)
if (0xfe < newStat) {
newStat = 0xff;
}
entityInfo1->spDef = newStat;
entityInfo->spDef = newStat;
if (oldStat1 < (u8)newStat) {
sub_8041E94(target);
sub_80522F4(pokemon,target,*gUnknown_80FC428);

View File

@ -106,9 +106,8 @@ u8 sub_80703A0(Entity *pokemon, Position *pos)
bool8 CanCrossWalls(Entity *pokemon)
{
EntityInfo *pokemonInfo = pokemon->info;
EntityInfo *pokemonInfo2 = pokemonInfo;
if (pokemonInfo2->transformStatus.transformStatus == STATUS_MOBILE)
EntityInfo *pokemonInfo = GetEntInfo(pokemon);
if (pokemonInfo->transformStatus.transformStatus == STATUS_MOBILE)
{
return TRUE;
}
@ -116,7 +115,7 @@ bool8 CanCrossWalls(Entity *pokemon)
{
return TRUE;
}
if (GetCrossableTerrain(pokemonInfo2->id) == CROSSABLE_TERRAIN_WALL)
if (GetCrossableTerrain(pokemonInfo->id) == CROSSABLE_TERRAIN_WALL)
{
return TRUE;
}

View File

@ -2663,17 +2663,12 @@ bool8 sub_805A688(Entity *pokemon, Entity *target, Move *move, u32 param_4)
bool8 KnockOffMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4)
{
EntityInfo *entityInfo;
EntityInfo *targetEntityInfo1;
EntityInfo *targetEntityInfo2;
EntityInfo *targetEntityInfo;
Item heldItem;
Position pos;
Item *itemPtr;
u32 flag;
u32 itemFlag;
entityInfo = pokemon->info;
targetEntityInfo1 = target->info;
targetEntityInfo2 = targetEntityInfo1;
entityInfo = GetEntInfo(pokemon);
targetEntityInfo = GetEntInfo(target);
SetMessageArgument(gAvailablePokemonNames, pokemon, 0);
SetMessageArgument(gAvailablePokemonNames + 0x50, target, 0);
if (HasAbility(target, ABILITY_STICKY_HOLD))
@ -2688,21 +2683,15 @@ bool8 KnockOffMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_
}
else
{
heldItem = targetEntityInfo1->heldItem;
itemFlag = heldItem.flags;
flag = ITEM_FLAG_EXISTS;
flag &= itemFlag;
if (flag == 0)
heldItem = targetEntityInfo->heldItem;
if (!ItemExists(&heldItem))
{
sub_80522F4(pokemon,target,*gUnknown_80FD18C);
return FALSE;
}
else
{
itemPtr = &targetEntityInfo2->heldItem;
itemPtr->id = ITEM_NOTHING;
itemPtr->quantity = 0;
itemPtr->flags = 0;
ZeroOutItem(&targetEntityInfo->heldItem);
sub_80522F4(pokemon,target,*gUnknown_80FD170); // $m1's item was swatted down!
pos.x = gAdjacentTileOffsets[entityInfo->action.direction].x;
pos.y = gAdjacentTileOffsets[entityInfo->action.direction].y;

View File

@ -759,7 +759,7 @@ void FrozenStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage)
}
else
{
if ((u8)(entityInfo->immobilize.immobilizeStatus - 3) <= 1) {
if (entityInfo->immobilize.immobilizeStatus == STATUS_WRAP || entityInfo->immobilize.immobilizeStatus == STATUS_WRAPPED) {
sub_8076CB4(entityInfo->unk9C);
}
sub_8041F08(target);
@ -781,8 +781,8 @@ void SqueezedStatusTarget(Entity * pokemon, Entity * target, s16 param_3, bool32
bool8 displayMessage_u8 = displayMessage;
if ((EntityExists(target)) && (!HasSafeguardStatus(pokemon,target,displayMessage_u8))) {
entityInfo = target->info;
if ((u8)(entityInfo->immobilize.immobilizeStatus - 3U) < 2) {
entityInfo = GetEntInfo(target);
if (entityInfo->immobilize.immobilizeStatus == STATUS_WRAP || entityInfo->immobilize.immobilizeStatus == STATUS_WRAPPED) {
sub_8076CB4(entityInfo->unk9C);
}
else if (entityInfo->immobilize.immobilizeStatus == STATUS_INGRAIN) {
@ -811,8 +811,8 @@ void ImmobilizedStatusTarget(Entity * pokemon, Entity * target)
EntityInfo *entityInfo;
if ((EntityExists(target)) && (!HasSafeguardStatus(pokemon,target,TRUE))) {
entityInfo = target->info;
if ((u8)(entityInfo->immobilize.immobilizeStatus - 3U) < 2) {
entityInfo = GetEntInfo(target);
if (entityInfo->immobilize.immobilizeStatus == STATUS_WRAP || entityInfo->immobilize.immobilizeStatus == STATUS_WRAPPED) {
sub_8076CB4(entityInfo->unk9C);
}
else if (entityInfo->immobilize.immobilizeStatus == STATUS_INGRAIN) {
@ -838,19 +838,17 @@ void ImmobilizedStatusTarget(Entity * pokemon, Entity * target)
void IngrainedStatusTarget(Entity * pokemon, Entity * target)
{
EntityInfo *entityInfo;
EntityInfo *entityInfo2;
if (EntityExists(target)) {
entityInfo = target->info;
entityInfo2 = entityInfo;
if ((u8)(entityInfo->immobilize.immobilizeStatus - 3U) < 2) {
entityInfo = GetEntInfo(target);
if (entityInfo->immobilize.immobilizeStatus == STATUS_WRAP || entityInfo->immobilize.immobilizeStatus == STATUS_WRAPPED) {
sub_8076CB4(entityInfo->unk9C);
}
SetMessageArgument(gAvailablePokemonNames,target,0);
if (entityInfo2->immobilize.immobilizeStatus != STATUS_INGRAIN) {
entityInfo2->immobilize.immobilizeStatus = STATUS_INGRAIN;
entityInfo2->immobilize.immobilizeStatusTurns = CalculateStatusTurns(target,gUnknown_80F4E60,TRUE) + 1;
entityInfo2->immobilize.immobilizeStatusDamageCountdown = 0;
if (entityInfo->immobilize.immobilizeStatus != STATUS_INGRAIN) {
entityInfo->immobilize.immobilizeStatus = STATUS_INGRAIN;
entityInfo->immobilize.immobilizeStatusTurns = CalculateStatusTurns(target,gUnknown_80F4E60,TRUE) + 1;
entityInfo->immobilize.immobilizeStatusDamageCountdown = 0;
nullsub_90(target);
sub_80522F4(pokemon,target,*gUnknown_80FB6A4);
}

View File

@ -1092,8 +1092,7 @@ void SnatchStatusTarget(Entity * pokemon, Entity * target)
{
Entity * entity;
s32 index;
EntityInfo * targetEntityInfo;
EntityInfo * targetEntityInfo2;
EntityInfo *targetEntityInfo;
if (EntityExists(target)) {
SendWaitingEndMessage(pokemon,target,STATUS_SNATCH);
@ -1107,8 +1106,7 @@ void SnatchStatusTarget(Entity * pokemon, Entity * target)
}
nullsub_81(target);
targetEntityInfo = target->info;
targetEntityInfo2 = targetEntityInfo;
targetEntityInfo = GetEntInfo(target);
if (targetEntityInfo->waitingStruct.waitingStatus != STATUS_SNATCH) {
targetEntityInfo->waitingStruct.waitingStatus = STATUS_SNATCH;
targetEntityInfo->waitingStruct.waitingStatusTurns= CalculateStatusTurns(target,gUnknown_80F4EA8,FALSE) + 1;
@ -1116,7 +1114,7 @@ void SnatchStatusTarget(Entity * pokemon, Entity * target)
}
gDungeon->snatchPokemon = target;
gDungeon->unk17B3C = targetEntityInfo2->unk98;
gDungeon->unk17B3C = targetEntityInfo->unk98;
SetMessageArgument(gAvailablePokemonNames,target,0);
sub_80522F4(pokemon,target,*gUnknown_80FB01C);
EntityUpdateStatusSprites(target);
@ -1313,7 +1311,7 @@ void sub_8078B5C(Entity *pokemon, Entity *target, u32 bellyIncrement, s32 maxBel
{
bellySizeIncreased = TRUE;
}
if (bellyIncrement == 999)
if (bellyIncrement == 999)
{
bellySizeIncreased = TRUE;
}
@ -1360,7 +1358,7 @@ void sub_8078B5C(Entity *pokemon, Entity *target, u32 bellyIncrement, s32 maxBel
}
else {
if (FixedPointToInt(*bellyPtr) >= FixedPointToInt(*puVar8)) {
if (displayMessage) sub_80522F4(pokemon,target,*gUnknown_80FBE64); // $m0's belly filled up full!
if (displayMessage) sub_80522F4(pokemon,target,*gUnknown_80FBE64); // $m0's belly filled up full!
}
else
{

View File

@ -179,14 +179,13 @@ bool8 IsSleeping(Entity *pokemon)
bool8 HasLowHealth(Entity *pokemon)
{
EntityInfo *pokemonInfo = pokemon->info;
EntityInfo *pokemonInfo2 = pokemon->info;
EntityInfo *pokemonInfo = GetEntInfo(pokemon);
s32 maxHPStat = pokemonInfo->maxHPStat;
if (maxHPStat < 0)
{
maxHPStat += 3;
}
if (pokemonInfo2->HP <= maxHPStat >> 2)
if (pokemonInfo->HP <= maxHPStat >> 2)
{
return TRUE;
}