merge with master
This commit is contained in:
28
src/coins.c
28
src/coins.c
@@ -2,8 +2,9 @@
|
||||
#include "coins.h"
|
||||
#include "text.h"
|
||||
#include "window.h"
|
||||
#include "text_window.h"
|
||||
#include "strings.h"
|
||||
#include "string_util.h"
|
||||
#include "new_menu_helpers.h"
|
||||
#include "menu.h"
|
||||
#include "international_string_util.h"
|
||||
|
||||
@@ -11,10 +12,6 @@
|
||||
|
||||
EWRAM_DATA u8 sCoinsWindowId = 0;
|
||||
|
||||
extern void sub_819746C(u8 windowId, bool8 copyToVram);
|
||||
|
||||
extern const u8 gText_Coins[];
|
||||
|
||||
void PrintCoinsString(u32 coinAmount)
|
||||
{
|
||||
u32 xAlign;
|
||||
@@ -53,7 +50,6 @@ void SetCoins(u16 coinAmount)
|
||||
gSaveBlock1Ptr->coins = coinAmount ^ gSaveBlock2Ptr->encryptionKey;
|
||||
}
|
||||
|
||||
/* Can't match it lol
|
||||
bool8 GiveCoins(u16 toAdd)
|
||||
{
|
||||
u16 newAmount;
|
||||
@@ -67,10 +63,22 @@ bool8 GiveCoins(u16 toAdd)
|
||||
}
|
||||
else
|
||||
{
|
||||
newAmount = ownedCoins + toAdd;
|
||||
if (newAmount > MAX_COINS)
|
||||
newAmount = MAX_COINS;
|
||||
ownedCoins += toAdd;
|
||||
if (ownedCoins > MAX_COINS)
|
||||
ownedCoins = MAX_COINS;
|
||||
newAmount = ownedCoins;
|
||||
}
|
||||
SetCoins(newAmount);
|
||||
return TRUE;
|
||||
}*/
|
||||
}
|
||||
|
||||
bool8 TakeCoins(u16 toSub)
|
||||
{
|
||||
u16 ownedCoins = GetCoins();
|
||||
if (ownedCoins >= toSub)
|
||||
{
|
||||
SetCoins(ownedCoins - toSub);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
148
src/field_poison.c
Normal file
148
src/field_poison.c
Normal file
@@ -0,0 +1,148 @@
|
||||
#include "global.h"
|
||||
#include "string_util.h"
|
||||
#include "party_menu.h"
|
||||
#include "species.h"
|
||||
#include "task.h"
|
||||
#include "field_message_box.h"
|
||||
#include "strings.h"
|
||||
#include "rom_818CFC8.h"
|
||||
#include "battle_frontier_2.h"
|
||||
#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)
|
||||
{
|
||||
u16 species = GetMonData(pokemon, MON_DATA_SPECIES2);
|
||||
if (species == SPECIES_NONE || species == SPECIES_EGG)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool32 sub_80F958C(void)
|
||||
{
|
||||
int i;
|
||||
struct Pokemon *pokemon;
|
||||
|
||||
for (pokemon = gPlayerParty, i = 0; i < PARTY_SIZE; i++, pokemon++)
|
||||
{
|
||||
if (sub_80F9568(pokemon) && GetMonData(pokemon, MON_DATA_HP) != 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void sub_80F95C0(u8 partyIdx)
|
||||
{
|
||||
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);
|
||||
StringGetEnd10(gStringVar1);
|
||||
}
|
||||
|
||||
static bool32 sub_80F960C(u8 partyIdx)
|
||||
{
|
||||
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;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void sub_80F9654(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
switch (data[0])
|
||||
{
|
||||
case 0:
|
||||
for (; data[1] < PARTY_SIZE; data[1]++)
|
||||
{
|
||||
if (sub_80F960C(data[1]))
|
||||
{
|
||||
sub_80F95C0(data[1]);
|
||||
ShowFieldMessage(gText_PkmnFainted3);
|
||||
data[0]++;
|
||||
return;
|
||||
}
|
||||
}
|
||||
data[0] = 2;
|
||||
break;
|
||||
case 1:
|
||||
if (IsFieldMessageBoxHidden())
|
||||
{
|
||||
data[0]--;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (sub_80F958C())
|
||||
{
|
||||
if (InBattlePyramid() | InBattlePike() || sub_81D5C18())
|
||||
{
|
||||
gSpecialVar_Result = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSpecialVar_Result = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gSpecialVar_Result = 0;
|
||||
}
|
||||
EnableBothScriptContexts();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80F972C(void)
|
||||
{
|
||||
CreateTask(sub_80F9654, 80);
|
||||
ScriptContext1_Stop();
|
||||
}
|
||||
|
||||
unsigned int overworld_poison(void)
|
||||
{
|
||||
int i;
|
||||
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)) == AILMENT_PSN)
|
||||
{
|
||||
hp = GetMonData(pokemon, MON_DATA_HP);
|
||||
if (hp == 0 || --hp == 0)
|
||||
{
|
||||
numFainted++;
|
||||
}
|
||||
SetMonData(pokemon, MON_DATA_HP, &hp);
|
||||
numPoisoned++;
|
||||
}
|
||||
pokemon++;
|
||||
}
|
||||
if (numFainted != 0 || numPoisoned != 0)
|
||||
{
|
||||
overworld_poison_effect();
|
||||
}
|
||||
if (numFainted != 0)
|
||||
{
|
||||
return FLDPSN_FNT;
|
||||
}
|
||||
if (numPoisoned != 0)
|
||||
{
|
||||
return FLDPSN_PSN;
|
||||
}
|
||||
return FLDPSN_NONE;
|
||||
}
|
||||
47
src/unk_81BAD84.c
Normal file
47
src/unk_81BAD84.c
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "global.h"
|
||||
#include "graphics.h"
|
||||
|
||||
const struct {
|
||||
const u8 *gfx;
|
||||
const u8 *tileMap;
|
||||
const u16 *pltt;
|
||||
} gUnknown_08617128[] = {
|
||||
{
|
||||
gUnknown_08DD87C0,
|
||||
gUnknown_08DD8EE0,
|
||||
gUnknown_08DD8780
|
||||
}, {
|
||||
gUnknown_08DD90E0,
|
||||
gUnknown_08DD9718,
|
||||
gUnknown_08DD9080
|
||||
}, {
|
||||
gUnknown_08DD98B4,
|
||||
gUnknown_08DD9E58,
|
||||
gUnknown_08DD9874
|
||||
}, {
|
||||
gUnknown_08DDA02C,
|
||||
gUnknown_08DDA63C,
|
||||
gUnknown_08DD9FEC
|
||||
}, {
|
||||
gUnknown_08DDA840,
|
||||
gUnknown_08DDAE40,
|
||||
gUnknown_08DDA800
|
||||
}, {
|
||||
gUnknown_08DDB020,
|
||||
gUnknown_08DDB2C4,
|
||||
gUnknown_08DDAFE0
|
||||
}
|
||||
};
|
||||
|
||||
void sub_81BAD84(u32 idx)
|
||||
{
|
||||
REG_DISPCNT = 0x0000;
|
||||
REG_BG0HOFS = 0x0000;
|
||||
REG_BG0VOFS = 0x0000;
|
||||
REG_BLDCNT = 0x0000;
|
||||
LZ77UnCompVram(gUnknown_08617128[idx].gfx, (void *)BG_CHAR_ADDR(0));
|
||||
LZ77UnCompVram(gUnknown_08617128[idx].tileMap, (void *)BG_SCREEN_ADDR(31));
|
||||
CpuCopy16(gUnknown_08617128[idx].pltt, (void *)PLTT, 0x200);
|
||||
REG_BG0CNT = 0x1f00;
|
||||
REG_DISPCNT = DISPCNT_BG0_ON;
|
||||
}
|
||||
Reference in New Issue
Block a user