mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
unsigned -> unsigned int; create header
This commit is contained in:
parent
10068b0345
commit
921011592c
@ -88,6 +88,7 @@
|
||||
|
||||
#define BATTLE_OUTCOME_BIT_x80 0x80
|
||||
|
||||
#define STATUS_NONE 0x0
|
||||
#define STATUS_SLEEP 0x7
|
||||
#define STATUS_POISON 0x8
|
||||
#define STATUS_BURN 0x10
|
||||
|
19
include/field_poison.h
Normal file
19
include/field_poison.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef GUARD_FIELD_POISON_H
|
||||
#define GUARD_FIELD_POISON_H
|
||||
|
||||
// Exported type declarations
|
||||
|
||||
// Exported RAM declarations
|
||||
|
||||
// Exported ROM declarations
|
||||
|
||||
enum {
|
||||
FLDPSN_NONE,
|
||||
FLDPSN_PSN,
|
||||
FLDPSN_FNT
|
||||
};
|
||||
|
||||
void sub_80F972C(void);
|
||||
unsigned int overworld_poison(void);
|
||||
|
||||
#endif //GUARD_FIELD_POISON_H
|
@ -1,6 +1,15 @@
|
||||
#ifndef GUARD_PARTY_MENU_H
|
||||
#define GUARD_PARTY_MENU_H
|
||||
|
||||
enum {
|
||||
AILMENT_NONE,
|
||||
AILMENT_PSN,
|
||||
AILMENT_PRZ,
|
||||
AILMENT_SLP,
|
||||
AILMENT_FRZ,
|
||||
AILMENT_BRN
|
||||
};
|
||||
|
||||
bool8 pokemon_has_move(struct Pokemon *, u16);
|
||||
void sub_81B58A8(void);
|
||||
void DoWallyTutorialBagMenu(void);
|
||||
|
@ -10,7 +10,9 @@
|
||||
#include "pokenav.h"
|
||||
#include "event_data.h"
|
||||
#include "script.h"
|
||||
#include "battle.h"
|
||||
#include "fldeff_80F9BCC.h"
|
||||
#include "field_poison.h"
|
||||
|
||||
static bool32 sub_80F9568(struct Pokemon *pokemon)
|
||||
{
|
||||
@ -39,11 +41,8 @@ static bool32 sub_80F958C(void)
|
||||
|
||||
static void sub_80F95C0(u8 partyIdx)
|
||||
{
|
||||
struct Pokemon *pokemon;
|
||||
unsigned status;
|
||||
|
||||
pokemon = &gPlayerParty[partyIdx];
|
||||
status = 0;
|
||||
struct Pokemon *pokemon = gPlayerParty + partyIdx;
|
||||
unsigned int status = STATUS_NONE;
|
||||
AdjustFriendship(pokemon, 0x07);
|
||||
SetMonData(pokemon, MON_DATA_STATUS, &status);
|
||||
GetMonData(pokemon, MON_DATA_NICKNAME, gStringVar1);
|
||||
@ -52,10 +51,8 @@ static void sub_80F95C0(u8 partyIdx)
|
||||
|
||||
static bool32 sub_80F960C(u8 partyIdx)
|
||||
{
|
||||
struct Pokemon *pokemon;
|
||||
|
||||
pokemon = &gPlayerParty[partyIdx];
|
||||
if (sub_80F9568(pokemon) && GetMonData(pokemon, MON_DATA_HP) == 0 && pokemon_ailments_get_primary(GetMonData(pokemon, MON_DATA_STATUS)) == 1)
|
||||
struct Pokemon *pokemon = gPlayerParty + partyIdx;
|
||||
if (sub_80F9568(pokemon) && GetMonData(pokemon, MON_DATA_HP) == 0 && pokemon_ailments_get_primary(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@ -64,9 +61,7 @@ static bool32 sub_80F960C(u8 partyIdx)
|
||||
|
||||
static void sub_80F9654(u8 taskId)
|
||||
{
|
||||
s16 *data;
|
||||
|
||||
data = gTasks[taskId].data;
|
||||
s16 *data = gTasks[taskId].data;
|
||||
switch (data[0])
|
||||
{
|
||||
case 0:
|
||||
@ -116,42 +111,38 @@ void sub_80F972C(void)
|
||||
ScriptContext1_Stop();
|
||||
}
|
||||
|
||||
unsigned overworld_poison(void)
|
||||
unsigned int overworld_poison(void)
|
||||
{
|
||||
int i;
|
||||
unsigned cnt1;
|
||||
unsigned cnt2;
|
||||
unsigned hp;
|
||||
struct Pokemon *pokemon;
|
||||
|
||||
pokemon = gPlayerParty;
|
||||
cnt2 = 0;
|
||||
cnt1 = 0;
|
||||
unsigned int hp;
|
||||
struct Pokemon *pokemon = gPlayerParty;
|
||||
unsigned int numPoisoned = 0;
|
||||
unsigned int numFainted = 0;
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (GetMonData(pokemon, MON_DATA_SANITY_BIT2) && pokemon_ailments_get_primary(GetMonData(pokemon, MON_DATA_STATUS)) == 1)
|
||||
if (GetMonData(pokemon, MON_DATA_SANITY_BIT2) && pokemon_ailments_get_primary(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN)
|
||||
{
|
||||
hp = GetMonData(pokemon, MON_DATA_HP);
|
||||
if (hp == 0 || --hp == 0)
|
||||
{
|
||||
cnt1++;
|
||||
numFainted++;
|
||||
}
|
||||
SetMonData(pokemon, MON_DATA_HP, &hp);
|
||||
cnt2++;
|
||||
numPoisoned++;
|
||||
}
|
||||
pokemon++;
|
||||
}
|
||||
if (cnt1 != 0 || cnt2 != 0)
|
||||
if (numFainted != 0 || numPoisoned != 0)
|
||||
{
|
||||
overworld_poison_effect();
|
||||
}
|
||||
if (cnt1 != 0)
|
||||
if (numFainted != 0)
|
||||
{
|
||||
return 2;
|
||||
return FLDPSN_FNT;
|
||||
}
|
||||
if (cnt2 != 0)
|
||||
if (numPoisoned != 0)
|
||||
{
|
||||
return 1;
|
||||
return FLDPSN_PSN;
|
||||
}
|
||||
return 0;
|
||||
return FLDPSN_NONE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user