mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
merge wiith masteer and summary screen change
This commit is contained in:
commit
013f9b6a17
8
Makefile
8
Makefile
@ -59,8 +59,6 @@ MID_BUILDDIR = $(OBJ_DIR)/$(MID_SUBDIR)
|
||||
|
||||
ASFLAGS := -mcpu=arm7tdmi --defsym MODERN=$(MODERN)
|
||||
|
||||
GCC_VER = $(shell $(CC) -dumpversion)
|
||||
|
||||
ifeq ($(MODERN),0)
|
||||
CC1 := tools/agbcc/bin/agbcc$(EXE)
|
||||
override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm
|
||||
@ -72,7 +70,7 @@ CC1 = $(shell $(CC) --print-prog-name=cc1) -quiet
|
||||
override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -fno-aggressive-loop-optimizations -Wno-pointer-to-int-cast
|
||||
ROM := pokeemerald_modern.gba
|
||||
OBJ_DIR := build/modern
|
||||
LIBPATH := -L $(TOOLCHAIN)/lib/gcc/arm-none-eabi/$(GCC_VER)/thumb -L $(TOOLCHAIN)/arm-none-eabi/lib/thumb
|
||||
LIBPATH := -L "$(dir $(shell $(CC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(CC) -mthumb -print-file-name=libc.a))"
|
||||
endif
|
||||
|
||||
CPPFLAGS := -iquote include -iquote $(GFLIB_SUBDIR) -Wno-trigraphs -DMODERN=$(MODERN)
|
||||
@ -111,13 +109,13 @@ MAKEFLAGS += --no-print-directory
|
||||
# Secondary expansion is required for dependency variables in object rules.
|
||||
.SECONDEXPANSION:
|
||||
|
||||
.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) berry_fix libagbsyscall
|
||||
.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) berry_fix libagbsyscall modern
|
||||
|
||||
infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line))))
|
||||
|
||||
# Build tools when building the rom
|
||||
# Disable dependency scanning for clean/tidy/tools
|
||||
ifeq (,$(filter-out all compare,$(MAKECMDGOALS)))
|
||||
ifeq (,$(filter-out all rom compare modern berry_fix libagbsyscall,$(MAKECMDGOALS)))
|
||||
$(call infoshell, $(MAKE) tools)
|
||||
else
|
||||
NODEP := 1
|
||||
|
@ -414,7 +414,7 @@ SIZE = FC 06 @ note that anything other than "SMALL" is invalid
|
||||
UNKNOWN_7 = FC 07
|
||||
PAUSE = FC 08 @ manually print the wait byte after this, havent mapped them
|
||||
PAUSE_UNTIL_PRESS = FC 09
|
||||
UNKNOWN_A = FC 0A
|
||||
WAIT_SE = FC 0A
|
||||
PLAY_BGM = FC 0B
|
||||
ESCAPE = FC 0C
|
||||
SHIFT_TEXT = FC 0D
|
||||
|
@ -414,7 +414,7 @@ SIZE = FC 06 @ note that anything other than "SMALL" is invalid
|
||||
UNKNOWN_7 = FC 07
|
||||
PAUSE = FC 08 @ manually print the wait byte after this, havent mapped them
|
||||
PAUSE_UNTIL_PRESS = FC 09
|
||||
UNKNOWN_A = FC 0A
|
||||
WAIT_SE = FC 0A
|
||||
PLAY_BGM = FC 0B
|
||||
ESCAPE = FC 0C
|
||||
SHIFT_TEXT = FC 0D
|
||||
|
@ -425,7 +425,7 @@ SIZE = FC 06 @ note that anything other than "SMALL" is invalid
|
||||
UNKNOWN_7 = FC 07
|
||||
PAUSE = FC 08 @ manually print the wait byte after this, havent mapped them
|
||||
PAUSE_UNTIL_PRESS = FC 09
|
||||
UNKNOWN_A = FC 0A
|
||||
WAIT_SE = FC 0A
|
||||
PLAY_BGM = FC 0B
|
||||
ESCAPE = FC 0C
|
||||
SHIFT_TEXT = FC 0D
|
||||
|
@ -9681,7 +9681,7 @@ Move_AIR_CUTTER:
|
||||
monbg ANIM_DEF_PARTNER
|
||||
setalpha 12, 8
|
||||
delay 0
|
||||
createvisualtask AnimTask_AirCutterProjectile, 2, 32, -24, 1536, 2, 128
|
||||
createvisualtask AnimTask_AirCutterProjectile, 2, 32, -24, 6 * 256, 2, 128 @ 6 * 256 == Q_8_8(6)
|
||||
waitforvisualfinish
|
||||
playsewithpan SE_W015, SOUND_PAN_TARGET
|
||||
createsprite gAirCutterSliceSpriteTemplate, ANIM_ATTACKER, 2, 40, -32, 0, 2
|
||||
|
77
docs/bugs_and_glitches.md
Normal file
77
docs/bugs_and_glitches.md
Normal file
@ -0,0 +1,77 @@
|
||||
|
||||
# Bugs and Glitches
|
||||
|
||||
These are known bugs and glitches in the original Pokémon Emerald game: code that clearly does not work as intended, or that only works in limited circumstances but has the possibility to fail or crash.
|
||||
|
||||
Fixes are written in the `diff` format. If you've used Git before, this should look familiar:
|
||||
|
||||
```diff
|
||||
this is some code
|
||||
-delete red - lines
|
||||
+add green + lines
|
||||
```
|
||||
|
||||
## Contents
|
||||
|
||||
- [RNG does not get seeded](#rng-does-not-get-seeded)
|
||||
- [Scrolling through items in the bag causes the image to flicker](#scrolling-through-items-in-the-bag-causes-the-image-to-flicker)
|
||||
|
||||
|
||||
## RNG does not get seeded
|
||||
|
||||
**Fix:** Add the following function to [src/main.c](https://github.com/pret/pokeemerald/blob/master/src/main.c):
|
||||
```diff
|
||||
+static void SeedRngWithRtc(void)
|
||||
+{
|
||||
+ u32 seed = RtcGetMinuteCount();
|
||||
+ seed = (seed >> 16) ^ (seed & 0xFFFF);
|
||||
+ SeedRng(seed);
|
||||
+}
|
||||
```
|
||||
|
||||
And edit `AgbMain`:
|
||||
|
||||
```diff
|
||||
...
|
||||
RtcInit();
|
||||
CheckForFlashMemory();
|
||||
InitMainCallbacks();
|
||||
InitMapMusic();
|
||||
+ SeedRngWithRtc();
|
||||
ClearDma3Requests();
|
||||
...
|
||||
```
|
||||
|
||||
## Scrolling through items in the bag causes the image to flicker
|
||||
|
||||
**Fix:** Add the following function to [src/item_menu_icons.c](https://github.com/pret/pokeemerald/blob/master/src/item_menu_icons.c):
|
||||
```diff
|
||||
+void HideBagItemIconSprite(u8 id)
|
||||
+{
|
||||
+ u8 *spriteId = &gBagMenu->spriteId[10];
|
||||
+ if (spriteId[id] != 0xFF)
|
||||
+ {
|
||||
+ gSprites[spriteId[id]].invisible = TRUE;
|
||||
+ }
|
||||
+}
|
||||
|
||||
```
|
||||
|
||||
and its corresponding declaration in [include/item_menu_icons.h](https://github.com/pret/pokeemerald/blob/master/include/item_menu_icons.h):
|
||||
|
||||
```diff
|
||||
+void HideBagItemIconSprite(u8 id);
|
||||
|
||||
```
|
||||
|
||||
Then edit `BagMenu_MoveCursorCallback` in [src/item_menu.c](https://github.com/pret/pokeemerald/blob/master/src/item_menu.c):
|
||||
|
||||
```diff
|
||||
...
|
||||
{
|
||||
- RemoveBagItemIconSprite(1 ^ gBagMenu->unk81B_1);
|
||||
+ HideBagItemIconSprite(gBagMenu->unk81B_1 ^ 1);
|
||||
+ RemoveBagItemIconSprite(gBagMenu->unk81B_1);
|
||||
if (a != -2)
|
||||
...
|
||||
```
|
@ -878,12 +878,14 @@ void ResetAllSprites(void)
|
||||
ResetSprite(&gSprites[i]);
|
||||
}
|
||||
|
||||
// UB: template pointer may point to freed temporary storage
|
||||
void FreeSpriteTiles(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->template->tileTag != 0xFFFF)
|
||||
FreeSpriteTilesByTag(sprite->template->tileTag);
|
||||
}
|
||||
|
||||
// UB: template pointer may point to freed temporary storage
|
||||
void FreeSpritePalette(struct Sprite *sprite)
|
||||
{
|
||||
FreeSpritePaletteByTag(sprite->template->paletteTag);
|
||||
|
@ -182,6 +182,10 @@ struct SpriteTemplate
|
||||
SpriteCallback callback;
|
||||
};
|
||||
|
||||
// UB: template pointer is often used to point to temporary storage,
|
||||
// then later dereferenced after being freed. Usually this won't
|
||||
// be visible in-game, but this is (part of) what causes the item
|
||||
// icon palette to flicker when changing items in the bag.
|
||||
struct Sprite
|
||||
{
|
||||
/*0x00*/ struct OamData oam;
|
||||
|
82
gflib/text.c
82
gflib/text.c
@ -178,7 +178,7 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, voi
|
||||
|
||||
for (i = 0; i < 7; i++)
|
||||
{
|
||||
gTempTextPrinter.subUnion.fields[i] = 0;
|
||||
gTempTextPrinter.subStructFields[i] = 0;
|
||||
}
|
||||
|
||||
gTempTextPrinter.printerTemplate = *printerTemplate;
|
||||
@ -187,7 +187,7 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, voi
|
||||
gTempTextPrinter.japanese = 0;
|
||||
|
||||
GenerateFontHalfRowLookupTable(printerTemplate->fgColor, printerTemplate->bgColor, printerTemplate->shadowColor);
|
||||
if (speed != TEXT_SPEED_FF && speed != 0x0)
|
||||
if (speed != TEXT_SPEED_FF && speed != 0)
|
||||
{
|
||||
--gTempTextPrinter.textSpeed;
|
||||
gTextPrinters[printerTemplate->windowId] = gTempTextPrinter;
|
||||
@ -215,7 +215,7 @@ void RunTextPrinters(void)
|
||||
|
||||
if (gUnknown_03002F84 == 0)
|
||||
{
|
||||
for (i = 0; i < 0x20; ++i)
|
||||
for (i = 0; i < NUM_TEXT_PRINTERS; ++i)
|
||||
{
|
||||
if (gTextPrinters[i].active)
|
||||
{
|
||||
@ -1297,11 +1297,11 @@ void ClearTextSpan(struct TextPrinter *textPrinter, u32 width)
|
||||
|
||||
u16 Font0Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->subUnion.sub.glyphId = 0;
|
||||
subStruct->glyphId = 0;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
@ -1309,11 +1309,11 @@ u16 Font0Func(struct TextPrinter *textPrinter)
|
||||
|
||||
u16 Font1Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->subUnion.sub.glyphId = 1;
|
||||
subStruct->glyphId = 1;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
@ -1321,11 +1321,11 @@ u16 Font1Func(struct TextPrinter *textPrinter)
|
||||
|
||||
u16 Font2Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->subUnion.sub.glyphId = 2;
|
||||
subStruct->glyphId = 2;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
@ -1333,11 +1333,11 @@ u16 Font2Func(struct TextPrinter *textPrinter)
|
||||
|
||||
u16 Font3Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->subUnion.sub.glyphId = 3;
|
||||
subStruct->glyphId = 3;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
@ -1345,11 +1345,11 @@ u16 Font3Func(struct TextPrinter *textPrinter)
|
||||
|
||||
u16 Font4Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->subUnion.sub.glyphId = 4;
|
||||
subStruct->glyphId = 4;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
@ -1357,11 +1357,11 @@ u16 Font4Func(struct TextPrinter *textPrinter)
|
||||
|
||||
u16 Font5Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->subUnion.sub.glyphId = 5;
|
||||
subStruct->glyphId = 5;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
@ -1369,11 +1369,11 @@ u16 Font5Func(struct TextPrinter *textPrinter)
|
||||
|
||||
u16 Font7Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->subUnion.sub.glyphId = 7;
|
||||
subStruct->glyphId = 7;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
@ -1381,11 +1381,11 @@ u16 Font7Func(struct TextPrinter *textPrinter)
|
||||
|
||||
u16 Font8Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->subUnion.sub.glyphId = 8;
|
||||
subStruct->glyphId = 8;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
@ -1393,10 +1393,12 @@ u16 Font8Func(struct TextPrinter *textPrinter)
|
||||
|
||||
void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (gTextFlags.autoScroll == 1)
|
||||
{
|
||||
subStruct->autoScrollDelay = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
subStruct->downArrowYPosIdx = 0;
|
||||
@ -1406,14 +1408,14 @@ void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter)
|
||||
|
||||
void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
const u8 *arrowTiles;
|
||||
|
||||
if (gTextFlags.autoScroll == 0)
|
||||
{
|
||||
if (subStruct->downArrowDelay != 0)
|
||||
{
|
||||
subStruct->downArrowDelay = ((*(u32*)&textPrinter->subUnion.sub) << 19 >> 27) - 1; // convoluted way of getting downArrowDelay, necessary to match
|
||||
subStruct->downArrowDelay--;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1422,16 +1424,16 @@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter)
|
||||
textPrinter->printerTemplate.bgColor << 4 | textPrinter->printerTemplate.bgColor,
|
||||
textPrinter->printerTemplate.currentX,
|
||||
textPrinter->printerTemplate.currentY,
|
||||
0x8,
|
||||
0x10);
|
||||
8,
|
||||
16);
|
||||
|
||||
switch (gTextFlags.useAlternateDownArrow)
|
||||
{
|
||||
case 0:
|
||||
case FALSE:
|
||||
default:
|
||||
arrowTiles = gDownArrowTiles;
|
||||
break;
|
||||
case 1:
|
||||
case TRUE:
|
||||
arrowTiles = gDarkDownArrowTiles;
|
||||
break;
|
||||
}
|
||||
@ -1440,17 +1442,17 @@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter)
|
||||
textPrinter->printerTemplate.windowId,
|
||||
arrowTiles,
|
||||
0,
|
||||
gDownArrowYCoords[*(u32*)subStruct << 17 >> 30], // subStruct->downArrowYPosIdx but again, stupidly retrieved
|
||||
0x8,
|
||||
0x10,
|
||||
gDownArrowYCoords[subStruct->downArrowYPosIdx],
|
||||
8,
|
||||
16,
|
||||
textPrinter->printerTemplate.currentX,
|
||||
textPrinter->printerTemplate.currentY,
|
||||
0x8,
|
||||
0x10);
|
||||
CopyWindowToVram(textPrinter->printerTemplate.windowId, 0x2);
|
||||
8,
|
||||
16);
|
||||
CopyWindowToVram(textPrinter->printerTemplate.windowId, 2);
|
||||
|
||||
subStruct->downArrowDelay = 0x8;
|
||||
subStruct->downArrowYPosIdx = (*(u32*)subStruct << 17 >> 30) + 1;
|
||||
subStruct->downArrowDelay = 8;
|
||||
subStruct->downArrowYPosIdx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1462,14 +1464,14 @@ void TextPrinterClearDownArrow(struct TextPrinter *textPrinter)
|
||||
textPrinter->printerTemplate.bgColor << 4 | textPrinter->printerTemplate.bgColor,
|
||||
textPrinter->printerTemplate.currentX,
|
||||
textPrinter->printerTemplate.currentY,
|
||||
0x8,
|
||||
0x10);
|
||||
CopyWindowToVram(textPrinter->printerTemplate.windowId, 0x2);
|
||||
8,
|
||||
16);
|
||||
CopyWindowToVram(textPrinter->printerTemplate.windowId, 2);
|
||||
}
|
||||
|
||||
bool8 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (subStruct->autoScrollDelay == 49)
|
||||
{
|
||||
@ -1477,7 +1479,7 @@ bool8 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter)
|
||||
}
|
||||
else
|
||||
{
|
||||
++subStruct->autoScrollDelay;
|
||||
subStruct->autoScrollDelay++;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -1563,7 +1565,7 @@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *c
|
||||
|
||||
u16 RenderText(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
u16 currChar;
|
||||
s32 width;
|
||||
s32 widthHelper;
|
||||
|
10
gflib/text.h
10
gflib/text.h
@ -200,15 +200,7 @@ struct TextPrinter
|
||||
|
||||
void (*callback)(struct TextPrinterTemplate *, u16); // 0x10
|
||||
|
||||
union
|
||||
#if !MODERN
|
||||
__attribute__((packed))
|
||||
#endif
|
||||
{
|
||||
struct TextPrinterSubStruct sub;
|
||||
u8 fields[7];
|
||||
} subUnion;
|
||||
|
||||
u8 subStructFields[7]; // always cast to struct TextPrinterSubStruct... so why bother
|
||||
u8 active;
|
||||
u8 state; // 0x1C
|
||||
u8 textSpeed;
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 205 B After Width: | Height: | Size: 216 B |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
@ -25,4 +25,11 @@
|
||||
#define BERRY_STAGE_BERRIES 5
|
||||
#define BERRY_STAGE_SPARKLING 255
|
||||
|
||||
// Berries can be watered in the following stages:
|
||||
// - BERRY_STAGE_PLANTED
|
||||
// - BERRY_STAGE_SPROUTED
|
||||
// - BERRY_STAGE_TALLER
|
||||
// - BERRY_STAGE_FLOWERING
|
||||
#define NUM_WATER_STAGES 4
|
||||
|
||||
#endif // GUARD_CONSTANTS_BERRY_H
|
||||
|
42
include/constants/slot_machine.h
Normal file
42
include/constants/slot_machine.h
Normal file
@ -0,0 +1,42 @@
|
||||
#ifndef GUARD_CONSTANTS_SLOT_MACHINE_H
|
||||
#define GUARD_CONSTANTS_SLOT_MACHINE_H
|
||||
|
||||
#define NUM_REELS 3
|
||||
#define REEL_NUM_TAGS 21
|
||||
#define REEL_TAG_HEIGHT 24
|
||||
#define SLOT_MACHINE_COUNT 12
|
||||
|
||||
// Lucky Flags
|
||||
#define LUCKY_BIAS_REPLAY (1 << 0)
|
||||
#define LUCKY_BIAS_CHERRY (1 << 1)
|
||||
#define LUCKY_BIAS_LOTAD (1 << 2)
|
||||
#define LUCKY_BIAS_AZURILL (1 << 3)
|
||||
#define LUCKY_BIAS_POWER (1 << 4)
|
||||
#define LUCKY_BIAS_REELTIME (1 << 5)
|
||||
#define LUCKY_BIAS_MIXED_777 (1 << 6)
|
||||
#define LUCKY_BIAS_777 (1 << 7)
|
||||
|
||||
#define SLOT_MACHINE_TAG_7_RED 0
|
||||
#define SLOT_MACHINE_TAG_7_BLUE 1
|
||||
#define SLOT_MACHINE_TAG_AZURILL 2
|
||||
#define SLOT_MACHINE_TAG_LOTAD 3
|
||||
#define SLOT_MACHINE_TAG_CHERRY 4
|
||||
#define SLOT_MACHINE_TAG_POWER 5
|
||||
#define SLOT_MACHINE_TAG_REPLAY 6
|
||||
|
||||
#define SLOT_MACHINE_MATCHED_1CHERRY 0
|
||||
#define SLOT_MACHINE_MATCHED_2CHERRY 1
|
||||
#define SLOT_MACHINE_MATCHED_REPLAY 2
|
||||
#define SLOT_MACHINE_MATCHED_LOTAD 3
|
||||
#define SLOT_MACHINE_MATCHED_AZURILL 4
|
||||
#define SLOT_MACHINE_MATCHED_POWER 5
|
||||
#define SLOT_MACHINE_MATCHED_777_MIXED 6
|
||||
#define SLOT_MACHINE_MATCHED_777_RED 7
|
||||
#define SLOT_MACHINE_MATCHED_777_BLUE 8
|
||||
#define SLOT_MACHINE_MATCHED_NONE 9
|
||||
|
||||
#define LEFT_REEL 0
|
||||
#define MIDDLE_REEL 1
|
||||
#define RIGHT_REEL 2
|
||||
|
||||
#endif // GUARD_CONSTANTS_SLOT_MACHINE_H
|
@ -54,7 +54,7 @@ struct ObjectEventTemplate
|
||||
{
|
||||
/*0x00*/ u8 localId;
|
||||
/*0x01*/ u8 graphicsId;
|
||||
/*0x02*/ u8 unk2;
|
||||
/*0x02*/ u8 inConnection; // Leftover from FRLG
|
||||
/*0x04*/ s16 x;
|
||||
/*0x06*/ s16 y;
|
||||
/*0x08*/ u8 elevation;
|
||||
|
@ -53,7 +53,7 @@
|
||||
#define UQ_4_12(n) ((u16)((n) * 4096))
|
||||
|
||||
// Converts a number to Q24.8 fixed-point format
|
||||
#define Q_24_8(n) ((s32)((n) * 256))
|
||||
#define Q_24_8(n) ((s32)((n) << 8))
|
||||
|
||||
// Converts a Q8.8 fixed-point format number to a regular integer
|
||||
#define Q_8_8_TO_INT(n) ((int)((n) / 256))
|
||||
|
@ -4048,11 +4048,11 @@ extern const u32 gMoveTypes_Pal[];
|
||||
extern const u32 gStatusScreenBitmap[];
|
||||
|
||||
extern const u16 gSummaryScreenPowAcc_Tilemap[];
|
||||
extern const u16 gUnknown_08DC3C34[];
|
||||
extern const u16 gSummaryScreenAppealJam_Tilemap[];
|
||||
|
||||
extern const u32 gMoveTypes_Gfx[];
|
||||
extern const u32 gMoveSelectorBitmap[];
|
||||
extern const u32 gUnknown_08D97CF4[];
|
||||
extern const u32 gSummaryMoveSelect_Gfx[];
|
||||
extern const u32 gSummaryMoveSelect_Pal[];
|
||||
extern const u32 gStatusGfx_Icons[];
|
||||
extern const u32 gStatusPal_Icons[];
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
#ifndef GUARD_MATH_UTIL_H
|
||||
#define GUARD_MATH_UTIL_H
|
||||
|
||||
s16 sub_8151534(s16 x, s16 y);
|
||||
s16 sub_8151550(u8 s, s16 x, s16 y);
|
||||
s32 sub_8151574(s32 x, s32 y);
|
||||
s16 sub_81515B0(s16 x, s16 y);
|
||||
s16 sub_81515D4(u8 s, s16 x, s16 y);
|
||||
s32 sub_81515FC(s32 x, s32 y);
|
||||
s16 sub_8151624(s16 y);
|
||||
s16 sub_815163C(u8 s, s16 y);
|
||||
s32 sub_815165C(s32 y);
|
||||
s16 MathUtil_Mul16(s16 x, s16 y);
|
||||
s16 MathUtil_Mul16Shift(u8 s, s16 x, s16 y);
|
||||
s32 MathUtil_Mul32(s32 x, s32 y);
|
||||
s16 MathUtil_Div16(s16 x, s16 y);
|
||||
s16 MathUtil_Div16Shift(u8 s, s16 x, s16 y);
|
||||
s32 MathUtil_Div32(s32 x, s32 y);
|
||||
s16 MathUtil_Inv16(s16 y);
|
||||
s16 MathUtil_Inv16Shift(u8 s, s16 y);
|
||||
s32 MathUtil_Inv32(s32 y);
|
||||
|
||||
#endif // GUARD_MATH_UTIL_H
|
||||
|
@ -9,10 +9,10 @@ extern const u8 *const gMoveDescriptionPointers[];
|
||||
extern const u8 *const gNatureNamePointers[];
|
||||
|
||||
void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void));
|
||||
void ShowSelectMovePokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u16);
|
||||
void ShowSelectMovePokemonSummaryScreen(struct Pokemon *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void), u16 newMove);
|
||||
void ShowPokemonSummaryScreenSet40EF(u8 mode, struct BoxPokemon *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void));
|
||||
u8 GetMoveSlotToReplace(void);
|
||||
void SummaryScreen_SetUnknownTaskId(u8 a0);
|
||||
void SummaryScreen_SetUnknownTaskId(u8 taskId);
|
||||
void SummaryScreen_DestroyUnknownTask(void);
|
||||
|
||||
// The Pokemon Summary Screen can operate in different modes. Certain features,
|
||||
@ -20,7 +20,7 @@ void SummaryScreen_DestroyUnknownTask(void);
|
||||
enum PokemonSummaryScreenMode
|
||||
{
|
||||
PSS_MODE_NORMAL,
|
||||
PSS_MODE_UNK1,
|
||||
PSS_MODE_LOCK_MOVES,
|
||||
PSS_MODE_BOX,
|
||||
PSS_MODE_SELECT_MOVE,
|
||||
};
|
||||
@ -31,6 +31,7 @@ enum PokemonSummaryScreenPage
|
||||
PSS_PAGE_SKILLS,
|
||||
PSS_PAGE_BATTLE_MOVES,
|
||||
PSS_PAGE_CONTEST_MOVES,
|
||||
PSS_PAGE_COUNT,
|
||||
};
|
||||
|
||||
#endif // GUARD_POKEMON_SUMMARY_SCREEN_H
|
||||
|
@ -1,21 +1,6 @@
|
||||
#ifndef GUARD_SLOT_MACHINE_H
|
||||
#define GUARD_SLOT_MACHINE_H
|
||||
|
||||
#define NUM_REELS 3
|
||||
#define REEL_NUM_TAGS 21
|
||||
#define REEL_TAG_HEIGHT 24
|
||||
#define SLOT_MACHINE_COUNT 12
|
||||
|
||||
// Lucky Flags
|
||||
#define LUCKY_BIAS_REPLAY (1 << 0)
|
||||
#define LUCKY_BIAS_CHERRY (1 << 1)
|
||||
#define LUCKY_BIAS_LOTAD (1 << 2)
|
||||
#define LUCKY_BIAS_AZURILL (1 << 3)
|
||||
#define LUCKY_BIAS_POWER (1 << 4)
|
||||
#define LUCKY_BIAS_REELTIME (1 << 5)
|
||||
#define LUCKY_BIAS_MIXED_777 (1 << 6)
|
||||
#define LUCKY_BIAS_777 (1 << 7)
|
||||
|
||||
void PlaySlotMachine(u8, void (callback)(void));
|
||||
|
||||
#endif // GUARD_SLOT_MACHINE_H
|
||||
|
@ -1621,7 +1621,7 @@ static void AnimAirWaveProjectile(struct Sprite *sprite)
|
||||
{
|
||||
sprite->data[0] = 8;
|
||||
task->data[5] = 4;
|
||||
a = sub_8151624(0x1000);
|
||||
a = MathUtil_Inv16(Q_8_8(16));
|
||||
sprite->pos1.x += sprite->pos2.x;
|
||||
sprite->pos1.y += sprite->pos2.y;
|
||||
sprite->pos2.y = 0;
|
||||
@ -1640,8 +1640,8 @@ static void AnimAirWaveProjectile(struct Sprite *sprite)
|
||||
sprite->data[1] = 0;
|
||||
sprite->data[6] = 0;
|
||||
sprite->data[5] = 0;
|
||||
sprite->data[3] = sub_8151534(sub_8151534(b, a), sub_8151624(0x1C0));
|
||||
sprite->data[4] = sub_8151534(sub_8151534(c, a), sub_8151624(0x1C0));
|
||||
sprite->data[3] = MathUtil_Mul16(MathUtil_Mul16(b, a), MathUtil_Inv16(Q_8_8(1.75)));
|
||||
sprite->data[4] = MathUtil_Mul16(MathUtil_Mul16(c, a), MathUtil_Inv16(Q_8_8(1.75)));
|
||||
sprite->callback = AnimAirWaveProjectile_Step1;
|
||||
}
|
||||
}
|
||||
@ -1732,18 +1732,18 @@ void AnimTask_AirCutterProjectile(u8 taskId)
|
||||
else
|
||||
xDiff = attackerX - targetX;
|
||||
|
||||
gTasks[taskId].data[5] = sub_8151534(xDiff, sub_8151624(gBattleAnimArgs[2] & ~1));
|
||||
gTasks[taskId].data[6] = sub_8151534(gTasks[taskId].data[5], 0x80);
|
||||
gTasks[taskId].data[5] = MathUtil_Mul16(xDiff, MathUtil_Inv16(gBattleAnimArgs[2] & ~1));
|
||||
gTasks[taskId].data[6] = MathUtil_Mul16(gTasks[taskId].data[5], Q_8_8(0.5));
|
||||
gTasks[taskId].data[7] = gBattleAnimArgs[2];
|
||||
if (targetY >= attackerY)
|
||||
{
|
||||
yDiff = targetY - attackerY;
|
||||
gTasks[taskId].data[8] = sub_8151534(yDiff, sub_8151624(gTasks[taskId].data[5])) & ~1;
|
||||
gTasks[taskId].data[8] = MathUtil_Mul16(yDiff, MathUtil_Inv16(gTasks[taskId].data[5])) & ~1;
|
||||
}
|
||||
else
|
||||
{
|
||||
yDiff = attackerY - targetY;
|
||||
gTasks[taskId].data[8] = sub_8151534(yDiff, sub_8151624(gTasks[taskId].data[5])) | 1;
|
||||
gTasks[taskId].data[8] = MathUtil_Mul16(yDiff, MathUtil_Inv16(gTasks[taskId].data[5])) | 1;
|
||||
}
|
||||
|
||||
gTasks[taskId].data[3] = gBattleAnimArgs[3];
|
||||
|
@ -1743,7 +1743,7 @@ void PrepareAffineAnimInTaskData(struct Task *task, u8 spriteId, const union Aff
|
||||
|
||||
bool8 RunAffineAnimFromTaskData(struct Task *task)
|
||||
{
|
||||
gAnimTaskAffineAnim = LoadPointerFromVars(task->data[13], task->data[14]) + (task->data[7] << 3);
|
||||
gAnimTaskAffineAnim = &((union AffineAnimCmd *)LoadPointerFromVars(task->data[13], task->data[14]))[task->data[7]];
|
||||
switch (gAnimTaskAffineAnim->type)
|
||||
{
|
||||
default:
|
||||
|
@ -5596,67 +5596,75 @@ static void VblankCb_TourneyInfoCard(void)
|
||||
|
||||
static void HblankCb_TourneyTree(void)
|
||||
{
|
||||
register u32 vCount asm("r0") = REG_VCOUNT;
|
||||
register u32 vCount_ asm("r1") = vCount;
|
||||
if (vCount > 41)
|
||||
u16 vCount = REG_VCOUNT;
|
||||
|
||||
if (vCount < 42)
|
||||
{
|
||||
if (vCount < 50)
|
||||
REG_WININ = WININ_WIN0_BG_ALL | WININ_WIN0_CLR | WININ_WIN0_OBJ
|
||||
| WININ_WIN1_BG_ALL | WININ_WIN1_CLR | WININ_WIN1_OBJ;
|
||||
SET_WIN0H_WIN1H(0, 0);
|
||||
}
|
||||
else if (vCount < 50)
|
||||
{
|
||||
REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR
|
||||
| WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG3 | WININ_WIN1_OBJ | WININ_WIN1_CLR;
|
||||
SET_WIN0H_WIN1H(WIN_RANGE(152, 155), WIN_RANGE(85, 88));
|
||||
return;
|
||||
}
|
||||
else if (vCount > 57)
|
||||
else if (vCount < 58)
|
||||
{
|
||||
if (vCount < 75)
|
||||
REG_WININ = WININ_WIN0_BG_ALL | WININ_WIN0_CLR | WININ_WIN0_OBJ
|
||||
| WININ_WIN1_BG_ALL | WININ_WIN1_CLR | WININ_WIN1_OBJ;
|
||||
SET_WIN0H_WIN1H(0, 0);
|
||||
}
|
||||
else if (vCount < 75)
|
||||
{
|
||||
REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR
|
||||
| WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG3 | WININ_WIN1_OBJ | WININ_WIN1_CLR;
|
||||
SET_WIN0H_WIN1H(WIN_RANGE(144, 152), WIN_RANGE(88, 96));
|
||||
return;
|
||||
}
|
||||
else if (vCount < 82)
|
||||
{
|
||||
REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR
|
||||
| WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG3 | WININ_WIN1_OBJ | WININ_WIN1_CLR;
|
||||
SET_WIN0H_WIN1H(WIN_RANGE(152, 155), WIN_RANGE(85, 88));
|
||||
return;
|
||||
}
|
||||
else if (vCount > 94)
|
||||
else if (vCount < 95)
|
||||
{
|
||||
if (vCount < 103)
|
||||
REG_WININ = WININ_WIN0_BG_ALL | WININ_WIN0_CLR | WININ_WIN0_OBJ
|
||||
| WININ_WIN1_BG_ALL | WININ_WIN1_CLR | WININ_WIN1_OBJ;
|
||||
SET_WIN0H_WIN1H(0, 0);
|
||||
}
|
||||
else if (vCount < 103)
|
||||
{
|
||||
REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_OBJ | WININ_WIN0_CLR
|
||||
| WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG2 | WININ_WIN1_OBJ | WININ_WIN1_CLR;
|
||||
SET_WIN0H_WIN1H(WIN_RANGE(152, 155), WIN_RANGE(85, 88));
|
||||
return;
|
||||
}
|
||||
else if (vCount < 119)
|
||||
{
|
||||
REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_OBJ | WININ_WIN0_CLR
|
||||
| WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG2 | WININ_WIN1_OBJ | WININ_WIN1_CLR;
|
||||
SET_WIN0H_WIN1H(WIN_RANGE(144, 152), WIN_RANGE(88, 96));
|
||||
return;
|
||||
}
|
||||
else if (vCount > 126)
|
||||
else if (vCount < 127)
|
||||
{
|
||||
if (vCount_ < 135)
|
||||
REG_WININ = WININ_WIN0_BG_ALL | WININ_WIN0_CLR | WININ_WIN0_OBJ
|
||||
| WININ_WIN1_BG_ALL | WININ_WIN1_CLR | WININ_WIN1_OBJ;
|
||||
SET_WIN0H_WIN1H(0, 0);
|
||||
}
|
||||
else if (vCount < 135)
|
||||
{
|
||||
REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_OBJ | WININ_WIN0_CLR
|
||||
| WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG2 | WININ_WIN1_OBJ | WININ_WIN1_CLR;
|
||||
SET_WIN0H_WIN1H(WIN_RANGE(152, 155), WIN_RANGE(85, 88));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
REG_WININ = WININ_WIN0_BG_ALL | WININ_WIN0_CLR | WININ_WIN0_OBJ
|
||||
| WININ_WIN1_BG_ALL | WININ_WIN1_CLR | WININ_WIN1_OBJ;
|
||||
SET_WIN0H_WIN1H(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void VblankCb_TourneyTree(void)
|
||||
{
|
||||
|
@ -59,8 +59,8 @@ static const u8 sText_Trainer1LoseText[] = _("{B_TRAINER1_LOSE_TEXT}");
|
||||
static const u8 sText_PkmnGainedEXP[] = _("{B_BUFF1} gained{B_BUFF2}\n{B_BUFF3} EXP. Points!\p");
|
||||
static const u8 sText_EmptyString4[] = _("");
|
||||
static const u8 sText_ABoosted[] = _(" a boosted");
|
||||
static const u8 sText_PkmnGrewToLv[] = _("{B_BUFF1} grew to\nLV. {B_BUFF2}!{UNKNOWN_A}\p");
|
||||
static const u8 sText_PkmnLearnedMove[] = _("{B_BUFF1} learned\n{B_BUFF2}!{UNKNOWN_A}\p");
|
||||
static const u8 sText_PkmnGrewToLv[] = _("{B_BUFF1} grew to\nLV. {B_BUFF2}!{WAIT_SE}\p");
|
||||
static const u8 sText_PkmnLearnedMove[] = _("{B_BUFF1} learned\n{B_BUFF2}!{WAIT_SE}\p");
|
||||
static const u8 sText_TryToLearnMove1[] = _("{B_BUFF1} is trying to\nlearn {B_BUFF2}.\p");
|
||||
static const u8 sText_TryToLearnMove2[] = _("But, {B_BUFF1} can't learn\nmore than four moves.\p");
|
||||
static const u8 sText_TryToLearnMove3[] = _("Delete a move to make\nroom for {B_BUFF2}?");
|
||||
@ -460,8 +460,8 @@ static const u8 sText_PkmnBrokeFree[] = _("Oh, no!\nThe POKéMON broke free!");
|
||||
static const u8 sText_ItAppearedCaught[] = _("Aww!\nIt appeared to be caught!");
|
||||
static const u8 sText_AarghAlmostHadIt[] = _("Aargh!\nAlmost had it!");
|
||||
static const u8 sText_ShootSoClose[] = _("Shoot!\nIt was so close, too!");
|
||||
static const u8 sText_GotchaPkmnCaught[] = _("Gotcha!\n{B_DEF_NAME} was caught!{UNKNOWN_A}{PLAY_BGM MUS_KACHI22}\p");
|
||||
static const u8 sText_GotchaPkmnCaught2[] = _("Gotcha!\n{B_DEF_NAME} was caught!{UNKNOWN_A}{PLAY_BGM MUS_KACHI22}{PAUSE 127}");
|
||||
static const u8 sText_GotchaPkmnCaught[] = _("Gotcha!\n{B_DEF_NAME} was caught!{WAIT_SE}{PLAY_BGM MUS_KACHI22}\p");
|
||||
static const u8 sText_GotchaPkmnCaught2[] = _("Gotcha!\n{B_DEF_NAME} was caught!{WAIT_SE}{PLAY_BGM MUS_KACHI22}{PAUSE 127}");
|
||||
static const u8 sText_GiveNicknameCaptured[] = _("Give a nickname to the\ncaptured {B_DEF_NAME}?");
|
||||
static const u8 sText_PkmnSentToPC[] = _("{B_DEF_NAME} was sent to\n{B_PC_CREATOR_NAME} PC.");
|
||||
static const u8 sText_Someones[] = _("someone's");
|
||||
@ -1524,7 +1524,7 @@ const u16 gStatusConditionsStringIds[] =
|
||||
};
|
||||
|
||||
const u8 gText_PkmnIsEvolving[] = _("What?\n{STR_VAR_1} is evolving!");
|
||||
const u8 gText_CongratsPkmnEvolved[] = _("Congratulations! Your {STR_VAR_1}\nevolved into {STR_VAR_2}!{UNKNOWN_A}\p");
|
||||
const u8 gText_CongratsPkmnEvolved[] = _("Congratulations! Your {STR_VAR_1}\nevolved into {STR_VAR_2}!{WAIT_SE}\p");
|
||||
const u8 gText_PkmnStoppedEvolving[] = _("Huh? {STR_VAR_1}\nstopped evolving!\p");
|
||||
const u8 gText_EllipsisQuestionMark[] = _("……?\p");
|
||||
const u8 gText_WhatWillPkmnDo[] = _("What will\n{B_ACTIVE_NAME_WITH_PREFIX} do?");
|
||||
|
16
src/berry.c
16
src/berry.c
@ -1200,6 +1200,15 @@ static u8 GetNumStagesWateredByBerryTreeId(u8 id)
|
||||
return BerryTreeGetNumStagesWatered(GetBerryTreeInfo(id));
|
||||
}
|
||||
|
||||
// Berries can be watered at 4 stages of growth. This function is likely meant
|
||||
// to divide the berry yield range equally into quartiles. If you watered the
|
||||
// tree n times, your yield is a random number in the nth quartile.
|
||||
//
|
||||
// However, this function actually skews towards higher berry yields, because
|
||||
// it rounds `extraYield` to the nearest whole number.
|
||||
//
|
||||
// See resulting yields: https://gist.github.com/hondew/2a099dbe54aa91414decdbfaa524327d,
|
||||
// and bug fix: https://gist.github.com/hondew/0f0164e5b9dadfd72d24f30f2c049a0b.
|
||||
static u8 CalcBerryYieldInternal(u16 max, u16 min, u8 water)
|
||||
{
|
||||
u32 randMin;
|
||||
@ -1215,10 +1224,11 @@ static u8 CalcBerryYieldInternal(u16 max, u16 min, u8 water)
|
||||
randMax = (max - min) * (water);
|
||||
rand = randMin + Random() % (randMax - randMin + 1);
|
||||
|
||||
if ((rand & 3) > 1)
|
||||
extraYield = rand / 4 + 1;
|
||||
// Round upwards
|
||||
if ((rand % NUM_WATER_STAGES) >= NUM_WATER_STAGES / 2)
|
||||
extraYield = rand / NUM_WATER_STAGES + 1;
|
||||
else
|
||||
extraYield = rand / 4;
|
||||
extraYield = rand / NUM_WATER_STAGES;
|
||||
return extraYield + min;
|
||||
}
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ static void sub_8020F88(void);
|
||||
static void sub_8020FA0(u8);
|
||||
void sub_8020FC4(struct BerryCrushGame *);
|
||||
void sub_8022BEC(u16, u8, u8 *);
|
||||
void sub_8024604(u8 *, u32, s32, u32, u32, u32, u32);
|
||||
static void BerryCrush_SetPaletteFadeParams(u8 *, bool8, u32, s8, u8, u8, u16);
|
||||
static int sub_8021450(struct BerryCrushGame *);
|
||||
void sub_8022588(struct BerryCrushGame *);
|
||||
void sub_8022600(struct BerryCrushGame *);
|
||||
@ -206,7 +206,7 @@ void sub_8022554(struct BerryCrushGame_138 *r0);
|
||||
void sub_8024578(struct BerryCrushGame *);
|
||||
void sub_8024644(u8 *, u32, u32, u32, u32);
|
||||
static void sub_8022A20(struct Sprite *sprite);
|
||||
static u32 sub_8022C58(struct BerryCrushGame *r6, u8 *r1);
|
||||
static u32 BerryCrushCommand_BeginNormalPaletteFade(struct BerryCrushGame *r6, u8 *r1);
|
||||
static u32 sub_8022CB0(struct BerryCrushGame *r4, u8 *r5);
|
||||
static u32 sub_8022D14(struct BerryCrushGame *r7, u8 *r5);
|
||||
static u32 sub_8022E1C(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1);
|
||||
@ -322,7 +322,7 @@ static const u8 sBerryCrushTextColorTable[][3] =
|
||||
};
|
||||
|
||||
|
||||
static const struct WindowTemplate gUnknown_082F32EC =
|
||||
static const struct WindowTemplate sWindowTemplate_BerryCrushRankings =
|
||||
{
|
||||
.bg = 0,
|
||||
.tilemapLeft = 3,
|
||||
@ -421,7 +421,7 @@ static const u8 gUnknown_082F3344[][4] =
|
||||
{12, 14, 15, 16},
|
||||
};
|
||||
|
||||
static const u32 gUnknown_082F334C[] =
|
||||
static const u32 sPressingSpeedConversionTable[] =
|
||||
{
|
||||
50000000 / (1 << 0),
|
||||
50000000 / (1 << 1),
|
||||
@ -767,7 +767,7 @@ static const u8 *const gUnknown_082F43B4[] =
|
||||
static u32 (*const gUnknown_082F43CC[])(struct BerryCrushGame *, u8 *) =
|
||||
{
|
||||
NULL,
|
||||
sub_8022C58,
|
||||
BerryCrushCommand_BeginNormalPaletteFade,
|
||||
sub_8022CB0,
|
||||
sub_8022D14,
|
||||
sub_8022E1C,
|
||||
@ -874,7 +874,7 @@ void sub_8020C70(MainCallback callback)
|
||||
gUnknown_02022C90->unk12 = 1;
|
||||
gUnknown_02022C90->unkE = 1;
|
||||
gUnknown_02022C90->unkF = 6;
|
||||
sub_8024604(gUnknown_02022C90->unk36, 1, -1, 0, 16, 0, 0);
|
||||
BerryCrush_SetPaletteFadeParams(gUnknown_02022C90->unk36, 1, -1, 0, 16, 0, 0);
|
||||
sub_8022BEC(4, 1, gUnknown_02022C90->unk36);
|
||||
SetMainCallback2(sub_8020F88);
|
||||
gUnknown_02022C90->unkA = CreateTask(sub_8020FA0, 8);
|
||||
@ -891,7 +891,7 @@ static void sub_8020D8C(void)
|
||||
gUnknown_02022C90->unk68.as_four_players.others[gUnknown_02022C90->unk8].unk0 = gSpecialVar_ItemId - FIRST_BERRY_INDEX;
|
||||
gUnknown_02022C90->unkE = 1;
|
||||
gUnknown_02022C90->unkF = 9;
|
||||
sub_8024604(gUnknown_02022C90->unk36, 0, -1, 0, 16, 0, 0);
|
||||
BerryCrush_SetPaletteFadeParams(gUnknown_02022C90->unk36, 0, -1, 0, 16, 0, 0);
|
||||
sub_8022BEC(4, 1, gUnknown_02022C90->unk36);
|
||||
gUnknown_02022C90->unkA = CreateTask(sub_8020FA0, 8);
|
||||
SetMainCallback2(sub_8020F88);
|
||||
@ -918,11 +918,11 @@ void sub_8020E58(void)
|
||||
u32 var0, var1;
|
||||
|
||||
var0 = gUnknown_02022C90->unk68.as_four_players.unk00.unk04;
|
||||
var0 <<= 8;
|
||||
var0 = sub_81515FC(var0, 60 << 8);
|
||||
var0 = Q_24_8(var0);
|
||||
var0 = MathUtil_Div32(var0, Q_24_8(60));
|
||||
var1 = gUnknown_02022C90->unk68.as_four_players.unk00.unk0A;
|
||||
var1 <<= 8;
|
||||
var1 = sub_81515FC(var1, var0) & 0xFFFF;
|
||||
var1 = Q_24_8(var1);
|
||||
var1 = MathUtil_Div32(var1, var0) & 0xFFFF;
|
||||
gUnknown_02022C90->unk16 = var1;
|
||||
switch (gUnknown_02022C90->unk9)
|
||||
{
|
||||
@ -1232,12 +1232,12 @@ void sub_80214A8(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1)
|
||||
var0 *= 128;
|
||||
var6 = var5 + 32;
|
||||
var6 = var6 / 2;
|
||||
var1 = sub_81515D4(7, 0x3F80, var6);
|
||||
var1 = MathUtil_Div16Shift(7, Q_8_8(63.5), var6);
|
||||
data[0] = (u16)arg1->unk38[i]->pos1.x * 128;
|
||||
data[3] = sub_81515D4(7, var0, var1);
|
||||
var1 = sub_8151550(7, var1, 85);
|
||||
data[3] = MathUtil_Div16Shift(7, var0, var1);
|
||||
var1 = MathUtil_Mul16Shift(7, var1, 85);
|
||||
data[4] = 0;
|
||||
data[5] = sub_81515D4(7, 0x3F80, var1);
|
||||
data[5] = MathUtil_Div16Shift(7, Q_8_8(63.5), var1);
|
||||
data[7] |= 0x8000;
|
||||
if (arg1->unkC[i]->unk8 < 0)
|
||||
StartSpriteAffineAnim(arg1->unk38[i], 1);
|
||||
@ -1383,12 +1383,12 @@ void sub_8021944(struct BerryCrushGame_138 *arg0, u16 arg1)
|
||||
|
||||
arg0->unk4 = arg1 / 3600;
|
||||
arg0->unk6 = (arg1 % 3600) / 60;
|
||||
r3 = sub_8151534((arg1 % 60) << 8, 4);
|
||||
r3 = MathUtil_Mul16(Q_8_8(arg1 % 60), 4);
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
if ((r3 >> (7 - i)) & 1)
|
||||
r7 += gUnknown_082F334C[i];
|
||||
r7 += sPressingSpeedConversionTable[i];
|
||||
}
|
||||
|
||||
arg0->unk8 = r7 / 1000000;
|
||||
@ -1442,7 +1442,7 @@ void sub_8021A28(struct BerryCrushGame * sp0C, u8 sp10, u8 sp14, u8 sp18)
|
||||
r7 = sp24->as_four_players.unk00.unk0C[sp10][r8] & 15;
|
||||
for (r2 = 0; r2 < 4; ++r2)
|
||||
if ((r7 >> (3 - r2)) & 1)
|
||||
r3 += gUnknown_082F334C[r2];
|
||||
r3 += sPressingSpeedConversionTable[r2];
|
||||
r7 = r3 / 1000000u;
|
||||
ConvertIntToDecimalStringN(gStringVar2, r7, STR_CONV_MODE_LEADING_ZEROS, 2);
|
||||
StringExpandPlaceholders(gStringVar4, gUnknown_082F43B4[sp10]);
|
||||
@ -1499,7 +1499,7 @@ void sub_8021D34(struct BerryCrushGame *r8)
|
||||
AddTextPrinterParameterized3(r8->unk138.unk82, 2, r6, r7, sBerryCrushTextColorTable[0], 0, gText_TimesPerSec);
|
||||
for (; r10 < 8; ++r10)
|
||||
if (((u8)r8->unk16 >> (7 - r10)) & 1)
|
||||
sp0C += *(r10 + gUnknown_082F334C); // It's accessed in a different way here for unknown reason
|
||||
sp0C += *(r10 + sPressingSpeedConversionTable); // It's accessed in a different way here for unknown reason
|
||||
ConvertIntToDecimalStringN(gStringVar1, r8->unk16 >> 8, STR_CONV_MODE_RIGHT_ALIGN, 3);
|
||||
ConvertIntToDecimalStringN(gStringVar2, sp0C / 1000000, STR_CONV_MODE_LEADING_ZEROS, 2);
|
||||
StringExpandPlaceholders(gStringVar4, gText_XDotY3);
|
||||
@ -1580,93 +1580,89 @@ void sub_802222C(struct BerryCrushGame *r4)
|
||||
sub_8022600(r4);
|
||||
}
|
||||
|
||||
void sub_8022250(u8 r4)
|
||||
static void Task_ShowBerryCrushRankings(u8 taskId)
|
||||
{
|
||||
u8 r9 = 0, r2, r7, r10;
|
||||
u32 sp0C = 0;
|
||||
s16 *r6 = gTasks[r4].data;
|
||||
const u8 *r10_; // turn r5/sl register swap into r8/sl
|
||||
u8 i = 0, j, xPos, yPos;
|
||||
u32 score = 0;
|
||||
s16 *data = gTasks[taskId].data;
|
||||
u8 *str;
|
||||
|
||||
switch (r6[0])
|
||||
switch (data[0])
|
||||
{
|
||||
case 0:
|
||||
r6[1] = AddWindow(&gUnknown_082F32EC);
|
||||
PutWindowTilemap((u8)r6[1]);
|
||||
FillWindowPixelBuffer((u8)r6[1], PIXEL_FILL(0));
|
||||
LoadUserWindowBorderGfx_((u8)r6[1], 541, 208);
|
||||
DrawStdFrameWithCustomTileAndPalette((u8)r6[1], 0, 541, 13);
|
||||
data[1] = AddWindow(&sWindowTemplate_BerryCrushRankings);
|
||||
PutWindowTilemap(data[1]);
|
||||
FillWindowPixelBuffer(data[1], PIXEL_FILL(0));
|
||||
LoadUserWindowBorderGfx_(data[1], 541, 208);
|
||||
DrawStdFrameWithCustomTileAndPalette(data[1], 0, 541, 13);
|
||||
break;
|
||||
case 1:
|
||||
r10_ = gText_BerryCrush2;
|
||||
++r10_; --r10_; // swap sb/sl
|
||||
#ifndef NONMATCHING
|
||||
asm("":::"r8"); // turn r8/sl register swap into sb/sl
|
||||
#endif
|
||||
r7 = 96 - GetStringWidth(1, r10_, -1) / 2u;
|
||||
xPos = 96 - GetStringWidth(1, gText_BerryCrush2, -1) / 2u;
|
||||
AddTextPrinterParameterized3(
|
||||
(u8)r6[1],
|
||||
data[1],
|
||||
1,
|
||||
r7,
|
||||
xPos,
|
||||
1,
|
||||
sBerryCrushTextColorTable[3],
|
||||
0,
|
||||
r10_
|
||||
gText_BerryCrush2
|
||||
);
|
||||
r10_ = gText_PressingSpeedRankings;
|
||||
r7 = 96 - GetStringWidth(1, r10_, -1) / 2u;
|
||||
xPos = 96 - GetStringWidth(1, gText_PressingSpeedRankings, -1) / 2u;
|
||||
AddTextPrinterParameterized3(
|
||||
(u8)r6[1],
|
||||
data[1],
|
||||
1,
|
||||
r7,
|
||||
xPos,
|
||||
17,
|
||||
sBerryCrushTextColorTable[3],
|
||||
0,
|
||||
r10_
|
||||
gText_PressingSpeedRankings
|
||||
);
|
||||
r10 = 41;
|
||||
for (; r9 < 4; ++r9)
|
||||
yPos = 41;
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
ConvertIntToDecimalStringN(gStringVar1, r9 + 2, STR_CONV_MODE_LEFT_ALIGN, 1);
|
||||
ConvertIntToDecimalStringN(gStringVar1, i + 2, STR_CONV_MODE_LEFT_ALIGN, 1);
|
||||
StringExpandPlaceholders(gStringVar4, gText_Var1Players);
|
||||
AddTextPrinterParameterized3(
|
||||
(u8)r6[1],
|
||||
data[1],
|
||||
1,
|
||||
0,
|
||||
r10,
|
||||
yPos,
|
||||
sBerryCrushTextColorTable[0],
|
||||
0,
|
||||
gStringVar4
|
||||
);
|
||||
r7 = 192 - (u8)GetStringWidth(1, gText_TimesPerSec, -1);
|
||||
xPos = 192 - (u8)GetStringWidth(1, gText_TimesPerSec, -1);
|
||||
AddTextPrinterParameterized3(
|
||||
(u8)r6[1],
|
||||
data[1],
|
||||
1,
|
||||
r7,
|
||||
r10,
|
||||
xPos,
|
||||
yPos,
|
||||
sBerryCrushTextColorTable[0],
|
||||
0,
|
||||
gText_TimesPerSec
|
||||
);
|
||||
for (r2 = 0; r2 < 8; ++r2)
|
||||
if (((u8)r6[r9 + 2] >> (7 - r2)) & 1)
|
||||
sp0C += gUnknown_082F334C[r2];
|
||||
ConvertIntToDecimalStringN(gStringVar1, (u16)r6[r9 + 2] >> 8, STR_CONV_MODE_RIGHT_ALIGN, 3);
|
||||
ConvertIntToDecimalStringN(gStringVar2, sp0C / 1000000, STR_CONV_MODE_LEADING_ZEROS, 2);
|
||||
for (j = 0; j < 8; ++j)
|
||||
{
|
||||
if (((data[i + 2] & 0xFF) >> (7 - j)) & 1)
|
||||
score += sPressingSpeedConversionTable[j];
|
||||
}
|
||||
ConvertIntToDecimalStringN(gStringVar1, (u16)data[i + 2] >> 8, STR_CONV_MODE_RIGHT_ALIGN, 3);
|
||||
ConvertIntToDecimalStringN(gStringVar2, score / 1000000, STR_CONV_MODE_LEADING_ZEROS, 2);
|
||||
StringExpandPlaceholders(gStringVar4, gText_XDotY3);
|
||||
r7 -= GetStringWidth(1, gStringVar4, -1);
|
||||
xPos -= GetStringWidth(1, gStringVar4, -1);
|
||||
AddTextPrinterParameterized3(
|
||||
(u8)r6[1],
|
||||
data[1],
|
||||
1,
|
||||
r7,
|
||||
r10,
|
||||
xPos,
|
||||
yPos,
|
||||
sBerryCrushTextColorTable[0],
|
||||
0,
|
||||
gStringVar4
|
||||
);
|
||||
r10 += 16;
|
||||
sp0C = 0;
|
||||
yPos += 16;
|
||||
score = 0;
|
||||
}
|
||||
CopyWindowToVram((u8)r6[1], 3);
|
||||
CopyWindowToVram(data[1], 3);
|
||||
break;
|
||||
case 2:
|
||||
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||
@ -1674,16 +1670,16 @@ void sub_8022250(u8 r4)
|
||||
else
|
||||
return;
|
||||
case 3:
|
||||
ClearStdWindowAndFrameToTransparent((u8)r6[1], 1);
|
||||
ClearWindowTilemap((u8)r6[1]);
|
||||
RemoveWindow((u8)r6[1]);
|
||||
DestroyTask(r4);
|
||||
ClearStdWindowAndFrameToTransparent(data[1], 1);
|
||||
ClearWindowTilemap(data[1]);
|
||||
RemoveWindow(data[1]);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext2_Disable();
|
||||
r6[0] = 0;
|
||||
data[0] = 0;
|
||||
return;
|
||||
}
|
||||
++r6[0];
|
||||
++data[0];
|
||||
}
|
||||
|
||||
void ShowBerryCrushRankings(void)
|
||||
@ -1691,7 +1687,7 @@ void ShowBerryCrushRankings(void)
|
||||
u8 taskId;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
taskId = CreateTask(sub_8022250, 0);
|
||||
taskId = CreateTask(Task_ShowBerryCrushRankings, 0);
|
||||
gTasks[taskId].data[2] = gSaveBlock2Ptr->berryCrush.berryCrushResults[0];
|
||||
gTasks[taskId].data[3] = gSaveBlock2Ptr->berryCrush.berryCrushResults[1];
|
||||
gTasks[taskId].data[4] = gSaveBlock2Ptr->berryCrush.berryCrushResults[2];
|
||||
@ -1943,12 +1939,12 @@ void sub_8022B28(struct Sprite *sprite)
|
||||
r7[2] = 32;
|
||||
r7[7] = 168;
|
||||
r4 = sprite->pos2.x * 128;
|
||||
r5 = sub_81515D4(7, (168 - sprite->pos1.y) << 7, (r2 + 32) >> 1);
|
||||
r5 = MathUtil_Div16Shift(7, (168 - sprite->pos1.y) << 7, (r2 + 32) >> 1);
|
||||
sprite->data[0] = sprite->pos1.x << 7;
|
||||
r7[3] = sub_81515D4(7, r4, r5);
|
||||
r2 = sub_8151550(7, r5, 85);
|
||||
r7[3] = MathUtil_Div16Shift(7, r4, r5);
|
||||
r2 = MathUtil_Mul16Shift(7, r5, 85);
|
||||
r7[4] = r8;
|
||||
r7[5] = sub_81515D4(7, 0x3F80, r2);
|
||||
r7[5] = MathUtil_Div16Shift(7, Q_8_8(63.5), r2);
|
||||
r7[6] = sprite->pos2.x / 4;
|
||||
r7[7] |= 0x8000;
|
||||
sprite->pos2.y = r8;
|
||||
@ -1979,39 +1975,42 @@ void sub_8022BEC(u16 r5, u8 r4, u8 *r7)
|
||||
}
|
||||
}
|
||||
|
||||
static u32 sub_8022C58(struct BerryCrushGame *r6, u8 *r1)
|
||||
static u32 BerryCrushCommand_BeginNormalPaletteFade(struct BerryCrushGame *game, u8 *params)
|
||||
{
|
||||
u16 r4;
|
||||
u32 r0;
|
||||
#ifndef NONMATCHING // fake match, nobody can write such code
|
||||
register u32 r2 asm("r2");
|
||||
register u32 r3 asm("r3");
|
||||
// params points to packed values:
|
||||
// bytes 0-3: selectedPals (bitfield)
|
||||
// byte 4: delay
|
||||
// byte 5: startY
|
||||
// byte 6: stopY
|
||||
// bytes 7-8: fade color
|
||||
// byte 9: if TRUE, communicate on fade complete
|
||||
|
||||
r2 = r1[0];
|
||||
r3 = r1[1];
|
||||
r3 <<= 8;
|
||||
r2 |= r3;
|
||||
r3 = r1[2];
|
||||
r3 <<= 16;
|
||||
r2 |= r3;
|
||||
r3 = r1[3];
|
||||
r3 <<= 24;
|
||||
r0 = r2;
|
||||
r0 |= r3;
|
||||
u16 color;
|
||||
u32 selectedPals;
|
||||
selectedPals = ({
|
||||
#ifndef NONMATCHING
|
||||
register u32 value asm("r2");
|
||||
register u32 b asm("r3");
|
||||
#else
|
||||
u32 r2;
|
||||
u32 value;
|
||||
u32 b;
|
||||
#endif //NONMATCHING
|
||||
value = params[0] << 0;
|
||||
value |= (b = params[1] << 8);
|
||||
value |= (b = params[2] << 16);
|
||||
value |= (b = params[3] << 24);
|
||||
value;
|
||||
});
|
||||
|
||||
params[0] = params[9];
|
||||
|
||||
color = params[8] << 8;
|
||||
color |= params[7] << 0;
|
||||
|
||||
r0 = T1_READ_32(r1);
|
||||
#endif
|
||||
r2 = r1[9];
|
||||
r1[0] = r2;
|
||||
r4 = r1[8] << 8;
|
||||
r2 = r1[7];
|
||||
r4 |= r2;
|
||||
gPaletteFade.bufferTransferDisabled = FALSE;
|
||||
BeginNormalPaletteFade(r0, r1[4], r1[5], r1[6], r4);
|
||||
BeginNormalPaletteFade(selectedPals, params[4], params[5], params[6], color);
|
||||
UpdatePaletteFade();
|
||||
r6->unkE = 2;
|
||||
game->unkE = 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2195,7 +2194,7 @@ static u32 sub_8022F1C(struct BerryCrushGame *r5, u8 *r2)
|
||||
}
|
||||
r5->unk10 = 0;
|
||||
ResetBlockReceivedFlags();
|
||||
r5->unk20 = sub_81515FC(r5->unk18 << 8, 0x2000);
|
||||
r5->unk20 = MathUtil_Div32(Q_24_8(r5->unk18), Q_24_8(32));
|
||||
break;
|
||||
case 5:
|
||||
ClearDialogWindowAndFrame(0, 1);
|
||||
@ -2412,9 +2411,9 @@ void sub_802339C(struct BerryCrushGame *r4)
|
||||
r2_ = r4->unk1A;
|
||||
if (r0 - r2_ > 0)
|
||||
{
|
||||
r2_ <<= 8;
|
||||
r2_ = sub_81515FC(r2_, r4->unk20);
|
||||
r2_ >>= 8;
|
||||
r2_ = Q_24_8(r2_);
|
||||
r2_ = MathUtil_Div32(r2_, r4->unk20);
|
||||
r2_ = Q_24_8_TO_INT(r2_);
|
||||
r4->unk24 = r2_;
|
||||
}
|
||||
else
|
||||
@ -2801,14 +2800,14 @@ static u32 sub_8023CAC(struct BerryCrushGame *r7, __attribute__((unused)) u8 *r1
|
||||
);
|
||||
r7->unk68.as_four_players.unk00.unk04 = r7->unk28;
|
||||
r7->unk68.as_four_players.unk00.unk06 = r7->unk18 / (r7->unk28 / 60);
|
||||
r2 = sub_8151574(r7->unk30 << 8, 0x3200);
|
||||
r2 = sub_81515FC(r2, r7->unk32 << 8) + 0x3200;
|
||||
r2 >>= 8;
|
||||
r2 = MathUtil_Mul32(Q_24_8(r7->unk30), Q_24_8(50));
|
||||
r2 = MathUtil_Div32(r2, Q_24_8(r7->unk32)) + Q_24_8(50);
|
||||
r2 = Q_24_8_TO_INT(r2);
|
||||
r7->unk68.as_four_players.unk00.unk08 = r2 & 0x7F;
|
||||
r2 <<= 8;
|
||||
r2 = sub_81515FC(r2, 0x6400);
|
||||
r4 = (r7->unk1C * r7->unk9) << 8;
|
||||
r4 = sub_8151574(r4, r2);
|
||||
r2 = Q_24_8(r2);
|
||||
r2 = MathUtil_Div32(r2, Q_24_8(100));
|
||||
r4 = Q_24_8(r7->unk1C * r7->unk9);
|
||||
r4 = MathUtil_Mul32(r4, r2);
|
||||
r7->unk68.as_four_players.unk00.unk00 = r4 >> 8;
|
||||
r7->unk68.as_five_players.unk1C[0].unk4.as_2d_bytes[0][7] = Random() % 3;
|
||||
for (r6 = 0, r8 = 0; r8 < r7->unk9; ++r8)
|
||||
@ -2823,11 +2822,11 @@ static u32 sub_8023CAC(struct BerryCrushGame *r7, __attribute__((unused)) u8 *r1
|
||||
if (r7->unk68.as_four_players.others[r8].unk4.as_hwords[3] != 0)
|
||||
{
|
||||
r2 = r7->unk68.as_four_players.others[r8].unk4.as_hwords[2];
|
||||
r2 <<= 8;
|
||||
r2 = sub_8151574(r2, 0x6400);
|
||||
r2 = Q_24_8(r2);
|
||||
r2 = MathUtil_Mul32(r2, Q_24_8(100));
|
||||
r4 = r7->unk68.as_four_players.others[r8].unk4.as_hwords[3];
|
||||
r4 <<= 8;
|
||||
r4 = sub_81515FC(r2, r4);
|
||||
r4 = Q_24_8(r4);
|
||||
r4 = MathUtil_Div32(r2, r4);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2838,11 +2837,11 @@ static u32 sub_8023CAC(struct BerryCrushGame *r7, __attribute__((unused)) u8 *r1
|
||||
if (r7->unk68.as_four_players.others[r8].unk4.as_hwords[3] != 0)
|
||||
{
|
||||
r2 = r7->unk68.as_four_players.others[r8].unk4.as_hwords[4];
|
||||
r2 <<= 8;
|
||||
r2 = sub_8151574(r2, 0x6400);
|
||||
r2 = Q_24_8(r2);
|
||||
r2 = MathUtil_Mul32(r2, Q_24_8(100));
|
||||
r4 = r7->unk68.as_four_players.others[r8].unk4.as_hwords[3];
|
||||
r4 <<= 8;
|
||||
r4 = sub_81515FC(r2, r4);
|
||||
r4 = Q_24_8(r4);
|
||||
r4 = MathUtil_Div32(r2, r4);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2861,11 +2860,11 @@ static u32 sub_8023CAC(struct BerryCrushGame *r7, __attribute__((unused)) u8 *r1
|
||||
else
|
||||
{
|
||||
r2 = r7->unk68.as_four_players.others[r8].unk4.as_hwords[5];
|
||||
r2 <<= 8;
|
||||
r2 = sub_8151574(r2, 0x6400);
|
||||
r2 = Q_24_8(r2);
|
||||
r2 = MathUtil_Mul32(r2, Q_24_8(100));
|
||||
r4 = r7->unk28;
|
||||
r4 <<= 8;
|
||||
r4 = sub_81515FC(r2, r4);
|
||||
r4 = Q_24_8(r4);
|
||||
r4 = MathUtil_Div32(r2, r4);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -3251,64 +3250,19 @@ void sub_8024578(struct BerryCrushGame *r4)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
void sub_8024604(u8 *r0, u32 r1, s32 r2, u32 r3, u32 r5, u32 r6, u32 r4)
|
||||
static void BerryCrush_SetPaletteFadeParams(u8 *params, bool8 communicateAfter, u32 selectedPals, s8 delay, u8 startY, u8 targetY, u16 palette)
|
||||
{
|
||||
u8 sp[8];
|
||||
u8 *p;
|
||||
|
||||
1[(u32 *)sp] = r2;
|
||||
0[(u16 *)sp] = r4;
|
||||
p = &sp[4];
|
||||
r0[0] = p[0];
|
||||
r0[1] = p[1];
|
||||
r0[2] = p[2];
|
||||
r0[3] = p[3];
|
||||
r0[4] = r3;
|
||||
r0[5] = r5;
|
||||
r0[6] = r6;
|
||||
r0[7] = sp[0];
|
||||
r0[8] = sp[1];
|
||||
r0[9] = r1;
|
||||
params[0] = ((u8 *)&selectedPals)[0];
|
||||
params[1] = ((u8 *)&selectedPals)[1];
|
||||
params[2] = ((u8 *)&selectedPals)[2];
|
||||
params[3] = ((u8 *)&selectedPals)[3];
|
||||
params[4] = delay;
|
||||
params[5] = startY;
|
||||
params[6] = targetY;
|
||||
params[7] = ((u8 *)&palette)[0];
|
||||
params[8] = ((u8 *)&palette)[1];
|
||||
params[9] = communicateAfter;
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_8024604(u8 *r0, u32 r1, s32 r2, u32 r3, u32 r5, u32 r6, u32 r4)
|
||||
{
|
||||
asm_unified("\n\
|
||||
push {r4-r6,lr}\n\
|
||||
sub sp, 0x8\n\
|
||||
str r2, [sp, 0x4]\n\
|
||||
ldr r5, [sp, 0x18]\n\
|
||||
ldr r6, [sp, 0x1C]\n\
|
||||
ldr r4, [sp, 0x20]\n\
|
||||
mov r2, sp\n\
|
||||
strh r4, [r2]\n\
|
||||
add r4, sp, 0x4\n\
|
||||
ldrb r2, [r4]\n\
|
||||
strb r2, [r0]\n\
|
||||
ldrb r2, [r4, 0x1]\n\
|
||||
strb r2, [r0, 0x1]\n\
|
||||
ldrb r2, [r4, 0x2]\n\
|
||||
strb r2, [r0, 0x2]\n\
|
||||
ldrb r2, [r4, 0x3]\n\
|
||||
strb r2, [r0, 0x3]\n\
|
||||
strb r3, [r0, 0x4]\n\
|
||||
strb r5, [r0, 0x5]\n\
|
||||
strb r6, [r0, 0x6]\n\
|
||||
mov r2, sp\n\
|
||||
ldrb r2, [r2]\n\
|
||||
strb r2, [r0, 0x7]\n\
|
||||
mov r2, sp\n\
|
||||
ldrb r2, [r2, 0x1]\n\
|
||||
strb r2, [r0, 0x8]\n\
|
||||
strb r1, [r0, 0x9]\n\
|
||||
add sp, 0x8\n\
|
||||
pop {r4-r6}\n\
|
||||
pop {r0}\n\
|
||||
bx r0");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_8024644(u8 *r0, u32 r1, u32 r2, u32 r3, u32 r5)
|
||||
{
|
||||
|
@ -7,9 +7,9 @@
|
||||
.baseHP = 50, \
|
||||
.baseAttack = 150, \
|
||||
.baseDefense = 50, \
|
||||
.baseSpeed = 150, \
|
||||
.baseSpAttack = 150, \
|
||||
.baseSpDefense = 50, \
|
||||
.baseSpeed = 150, \
|
||||
.type1 = TYPE_NORMAL, \
|
||||
.type2 = TYPE_NORMAL, \
|
||||
.catchRate = 3, \
|
||||
@ -28,7 +28,7 @@
|
||||
.growthRate = GROWTH_MEDIUM_FAST, \
|
||||
.eggGroup1 = EGG_GROUP_UNDISCOVERED, \
|
||||
.eggGroup2 = EGG_GROUP_UNDISCOVERED, \
|
||||
.abilities = {0, 0}, \
|
||||
.abilities = {ABILITY_NONE, ABILITY_NONE}, \
|
||||
.safariZoneFleeRate = 0, \
|
||||
.bodyColor = BODY_COLOR_BLACK, \
|
||||
.noFlip = FALSE, \
|
||||
|
481
src/decompress.c
481
src/decompress.c
@ -114,347 +114,148 @@ void Unused_LZDecompressWramIndirect(const void **src, void *dest)
|
||||
LZ77UnCompWram(*src, dest);
|
||||
}
|
||||
|
||||
// This one (unused) function is really challenging, won't even try to decompile it.
|
||||
NAKED
|
||||
void sub_803471C()
|
||||
void sub_803471C(s32 object_size, s32 object_count, u8 *src_tiles, u8 *dest_tiles)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
push {r4-r7,lr}\n\
|
||||
mov r7, r10\n\
|
||||
mov r6, r9\n\
|
||||
mov r5, r8\n\
|
||||
push {r5-r7}\n\
|
||||
sub sp, 0x24\n\
|
||||
mov r9, r0\n\
|
||||
str r1, [sp]\n\
|
||||
str r2, [sp, 0x4]\n\
|
||||
adds r5, r3, 0\n\
|
||||
movs r0, 0x1\n\
|
||||
mov r1, r9\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
bne _0803473C\n\
|
||||
b _080348D4\n\
|
||||
_0803473C:\n\
|
||||
asrs r0, r1, 1\n\
|
||||
adds r0, 0x4\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r0, 24\n\
|
||||
str r0, [sp, 0x8]\n\
|
||||
movs r0, 0\n\
|
||||
ldr r2, [sp]\n\
|
||||
cmp r0, r2\n\
|
||||
blt _08034750\n\
|
||||
b _08034964\n\
|
||||
_08034750:\n\
|
||||
movs r4, 0x8\n\
|
||||
subs r1, r4, r1\n\
|
||||
str r1, [sp, 0x10]\n\
|
||||
_08034756:\n\
|
||||
movs r7, 0\n\
|
||||
adds r0, 0x1\n\
|
||||
str r0, [sp, 0x14]\n\
|
||||
ldr r0, [sp, 0x10]\n\
|
||||
cmp r7, r0\n\
|
||||
bge _080347D2\n\
|
||||
ldr r1, [sp, 0x8]\n\
|
||||
lsls r1, 8\n\
|
||||
str r1, [sp, 0x18]\n\
|
||||
movs r2, 0\n\
|
||||
mov r10, r2\n\
|
||||
mov r0, r9\n\
|
||||
movs r4, 0x8\n\
|
||||
subs r0, r4, r0\n\
|
||||
str r0, [sp, 0xC]\n\
|
||||
_08034774:\n\
|
||||
movs r3, 0\n\
|
||||
asrs r0, r7, 1\n\
|
||||
adds r1, r7, 0\n\
|
||||
movs r2, 0x1\n\
|
||||
ands r1, r2\n\
|
||||
str r1, [sp, 0x20]\n\
|
||||
lsls r0, 8\n\
|
||||
mov r8, r0\n\
|
||||
mov r12, r5\n\
|
||||
_08034786:\n\
|
||||
lsls r1, r3, 5\n\
|
||||
ldr r4, [sp, 0x18]\n\
|
||||
adds r0, r5, r4\n\
|
||||
adds r0, r1\n\
|
||||
mov r1, r8\n\
|
||||
adds r2, r0, r1\n\
|
||||
mov r1, r12\n\
|
||||
add r1, r8\n\
|
||||
movs r6, 0xF\n\
|
||||
_08034798:\n\
|
||||
ldr r4, [sp, 0x20]\n\
|
||||
cmp r4, 0\n\
|
||||
bne _080347A8\n\
|
||||
strb r4, [r1]\n\
|
||||
add r4, sp, 0x20\n\
|
||||
ldrb r4, [r4]\n\
|
||||
strb r4, [r2, 0x10]\n\
|
||||
b _080347B6\n\
|
||||
_080347A8:\n\
|
||||
mov r0, r10\n\
|
||||
strb r0, [r1, 0x10]\n\
|
||||
movs r4, 0x80\n\
|
||||
lsls r4, 1\n\
|
||||
adds r4, r2, r4\n\
|
||||
str r4, [sp, 0x1C]\n\
|
||||
strb r0, [r4]\n\
|
||||
_080347B6:\n\
|
||||
adds r2, 0x1\n\
|
||||
adds r1, 0x1\n\
|
||||
subs r6, 0x1\n\
|
||||
cmp r6, 0\n\
|
||||
bge _08034798\n\
|
||||
movs r0, 0x20\n\
|
||||
add r12, r0\n\
|
||||
adds r3, 0x1\n\
|
||||
cmp r3, 0x7\n\
|
||||
ble _08034786\n\
|
||||
adds r7, 0x1\n\
|
||||
ldr r1, [sp, 0xC]\n\
|
||||
cmp r7, r1\n\
|
||||
blt _08034774\n\
|
||||
_080347D2:\n\
|
||||
movs r7, 0\n\
|
||||
movs r2, 0\n\
|
||||
_080347D6:\n\
|
||||
movs r6, 0\n\
|
||||
adds r4, r7, 0x1\n\
|
||||
mov r8, r4\n\
|
||||
lsls r4, r7, 5\n\
|
||||
_080347DE:\n\
|
||||
adds r0, r6, 0x1\n\
|
||||
mov r10, r0\n\
|
||||
lsls r1, r6, 8\n\
|
||||
adds r0, r1, 0\n\
|
||||
adds r0, 0xC0\n\
|
||||
adds r0, r5, r0\n\
|
||||
adds r0, r4\n\
|
||||
adds r1, r5, r1\n\
|
||||
adds r1, r4\n\
|
||||
movs r3, 0x1F\n\
|
||||
_080347F2:\n\
|
||||
strb r2, [r1]\n\
|
||||
strb r2, [r0]\n\
|
||||
adds r0, 0x1\n\
|
||||
adds r1, 0x1\n\
|
||||
subs r3, 0x1\n\
|
||||
cmp r3, 0\n\
|
||||
bge _080347F2\n\
|
||||
mov r6, r10\n\
|
||||
cmp r6, 0x7\n\
|
||||
ble _080347DE\n\
|
||||
mov r7, r8\n\
|
||||
cmp r7, 0x1\n\
|
||||
ble _080347D6\n\
|
||||
mov r1, r9\n\
|
||||
cmp r1, 0x5\n\
|
||||
bne _08034818\n\
|
||||
movs r2, 0x90\n\
|
||||
lsls r2, 1\n\
|
||||
adds r5, r2\n\
|
||||
_08034818:\n\
|
||||
movs r7, 0\n\
|
||||
cmp r7, r9\n\
|
||||
bge _080348AE\n\
|
||||
_0803481E:\n\
|
||||
movs r3, 0\n\
|
||||
adds r7, 0x1\n\
|
||||
mov r8, r7\n\
|
||||
cmp r3, r9\n\
|
||||
bge _0803488E\n\
|
||||
_08034828:\n\
|
||||
adds r3, 0x1\n\
|
||||
mov r10, r3\n\
|
||||
ldr r4, [sp, 0x4]\n\
|
||||
adds r4, 0x20\n\
|
||||
adds r7, r5, 0\n\
|
||||
adds r7, 0x20\n\
|
||||
movs r0, 0x12\n\
|
||||
adds r0, r5\n\
|
||||
mov r12, r0\n\
|
||||
ldr r2, [sp, 0x4]\n\
|
||||
adds r3, r5, 0\n\
|
||||
movs r6, 0x3\n\
|
||||
_08034840:\n\
|
||||
ldrb r0, [r2]\n\
|
||||
mov r1, r12\n\
|
||||
strb r0, [r1]\n\
|
||||
ldrb r0, [r2, 0x1]\n\
|
||||
strb r0, [r1, 0x1]\n\
|
||||
ldrb r0, [r2, 0x2]\n\
|
||||
strb r0, [r1, 0x1E]\n\
|
||||
ldrb r0, [r2, 0x3]\n\
|
||||
strb r0, [r1, 0x1F]\n\
|
||||
movs r0, 0x81\n\
|
||||
lsls r0, 1\n\
|
||||
adds r1, r3, r0\n\
|
||||
ldrb r0, [r2, 0x10]\n\
|
||||
strb r0, [r1]\n\
|
||||
ldr r0, =0x00000103\n\
|
||||
adds r1, r3, r0\n\
|
||||
ldrb r0, [r2, 0x11]\n\
|
||||
strb r0, [r1]\n\
|
||||
movs r0, 0x90\n\
|
||||
lsls r0, 1\n\
|
||||
adds r1, r3, r0\n\
|
||||
ldrb r0, [r2, 0x12]\n\
|
||||
strb r0, [r1]\n\
|
||||
ldr r0, =0x00000121\n\
|
||||
adds r1, r3, r0\n\
|
||||
ldrb r0, [r2, 0x13]\n\
|
||||
strb r0, [r1]\n\
|
||||
movs r1, 0x4\n\
|
||||
add r12, r1\n\
|
||||
adds r2, 0x4\n\
|
||||
adds r3, 0x4\n\
|
||||
subs r6, 0x1\n\
|
||||
cmp r6, 0\n\
|
||||
bge _08034840\n\
|
||||
str r4, [sp, 0x4]\n\
|
||||
adds r5, r7, 0\n\
|
||||
mov r3, r10\n\
|
||||
cmp r3, r9\n\
|
||||
blt _08034828\n\
|
||||
_0803488E:\n\
|
||||
mov r2, r9\n\
|
||||
cmp r2, 0x7\n\
|
||||
bne _080348A0\n\
|
||||
adds r5, 0x20\n\
|
||||
b _080348A8\n\
|
||||
.pool\n\
|
||||
_080348A0:\n\
|
||||
mov r4, r9\n\
|
||||
cmp r4, 0x5\n\
|
||||
bne _080348A8\n\
|
||||
adds r5, 0x60\n\
|
||||
_080348A8:\n\
|
||||
mov r7, r8\n\
|
||||
cmp r7, r9\n\
|
||||
blt _0803481E\n\
|
||||
_080348AE:\n\
|
||||
mov r0, r9\n\
|
||||
cmp r0, 0x7\n\
|
||||
bne _080348BC\n\
|
||||
movs r1, 0x80\n\
|
||||
lsls r1, 1\n\
|
||||
adds r5, r1\n\
|
||||
b _080348C8\n\
|
||||
_080348BC:\n\
|
||||
mov r2, r9\n\
|
||||
cmp r2, 0x5\n\
|
||||
bne _080348C8\n\
|
||||
movs r4, 0xF0\n\
|
||||
lsls r4, 1\n\
|
||||
adds r5, r4\n\
|
||||
_080348C8:\n\
|
||||
ldr r0, [sp, 0x14]\n\
|
||||
ldr r1, [sp]\n\
|
||||
cmp r0, r1\n\
|
||||
bge _080348D2\n\
|
||||
b _08034756\n\
|
||||
_080348D2:\n\
|
||||
b _08034964\n\
|
||||
_080348D4:\n\
|
||||
movs r6, 0\n\
|
||||
ldr r2, [sp]\n\
|
||||
cmp r6, r2\n\
|
||||
bge _08034964\n\
|
||||
_080348DC:\n\
|
||||
adds r6, 0x1\n\
|
||||
mov r10, r6\n\
|
||||
mov r4, r9\n\
|
||||
cmp r4, 0x6\n\
|
||||
bne _080348F4\n\
|
||||
movs r0, 0\n\
|
||||
movs r3, 0xFF\n\
|
||||
_080348EA:\n\
|
||||
strb r0, [r5]\n\
|
||||
adds r5, 0x1\n\
|
||||
subs r3, 0x1\n\
|
||||
cmp r3, 0\n\
|
||||
bge _080348EA\n\
|
||||
_080348F4:\n\
|
||||
movs r7, 0\n\
|
||||
cmp r7, r9\n\
|
||||
bge _08034948\n\
|
||||
_080348FA:\n\
|
||||
adds r7, 0x1\n\
|
||||
mov r8, r7\n\
|
||||
mov r1, r9\n\
|
||||
lsls r0, r1, 5\n\
|
||||
cmp r1, 0x6\n\
|
||||
bne _08034914\n\
|
||||
movs r1, 0\n\
|
||||
movs r3, 0x1F\n\
|
||||
_0803490A:\n\
|
||||
strb r1, [r5]\n\
|
||||
adds r5, 0x1\n\
|
||||
subs r3, 0x1\n\
|
||||
cmp r3, 0\n\
|
||||
bge _0803490A\n\
|
||||
_08034914:\n\
|
||||
adds r1, r0, 0\n\
|
||||
cmp r1, 0\n\
|
||||
ble _0803492E\n\
|
||||
adds r3, r1, 0\n\
|
||||
_0803491C:\n\
|
||||
ldr r2, [sp, 0x4]\n\
|
||||
ldrb r0, [r2]\n\
|
||||
strb r0, [r5]\n\
|
||||
adds r2, 0x1\n\
|
||||
str r2, [sp, 0x4]\n\
|
||||
adds r5, 0x1\n\
|
||||
subs r3, 0x1\n\
|
||||
cmp r3, 0\n\
|
||||
bne _0803491C\n\
|
||||
_0803492E:\n\
|
||||
mov r4, r9\n\
|
||||
cmp r4, 0x6\n\
|
||||
bne _08034942\n\
|
||||
movs r0, 0\n\
|
||||
movs r3, 0x1F\n\
|
||||
_08034938:\n\
|
||||
strb r0, [r5]\n\
|
||||
adds r5, 0x1\n\
|
||||
subs r3, 0x1\n\
|
||||
cmp r3, 0\n\
|
||||
bge _08034938\n\
|
||||
_08034942:\n\
|
||||
mov r7, r8\n\
|
||||
cmp r7, r9\n\
|
||||
blt _080348FA\n\
|
||||
_08034948:\n\
|
||||
mov r0, r9\n\
|
||||
cmp r0, 0x6\n\
|
||||
bne _0803495C\n\
|
||||
movs r0, 0\n\
|
||||
movs r3, 0xFF\n\
|
||||
_08034952:\n\
|
||||
strb r0, [r5]\n\
|
||||
adds r5, 0x1\n\
|
||||
subs r3, 0x1\n\
|
||||
cmp r3, 0\n\
|
||||
bge _08034952\n\
|
||||
_0803495C:\n\
|
||||
mov r6, r10\n\
|
||||
ldr r1, [sp]\n\
|
||||
cmp r6, r1\n\
|
||||
blt _080348DC\n\
|
||||
_08034964:\n\
|
||||
add sp, 0x24\n\
|
||||
pop {r3-r5}\n\
|
||||
mov r8, r3\n\
|
||||
mov r9, r4\n\
|
||||
mov r10, r5\n\
|
||||
pop {r4-r7}\n\
|
||||
pop {r0}\n\
|
||||
bx r0\n\
|
||||
.syntax divided");
|
||||
/*
|
||||
This function appears to emulate behaviour found in the GB(C) versions regarding how the Pokemon images
|
||||
are stitched together to be displayed on the battle screen.
|
||||
Given "compacted" tiles, an object count and a bounding box/object size, place the tiles in such a way
|
||||
that the result will have each object centered in a 8x8 tile canvas.
|
||||
*/
|
||||
s32 i, j, k, l;
|
||||
u8 *src = src_tiles, *dest = dest_tiles;
|
||||
u8 bottom_off;
|
||||
|
||||
if (object_size & 1)
|
||||
{
|
||||
// Object size is odd
|
||||
bottom_off = (object_size >> 1) + 4;
|
||||
for (l = 0; l < object_count; l++)
|
||||
{
|
||||
// Clear all unused rows of tiles plus the half-tile required due to centering
|
||||
for (j = 0; j < 8-object_size; j++)
|
||||
{
|
||||
for (k = 0; k < 8; k++)
|
||||
{
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
if (j % 2 == 0)
|
||||
{
|
||||
// Clear top half of top tile and bottom half of bottom tile when on even j
|
||||
((dest+i) + (k << 5))[((j >> 1) << 8)] = 0;
|
||||
((bottom_off << 8) + (dest+i) + (k << 5) + 16)[((j >> 1) << 8)] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Clear bottom half of top tile and top half of tile following bottom tile when on odd j
|
||||
((dest+i) + (k << 5) + 16)[((j >> 1) << 8)] = 0;
|
||||
((bottom_off << 8) + (dest+i) + (k << 5) + 256)[((j >> 1) << 8)] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the columns to the left and right that wont be used completely
|
||||
// Unlike the previous loops, this will clear the later used space as well
|
||||
for (j = 0; j < 2; j++)
|
||||
{
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
for (k = 0; k < 32; k++)
|
||||
{
|
||||
// Left side
|
||||
((dest+k) + (i << 8))[(j << 5)] = 0;
|
||||
// Right side
|
||||
((dest+k) + (i << 8))[(j << 5)+192] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Skip the top row and first tile on the second row for objects of size 5
|
||||
if (object_size == 5) dest += 0x120;
|
||||
|
||||
// Copy tile data
|
||||
for (j = 0; j < object_size; j++)
|
||||
{
|
||||
for (k = 0; k < object_size; k++)
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
// Offset the tile by +4px in both x and y directions
|
||||
(dest + (i << 2))[18] = (src + (i << 2))[0];
|
||||
(dest + (i << 2))[19] = (src + (i << 2))[1];
|
||||
(dest + (i << 2))[48] = (src + (i << 2))[2];
|
||||
(dest + (i << 2))[49] = (src + (i << 2))[3];
|
||||
|
||||
(dest + (i << 2))[258] = (src + (i << 2))[16];
|
||||
(dest + (i << 2))[259] = (src + (i << 2))[17];
|
||||
(dest + (i << 2))[288] = (src + (i << 2))[18];
|
||||
(dest + (i << 2))[289] = (src + (i << 2))[19];
|
||||
}
|
||||
src += 32;
|
||||
dest += 32;
|
||||
}
|
||||
|
||||
// At the end of a row, skip enough tiles to get to the beginning of the next row
|
||||
if (object_size == 7) dest += 0x20;
|
||||
else if (object_size == 5) dest += 0x60;
|
||||
}
|
||||
|
||||
// Skip remaining unused space to go to the beginning of the next object
|
||||
if (object_size == 7) dest += 0x100;
|
||||
else if (object_size == 5) dest += 0x1e0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Object size is even
|
||||
for (i = 0; i < object_count; i++)
|
||||
{
|
||||
// For objects of size 6, the first and last row and column will be cleared
|
||||
// While the remaining space will be filled with actual data
|
||||
if (object_size == 6)
|
||||
{
|
||||
for (k = 0; k < 256; k++) {
|
||||
*dest = 0;
|
||||
dest++;
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < object_size; j++)
|
||||
{
|
||||
if (object_size == 6)
|
||||
{
|
||||
for (k = 0; k < 32; k++) {
|
||||
*dest = 0;
|
||||
dest++;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy tile data
|
||||
for (k = 0; k < 32 * object_size; k++) {
|
||||
*dest = *src;
|
||||
src++;
|
||||
dest++;
|
||||
}
|
||||
|
||||
if (object_size == 6)
|
||||
{
|
||||
for (k = 0; k < 32; k++) {
|
||||
*dest = 0;
|
||||
dest++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (object_size == 6)
|
||||
{
|
||||
for (k = 0; k < 256; k++) {
|
||||
*dest = 0;
|
||||
dest++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u32 GetDecompressedDataSize(const u32 *ptr)
|
||||
|
@ -2794,7 +2794,7 @@ static bool8 sub_811BFA4(void)
|
||||
DeactivateAllTextPrinters();
|
||||
sub_811CF64();
|
||||
sub_811CF04();
|
||||
CpuFastFill(0, (void *)VRAM + 0x1000000, 0x400);
|
||||
CpuFastFill(0, (void *)OAM, OAM_SIZE);
|
||||
break;
|
||||
case 1:
|
||||
DecompressAndLoadBgGfxUsingHeap(3, gEasyChatWindow_Gfx, 0, 0, 0);
|
||||
@ -2828,8 +2828,12 @@ static bool8 sub_811BFA4(void)
|
||||
else
|
||||
{
|
||||
sub_811DE5C(0, 0, 0, 0);
|
||||
SetGpuReg(REG_OFFSET_WININ, WIN_RANGE(0, 63));
|
||||
SetGpuReg(REG_OFFSET_WINOUT, WIN_RANGE(0, 59));
|
||||
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR);
|
||||
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0
|
||||
| WINOUT_WIN01_BG1
|
||||
| WINOUT_WIN01_BG3
|
||||
| WINOUT_WIN01_OBJ
|
||||
| WINOUT_WIN01_CLR);
|
||||
ShowBg(3);
|
||||
ShowBg(1);
|
||||
ShowBg(2);
|
||||
|
@ -293,7 +293,7 @@ static const s16 sEggShardVelocities[][2] =
|
||||
|
||||
// code
|
||||
|
||||
static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
|
||||
static void CreateHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
|
||||
{
|
||||
u16 species;
|
||||
u32 personality, pokerus;
|
||||
@ -357,7 +357,7 @@ static void AddHatchedMonToParty(u8 id)
|
||||
u8 mapNameID;
|
||||
struct Pokemon* mon = &gPlayerParty[id];
|
||||
|
||||
CreatedHatchedMon(mon, &gEnemyParty[0]);
|
||||
CreateHatchedMon(mon, &gEnemyParty[0]);
|
||||
SetMonData(mon, MON_DATA_IS_EGG, &isEgg);
|
||||
|
||||
pokeNum = GetMonData(mon, MON_DATA_SPECIES);
|
||||
|
@ -1448,7 +1448,7 @@ u8 SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8 l
|
||||
y -= 7;
|
||||
objectEventTemplate.localId = localId;
|
||||
objectEventTemplate.graphicsId = graphicsId;
|
||||
objectEventTemplate.unk2 = 0;
|
||||
objectEventTemplate.inConnection = 0;
|
||||
objectEventTemplate.x = x;
|
||||
objectEventTemplate.y = y;
|
||||
objectEventTemplate.elevation = z;
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "rtc.h"
|
||||
#include "script.h"
|
||||
#include "script_menu.h"
|
||||
#include "slot_machine.h"
|
||||
#include "sound.h"
|
||||
#include "starter_choose.h"
|
||||
#include "string_util.h"
|
||||
@ -59,6 +58,7 @@
|
||||
#include "constants/mevent.h"
|
||||
#include "constants/tv.h"
|
||||
#include "constants/script_menu.h"
|
||||
#include "constants/slot_machine.h"
|
||||
#include "constants/songs.h"
|
||||
#include "constants/species.h"
|
||||
#include "constants/moves.h"
|
||||
|
@ -1016,16 +1016,16 @@ static void Task_DoFadeEffect(u8 taskId)
|
||||
if (!data[0])
|
||||
{
|
||||
sub_80C5F58(TRUE, FALSE);
|
||||
data[1] = 0x100;
|
||||
data[2] = 0x100;
|
||||
data[1] = Q_8_8(1);
|
||||
data[2] = Q_8_8(1);
|
||||
data[3] = 0x15;
|
||||
data[4] = 0x15;
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_WHITE);
|
||||
}
|
||||
else
|
||||
{
|
||||
data[1] = 0x1FC;
|
||||
data[2] = 0x1FC;
|
||||
data[1] = Q_8_8(1.984375); // 1 and 63/64
|
||||
data[2] = Q_8_8(1.984375);
|
||||
data[3] = -0x15;
|
||||
data[4] = -0x15;
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
|
||||
@ -1038,23 +1038,23 @@ static void Task_DoFadeEffect(u8 taskId)
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_WHITE);
|
||||
}
|
||||
sPassGfx->setAffine = TRUE;
|
||||
sPassGfx->unk2E = sub_8151624(data[1]);
|
||||
sPassGfx->unk30 = sub_8151624(data[2]);
|
||||
sPassGfx->unk2E = MathUtil_Inv16(data[1]);
|
||||
sPassGfx->unk30 = MathUtil_Inv16(data[2]);
|
||||
break;
|
||||
case 1:
|
||||
UpdatePaletteFade();
|
||||
data[1] += data[3];
|
||||
data[2] += data[4];
|
||||
sPassGfx->unk2E = sub_8151624(data[1]);
|
||||
sPassGfx->unk30 = sub_8151624(data[2]);
|
||||
sPassGfx->unk2E = MathUtil_Inv16(data[1]);
|
||||
sPassGfx->unk30 = MathUtil_Inv16(data[2]);
|
||||
if (!data[0])
|
||||
{
|
||||
if (data[1] <= 0x1FC)
|
||||
if (data[1] <= Q_8_8(1.984375))
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (data[1] != 0x100)
|
||||
if (data[1] != Q_8_8(1))
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@ -1154,8 +1154,8 @@ static void sub_80C5F58(bool8 arg0, bool8 arg1)
|
||||
gUnknown_085713E0[sPassData->unkE - 1][1] << 8,
|
||||
gUnknown_085713E0[sPassData->unkE - 1][0],
|
||||
gUnknown_085713E0[sPassData->unkE - 1][1],
|
||||
sub_8151624(0x1FC),
|
||||
sub_8151624(0x1FC),
|
||||
MathUtil_Inv16(Q_8_8(1.984375)), // 1 and 63/64
|
||||
MathUtil_Inv16(Q_8_8(1.984375)),
|
||||
0);
|
||||
}
|
||||
else
|
||||
@ -1165,8 +1165,8 @@ static void sub_80C5F58(bool8 arg0, bool8 arg1)
|
||||
gUnknown_085713E0[sPassData->unkE - 1][1] << 8,
|
||||
gUnknown_085713E0[sPassData->unkE - 1][0],
|
||||
gUnknown_085713E0[sPassData->unkE - 1][1],
|
||||
sub_8151624(0x100),
|
||||
sub_8151624(0x100),
|
||||
MathUtil_Inv16(Q_8_8(1)),
|
||||
MathUtil_Inv16(Q_8_8(1)),
|
||||
0);
|
||||
}
|
||||
}
|
||||
|
@ -671,16 +671,16 @@ const u16 gBattleInterface_BallStatusBarPal[] = INCBIN_U16("graphics/battle_inte
|
||||
const u16 gBattleInterface_BallDisplayPal[] = INCBIN_U16("graphics/battle_interface/ball_display.gbapal");
|
||||
|
||||
//Originally an array?
|
||||
const u8 gHealthboxElementsGfxTable[] = INCBIN_U8("graphics/battle_interface/hpbar.4bpp");
|
||||
const u8 gHealthboxElementsGfxTable_ExpBar[] = INCBIN_U8("graphics/battle_interface/expbar.4bpp");
|
||||
const u8 gHealthboxElementsGfxTable_StatusPsn[] = INCBIN_U8("graphics/battle_interface/status_psn.4bpp");
|
||||
const u8 gHealthboxElementsGfxTable_StatusPar[] = INCBIN_U8("graphics/battle_interface/status_par.4bpp");
|
||||
const u8 gHealthboxElementsGfxTable_StatusSlp[] = INCBIN_U8("graphics/battle_interface/status_slp.4bpp");
|
||||
const u8 gHealthboxElementsGfxTable_StatusFrz[] = INCBIN_U8("graphics/battle_interface/status_frz.4bpp");
|
||||
const u8 gHealthboxElementsGfxTable_StatusBrn[] = INCBIN_U8("graphics/battle_interface/status_brn.4bpp");
|
||||
const u8 gHealthboxElementsGfxTable_Misc[] = INCBIN_U8("graphics/battle_interface/misc.4bpp");
|
||||
const u8 gHealthboxElementsGfxTable_HpBarAnim[] = INCBIN_U8("graphics/battle_interface/hpbar_anim.4bpp");
|
||||
const u8 gHealthboxElementsGfxTable_MiscFrameEnd[] = INCBIN_U8("graphics/battle_interface/misc_frameend.4bpp");
|
||||
const u8 gHealthboxElementsGfxTable[] = INCBIN_U8("graphics/battle_interface/hpbar.4bpp",
|
||||
"graphics/battle_interface/expbar.4bpp",
|
||||
"graphics/battle_interface/status_psn.4bpp",
|
||||
"graphics/battle_interface/status_par.4bpp",
|
||||
"graphics/battle_interface/status_slp.4bpp",
|
||||
"graphics/battle_interface/status_frz.4bpp",
|
||||
"graphics/battle_interface/status_brn.4bpp",
|
||||
"graphics/battle_interface/misc.4bpp",
|
||||
"graphics/battle_interface/hpbar_anim.4bpp",
|
||||
"graphics/battle_interface/misc_frameend.4bpp");
|
||||
|
||||
const u8 gBattleInterface_BallDisplayGfx[] = INCBIN_U8("graphics/battle_interface/ball_display.4bpp");
|
||||
|
||||
@ -1660,13 +1660,12 @@ const u32 gStatusPal_Icons[] = INCBIN_U32("graphics/interface/status_icons.gbapa
|
||||
const u32 gMoveTypes_Gfx[] = INCBIN_U32("graphics/types/move_types.4bpp.lz");
|
||||
const u32 gMoveTypes_Pal[] = INCBIN_U32("graphics/types/move_types.gbapal.lz");
|
||||
|
||||
const u32 gMoveSelectorBitmap[] = INCBIN_U32("graphics/interface/summary_frames.4bpp.lz");
|
||||
const u32 gUnknown_08D97CF4[] = INCBIN_U32("graphics/interface/summary_frames.gbapal.lz");
|
||||
const u32 gSummaryMoveSelect_Gfx[] = INCBIN_U32("graphics/interface/summary_frames.4bpp.lz");
|
||||
const u32 gSummaryMoveSelect_Pal[] = INCBIN_U32("graphics/interface/summary_frames.gbapal.lz");
|
||||
|
||||
const u32 gStatusScreenBitmap[] = INCBIN_U32("graphics/interface/status_screen.4bpp.lz");
|
||||
const u32 gStatusScreenPalette[] = INCBIN_U32("graphics/interface/status_screen.gbapal.lz");
|
||||
const u32 gPageInfoTilemap[] = INCBIN_U32("graphics/interface/status_screen.bin.lz");
|
||||
|
||||
const u32 gPageSkillsTilemap[] = INCBIN_U32("graphics/interface/status_tilemap1.bin.lz");
|
||||
const u32 gPageBattleMovesTilemap[] = INCBIN_U32("graphics/interface/status_tilemap2.bin.lz");
|
||||
const u32 gPageContestMovesTilemap[] = INCBIN_U32("graphics/interface/status_tilemap3.bin.lz");
|
||||
@ -1796,9 +1795,7 @@ const u32 gPokedexSearchMenuNational_Tilemap[] = INCBIN_U32("graphics/pokedex/se
|
||||
const u32 gPokedexSearchMenuHoenn_Tilemap[] = INCBIN_U32("graphics/pokedex/search_menu_hoenn.bin.lz");
|
||||
|
||||
const u16 gSummaryScreenPowAcc_Tilemap[] = INCBIN_U16("graphics/interface/powacc_tilemap.bin");
|
||||
|
||||
const u16 gUnknown_08DC3C34[] = INCBIN_U16("graphics/interface/unk_tilemap.bin"); // probably trade summary screen related?
|
||||
|
||||
const u16 gSummaryScreenAppealJam_Tilemap[] = INCBIN_U16("graphics/interface/appealjam_tilemap.bin");
|
||||
const u16 gSummaryScreenWindow_Tilemap[] = INCBIN_U16("graphics/interface/summary.bin");
|
||||
|
||||
const u16 gIntroCopyright_Pal[] = INCBIN_U16("graphics/intro/copyright.gbapal");
|
||||
@ -2060,8 +2057,8 @@ const u16 gMonIconPalettes[][16] =
|
||||
INCBIN_U16("graphics/pokemon/icon_palettes/icon_palette_2.gbapal"),
|
||||
};
|
||||
|
||||
const u16 gTitleScreenBgPalettes[] = INCBIN_U16("graphics/title_screen/pokemon_logo.gbapal");
|
||||
const u16 gTitleScreenBgPalettes2[] = INCBIN_U16("graphics/title_screen/rayquaza_and_clouds.gbapal");
|
||||
const u16 gTitleScreenBgPalettes[] = INCBIN_U16("graphics/title_screen/pokemon_logo.gbapal",
|
||||
"graphics/title_screen/rayquaza_and_clouds.gbapal");
|
||||
|
||||
const u16 gTitleScreenEmeraldVersionPal[] = INCBIN_U16("graphics/title_screen/emerald_version.gbapal");
|
||||
|
||||
|
11
src/main.c
11
src/main.c
@ -75,7 +75,7 @@ static EWRAM_DATA u16 gTrainerId = 0;
|
||||
static void UpdateLinkAndCallCallbacks(void);
|
||||
static void InitMainCallbacks(void);
|
||||
static void CallCallbacks(void);
|
||||
static void SeedRngWithRtc(void);
|
||||
//static void SeedRngWithRtc(void);
|
||||
static void ReadKeys(void);
|
||||
void InitIntrHandlers(void);
|
||||
static void WaitForVBlank(void);
|
||||
@ -118,6 +118,7 @@ void AgbMain()
|
||||
CheckForFlashMemory();
|
||||
InitMainCallbacks();
|
||||
InitMapMusic();
|
||||
//SeedRngWithRtc(); see comment at SeedRngWithRtc declaration below
|
||||
ClearDma3Requests();
|
||||
ResetBgs();
|
||||
SetDefaultFontsPointer();
|
||||
@ -228,6 +229,14 @@ void EnableVCountIntrAtLine150(void)
|
||||
EnableInterrupts(INTR_FLAG_VCOUNT);
|
||||
}
|
||||
|
||||
// oops! FRLG commented this out to remove RTC, however Emerald didnt undo this!
|
||||
//static void SeedRngWithRtc(void)
|
||||
//{
|
||||
// u32 seed = RtcGetMinuteCount();
|
||||
// seed = (seed >> 16) ^ (seed & 0xFFFF);
|
||||
// SeedRng(seed);
|
||||
//}
|
||||
|
||||
void InitKeys(void)
|
||||
{
|
||||
gKeyRepeatContinueDelay = 5;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
|
||||
s16 sub_8151534(s16 x, s16 y)
|
||||
s16 MathUtil_Mul16(s16 x, s16 y)
|
||||
{
|
||||
s32 result;
|
||||
|
||||
@ -10,7 +10,7 @@ s16 sub_8151534(s16 x, s16 y)
|
||||
return result;
|
||||
}
|
||||
|
||||
s16 sub_8151550(u8 s, s16 x, s16 y)
|
||||
s16 MathUtil_Mul16Shift(u8 s, s16 x, s16 y)
|
||||
{
|
||||
s32 result;
|
||||
|
||||
@ -20,7 +20,7 @@ s16 sub_8151550(u8 s, s16 x, s16 y)
|
||||
return result;
|
||||
}
|
||||
|
||||
s32 sub_8151574(s32 x, s32 y)
|
||||
s32 MathUtil_Mul32(s32 x, s32 y)
|
||||
{
|
||||
s64 result;
|
||||
|
||||
@ -30,7 +30,7 @@ s32 sub_8151574(s32 x, s32 y)
|
||||
return result;
|
||||
}
|
||||
|
||||
s16 sub_81515B0(s16 x, s16 y)
|
||||
s16 MathUtil_Div16(s16 x, s16 y)
|
||||
{
|
||||
if (y == 0)
|
||||
{
|
||||
@ -39,7 +39,7 @@ s16 sub_81515B0(s16 x, s16 y)
|
||||
return (x << 8) / y;
|
||||
}
|
||||
|
||||
s16 sub_81515D4(u8 s, s16 x, s16 y)
|
||||
s16 MathUtil_Div16Shift(u8 s, s16 x, s16 y)
|
||||
{
|
||||
if (y == 0)
|
||||
{
|
||||
@ -48,7 +48,7 @@ s16 sub_81515D4(u8 s, s16 x, s16 y)
|
||||
return (x << s) / y;
|
||||
}
|
||||
|
||||
s32 sub_81515FC(s32 x, s32 y)
|
||||
s32 MathUtil_Div32(s32 x, s32 y)
|
||||
{
|
||||
s64 _x;
|
||||
|
||||
@ -61,7 +61,7 @@ s32 sub_81515FC(s32 x, s32 y)
|
||||
return _x / y;
|
||||
}
|
||||
|
||||
s16 sub_8151624(s16 y)
|
||||
s16 MathUtil_Inv16(s16 y)
|
||||
{
|
||||
s32 x;
|
||||
|
||||
@ -69,7 +69,7 @@ s16 sub_8151624(s16 y)
|
||||
return x / y;
|
||||
}
|
||||
|
||||
s16 sub_815163C(u8 s, s16 y)
|
||||
s16 MathUtil_Inv16Shift(u8 s, s16 y)
|
||||
{
|
||||
s32 x;
|
||||
|
||||
@ -77,7 +77,7 @@ s16 sub_815163C(u8 s, s16 y)
|
||||
return x / y;
|
||||
}
|
||||
|
||||
s32 sub_815165C(s32 y)
|
||||
s32 MathUtil_Inv32(s32 y)
|
||||
{
|
||||
s64 x;
|
||||
|
||||
|
@ -484,11 +484,15 @@ static void sub_801B7D8(u32 command)
|
||||
}
|
||||
|
||||
if (dest == NULL)
|
||||
{
|
||||
AGB_ASSERT(0);
|
||||
}
|
||||
else if (++(*dest) > 999)
|
||||
{
|
||||
*dest = 999;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u16 mevent_081445C0(u32 command)
|
||||
{
|
||||
|
@ -1136,7 +1136,7 @@ void task_add_00_mystery_gift(void)
|
||||
void task00_mystery_gift(u8 taskId)
|
||||
{
|
||||
struct MysteryGiftTaskData *data = (void *)gTasks[taskId].data;
|
||||
u32 sp0;
|
||||
u32 sp0, flag;
|
||||
const u8 *r1;
|
||||
|
||||
switch (data->state)
|
||||
@ -1233,12 +1233,10 @@ void task00_mystery_gift(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
register u8 eos asm("r1");
|
||||
gStringVar1[0] = (eos = EOS);
|
||||
gStringVar2[0] = eos;
|
||||
gStringVar3[0] = eos;
|
||||
}
|
||||
*gStringVar1 = EOS;
|
||||
*gStringVar2 = EOS;
|
||||
*gStringVar3 = EOS;
|
||||
|
||||
switch (data->IsCardOrNews)
|
||||
{
|
||||
case 0:
|
||||
@ -1306,7 +1304,8 @@ void task00_mystery_gift(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
switch ((u32)mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, mevent_client_get_buffer()))
|
||||
flag = mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, mevent_client_get_buffer());
|
||||
switch (flag)
|
||||
{
|
||||
case 0:
|
||||
mevent_client_set_param(0);
|
||||
@ -1333,7 +1332,8 @@ void task00_mystery_gift(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
switch ((u32)mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, gText_ThrowAwayWonderCard))
|
||||
flag = mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, gText_ThrowAwayWonderCard);
|
||||
switch (flag)
|
||||
{
|
||||
case 0:
|
||||
if (CheckReceivedGiftFromWonderCard() == TRUE)
|
||||
@ -1360,7 +1360,8 @@ void task00_mystery_gift(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
switch ((u32)mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, gText_HaventReceivedCardsGift))
|
||||
flag = mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, gText_HaventReceivedCardsGift);
|
||||
switch (flag)
|
||||
{
|
||||
case 0:
|
||||
mevent_client_set_param(0);
|
||||
@ -1397,8 +1398,6 @@ void task00_mystery_gift(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
{
|
||||
register bool32 flag asm("r1");
|
||||
r1 = mevent_message(&sp0, data->IsCardOrNews, data->source, data->prevPromptWindowId);
|
||||
if (r1 == NULL)
|
||||
{
|
||||
@ -1425,7 +1424,7 @@ void task00_mystery_gift(u8 taskId)
|
||||
GenerateRandomNews(2);
|
||||
}
|
||||
}
|
||||
if (sp0 == 0)
|
||||
if (!sp0)
|
||||
{
|
||||
data->state = 0;
|
||||
PrintMysteryGiftOrEReaderTopMenu(0, 0);
|
||||
@ -1436,7 +1435,6 @@ void task00_mystery_gift(u8 taskId)
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, gText_CommunicationError))
|
||||
{
|
||||
@ -1624,12 +1622,10 @@ void task00_mystery_gift(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 31:
|
||||
{
|
||||
register u8 eos asm("r1");
|
||||
gStringVar1[0] = (eos = EOS);
|
||||
gStringVar2[0] = eos;
|
||||
gStringVar3[0] = eos;
|
||||
}
|
||||
*gStringVar1 = EOS;
|
||||
*gStringVar2 = EOS;
|
||||
*gStringVar3 = EOS;
|
||||
|
||||
if (data->IsCardOrNews == 0)
|
||||
{
|
||||
AddTextPrinterToWindow1(gText_SendingWonderCard);
|
||||
|
@ -2708,7 +2708,7 @@ static void CB2_ShowPokemonSummaryScreen(void)
|
||||
if (gPartyMenu.menuType == PARTY_MENU_TYPE_IN_BATTLE)
|
||||
{
|
||||
UpdatePartyToBattleOrder();
|
||||
ShowPokemonSummaryScreen(PSS_MODE_UNK1, gPlayerParty, gPartyMenu.slotId, gPlayerPartyCount - 1, CB2_ReturnToPartyMenuFromSummaryScreen);
|
||||
ShowPokemonSummaryScreen(PSS_MODE_LOCK_MOVES, gPlayerParty, gPartyMenu.slotId, gPlayerPartyCount - 1, CB2_ReturnToPartyMenuFromSummaryScreen);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -666,10 +666,12 @@ static const union AnimCmd *const sSpriteAnimTable_DexListStartMenuCursor[] =
|
||||
sSpriteAnim_DexListStartMenuCursor
|
||||
};
|
||||
|
||||
#define TAG_DEX_INTERFACE 4096 // Tile and pal tag used for all interface sprites.
|
||||
|
||||
static const struct SpriteTemplate sScrollBarSpriteTemplate =
|
||||
{
|
||||
.tileTag = 4096,
|
||||
.paletteTag = 4096,
|
||||
.tileTag = TAG_DEX_INTERFACE,
|
||||
.paletteTag = TAG_DEX_INTERFACE,
|
||||
.oam = &sOamData_ScrollBar,
|
||||
.anims = sSpriteAnimTable_ScrollBar,
|
||||
.images = NULL,
|
||||
@ -679,8 +681,8 @@ static const struct SpriteTemplate sScrollBarSpriteTemplate =
|
||||
|
||||
static const struct SpriteTemplate sScrollArrowSpriteTemplate =
|
||||
{
|
||||
.tileTag = 4096,
|
||||
.paletteTag = 4096,
|
||||
.tileTag = TAG_DEX_INTERFACE,
|
||||
.paletteTag = TAG_DEX_INTERFACE,
|
||||
.oam = &sOamData_ScrollArrow,
|
||||
.anims = sSpriteAnimTable_ScrollArrow,
|
||||
.images = NULL,
|
||||
@ -690,8 +692,8 @@ static const struct SpriteTemplate sScrollArrowSpriteTemplate =
|
||||
|
||||
static const struct SpriteTemplate sInterfaceTextSpriteTemplate =
|
||||
{
|
||||
.tileTag = 4096,
|
||||
.paletteTag = 4096,
|
||||
.tileTag = TAG_DEX_INTERFACE,
|
||||
.paletteTag = TAG_DEX_INTERFACE,
|
||||
.oam = &sOamData_InterfaceText,
|
||||
.anims = sSpriteAnimTable_InterfaceText,
|
||||
.images = NULL,
|
||||
@ -701,8 +703,8 @@ static const struct SpriteTemplate sInterfaceTextSpriteTemplate =
|
||||
|
||||
static const struct SpriteTemplate sRotatingPokeBallSpriteTemplate =
|
||||
{
|
||||
.tileTag = 4096,
|
||||
.paletteTag = 4096,
|
||||
.tileTag = TAG_DEX_INTERFACE,
|
||||
.paletteTag = TAG_DEX_INTERFACE,
|
||||
.oam = &sOamData_RotatingPokeBall,
|
||||
.anims = sSpriteAnimTable_RotatingPokeBall,
|
||||
.images = NULL,
|
||||
@ -712,8 +714,8 @@ static const struct SpriteTemplate sRotatingPokeBallSpriteTemplate =
|
||||
|
||||
static const struct SpriteTemplate sSeenOwnTextSpriteTemplate =
|
||||
{
|
||||
.tileTag = 4096,
|
||||
.paletteTag = 4096,
|
||||
.tileTag = TAG_DEX_INTERFACE,
|
||||
.paletteTag = TAG_DEX_INTERFACE,
|
||||
.oam = &sOamData_SeenOwnText,
|
||||
.anims = sSpriteAnimTable_SeenOwnText,
|
||||
.images = NULL,
|
||||
@ -723,8 +725,8 @@ static const struct SpriteTemplate sSeenOwnTextSpriteTemplate =
|
||||
|
||||
static const struct SpriteTemplate sHoennNationalTextSpriteTemplate =
|
||||
{
|
||||
.tileTag = 4096,
|
||||
.paletteTag = 4096,
|
||||
.tileTag = TAG_DEX_INTERFACE,
|
||||
.paletteTag = TAG_DEX_INTERFACE,
|
||||
.oam = &sOamData_InterfaceText,
|
||||
.anims = sSpriteAnimTable_HoennNationalText,
|
||||
.images = NULL,
|
||||
@ -734,8 +736,8 @@ static const struct SpriteTemplate sHoennNationalTextSpriteTemplate =
|
||||
|
||||
static const struct SpriteTemplate sHoennDexSeenOwnNumberSpriteTemplate =
|
||||
{
|
||||
.tileTag = 4096,
|
||||
.paletteTag = 4096,
|
||||
.tileTag = TAG_DEX_INTERFACE,
|
||||
.paletteTag = TAG_DEX_INTERFACE,
|
||||
.oam = &sOamData_Dex8x16,
|
||||
.anims = sSpriteAnimTable_HoennSeenOwnNumber,
|
||||
.images = NULL,
|
||||
@ -745,8 +747,8 @@ static const struct SpriteTemplate sHoennDexSeenOwnNumberSpriteTemplate =
|
||||
|
||||
static const struct SpriteTemplate sNationalDexSeenOwnNumberSpriteTemplate =
|
||||
{
|
||||
.tileTag = 4096,
|
||||
.paletteTag = 4096,
|
||||
.tileTag = TAG_DEX_INTERFACE,
|
||||
.paletteTag = TAG_DEX_INTERFACE,
|
||||
.oam = &sOamData_Dex8x16,
|
||||
.anims = sSpriteAnimTable_NationalSeenOwnNumber,
|
||||
.images = NULL,
|
||||
@ -756,8 +758,8 @@ static const struct SpriteTemplate sNationalDexSeenOwnNumberSpriteTemplate =
|
||||
|
||||
static const struct SpriteTemplate sDexListStartMenuCursorSpriteTemplate =
|
||||
{
|
||||
.tileTag = 4096,
|
||||
.paletteTag = 4096,
|
||||
.tileTag = TAG_DEX_INTERFACE,
|
||||
.paletteTag = TAG_DEX_INTERFACE,
|
||||
.oam = &sOamData_Dex8x16,
|
||||
.anims = sSpriteAnimTable_DexListStartMenuCursor,
|
||||
.images = NULL,
|
||||
@ -767,13 +769,13 @@ static const struct SpriteTemplate sDexListStartMenuCursorSpriteTemplate =
|
||||
|
||||
static const struct CompressedSpriteSheet sInterfaceSpriteSheet[] =
|
||||
{
|
||||
{gPokedexInterface_Gfx, 0x2000, 4096},
|
||||
{gPokedexInterface_Gfx, 0x2000, TAG_DEX_INTERFACE},
|
||||
{0}
|
||||
};
|
||||
|
||||
static const struct SpritePalette sInterfaceSpritePalette[] =
|
||||
{
|
||||
{gPokedexBgHoenn_Pal, 4096},
|
||||
{gPokedexBgHoenn_Pal, TAG_DEX_INTERFACE},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
@ -1138,11 +1138,9 @@ static void pokemonanimfunc_04(struct Sprite *sprite)
|
||||
sprite->callback = sub_817F978;
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
static void sub_817F9F4(struct Sprite *sprite)
|
||||
{
|
||||
s32 counter = sprite->data[2];
|
||||
|
||||
if (counter > 384)
|
||||
{
|
||||
sprite->callback = SpriteCB_SetDummyOnAnimEnd;
|
||||
@ -1151,8 +1149,7 @@ static void sub_817F9F4(struct Sprite *sprite)
|
||||
}
|
||||
else
|
||||
{
|
||||
s32 divCounter = counter / 128;
|
||||
|
||||
s16 divCounter = counter / 128;
|
||||
switch (divCounter)
|
||||
{
|
||||
case 0:
|
||||
@ -1161,7 +1158,8 @@ static void sub_817F9F4(struct Sprite *sprite)
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
sprite->pos2.y = -(Sin(counter - 256, sprite->data[0] * 3));
|
||||
counter -= 256;
|
||||
sprite->pos2.y = -(Sin(counter, sprite->data[0] * 3));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1169,77 +1167,6 @@ static void sub_817F9F4(struct Sprite *sprite)
|
||||
sprite->data[2] += 12;
|
||||
}
|
||||
|
||||
#else
|
||||
NAKED
|
||||
static void sub_817F9F4(struct Sprite *sprite)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
push {r4,lr}\n\
|
||||
adds r4, r0, 0\n\
|
||||
movs r0, 0x32\n\
|
||||
ldrsh r1, [r4, r0]\n\
|
||||
movs r0, 0xC0\n\
|
||||
lsls r0, 1\n\
|
||||
cmp r1, r0\n\
|
||||
ble _0817FA14\n\
|
||||
ldr r0, =SpriteCB_SetDummyOnAnimEnd\n\
|
||||
str r0, [r4, 0x1C]\n\
|
||||
movs r0, 0\n\
|
||||
strh r0, [r4, 0x24]\n\
|
||||
b _0817FA5E\n\
|
||||
.pool\n\
|
||||
_0817FA14:\n\
|
||||
adds r0, r1, 0\n\
|
||||
cmp r1, 0\n\
|
||||
bge _0817FA1C\n\
|
||||
adds r0, 0x7F\n\
|
||||
_0817FA1C:\n\
|
||||
asrs r2, r0, 7\n\
|
||||
lsls r0, r2, 16\n\
|
||||
asrs r0, 16\n\
|
||||
cmp r0, 0\n\
|
||||
blt _0817FA60\n\
|
||||
cmp r0, 0x1\n\
|
||||
ble _0817FA48\n\
|
||||
cmp r0, 0x3\n\
|
||||
bgt _0817FA60\n\
|
||||
ldr r2, =0xffffff00\n\
|
||||
adds r1, r2\n\
|
||||
lsls r0, r1, 16\n\
|
||||
asrs r0, 16\n\
|
||||
movs r1, 0x2E\n\
|
||||
ldrsh r2, [r4, r1]\n\
|
||||
lsls r1, r2, 1\n\
|
||||
adds r1, r2\n\
|
||||
lsls r1, 16\n\
|
||||
b _0817FA56\n\
|
||||
.pool\n\
|
||||
_0817FA48:\n\
|
||||
lsls r0, r2, 7\n\
|
||||
subs r0, r1, r0\n\
|
||||
lsls r0, 16\n\
|
||||
asrs r0, 16\n\
|
||||
movs r2, 0x2E\n\
|
||||
ldrsh r1, [r4, r2]\n\
|
||||
lsls r1, 17\n\
|
||||
_0817FA56:\n\
|
||||
asrs r1, 16\n\
|
||||
bl Sin\n\
|
||||
negs r0, r0\n\
|
||||
_0817FA5E:\n\
|
||||
strh r0, [r4, 0x26]\n\
|
||||
_0817FA60:\n\
|
||||
ldrh r0, [r4, 0x32]\n\
|
||||
adds r0, 0xC\n\
|
||||
strh r0, [r4, 0x32]\n\
|
||||
pop {r4}\n\
|
||||
pop {r0}\n\
|
||||
bx r0\n\
|
||||
.syntax divided");
|
||||
}
|
||||
|
||||
#endif // NONMATCHING
|
||||
|
||||
static void pokemonanimfunc_1E(struct Sprite *sprite)
|
||||
{
|
||||
sprite->data[0] = 4;
|
||||
|
@ -6926,21 +6926,20 @@ static u8 HandleInput_InBox(void)
|
||||
}
|
||||
}
|
||||
|
||||
// This group of four functions handling input simply CANNOT be matched.
|
||||
// GF must have written them in a really weird way, a way not a sane person could dream to reproduce.
|
||||
#ifdef NONMATCHING
|
||||
static u8 InBoxInput_Normal(void)
|
||||
{
|
||||
u8 retVal;
|
||||
s8 cursorArea = sBoxCursorArea;
|
||||
s8 cursorPosition = sBoxCursorPosition;
|
||||
s8 cursorArea;
|
||||
s8 cursorPosition;
|
||||
|
||||
do
|
||||
{
|
||||
cursorArea = sBoxCursorArea;
|
||||
cursorPosition = sBoxCursorPosition;
|
||||
sPSSData->field_CD2 = 0;
|
||||
sPSSData->field_CD3 = 0;
|
||||
sPSSData->field_CD7 = 0;
|
||||
|
||||
do
|
||||
{
|
||||
if (gMain.newAndRepeatedKeys & DPAD_UP)
|
||||
{
|
||||
retVal = TRUE;
|
||||
@ -7065,310 +7064,6 @@ static u8 InBoxInput_Normal(void)
|
||||
|
||||
return retVal;
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
static u8 InBoxInput_Normal(void)
|
||||
{
|
||||
asm_unified("\n\
|
||||
push {r4-r7,lr}\n\
|
||||
mov r7, r10\n\
|
||||
mov r6, r9\n\
|
||||
mov r5, r8\n\
|
||||
push {r5-r7}\n\
|
||||
ldr r0, =sBoxCursorArea\n\
|
||||
ldrb r0, [r0]\n\
|
||||
mov r8, r0\n\
|
||||
ldr r2, =sBoxCursorPosition\n\
|
||||
ldrb r4, [r2]\n\
|
||||
ldr r5, =sPSSData\n\
|
||||
ldr r0, [r5]\n\
|
||||
ldr r1, =0x00000cd2\n\
|
||||
mov r10, r1\n\
|
||||
add r0, r10\n\
|
||||
movs r1, 0\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r0, [r5]\n\
|
||||
ldr r7, =0x00000cd3\n\
|
||||
adds r0, r7\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r0, [r5]\n\
|
||||
ldr r3, =0x00000cd7\n\
|
||||
mov r9, r3\n\
|
||||
add r0, r9\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r6, =gMain\n\
|
||||
ldrh r1, [r6, 0x30]\n\
|
||||
movs r0, 0x40\n\
|
||||
ands r0, r1\n\
|
||||
adds r3, r2, 0\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF14C\n\
|
||||
b _080CF33C\n\
|
||||
_080CF14C:\n\
|
||||
movs r0, 0x80\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF1A8\n\
|
||||
movs r6, 0x1\n\
|
||||
lsls r0, r4, 24\n\
|
||||
movs r1, 0xC0\n\
|
||||
lsls r1, 19\n\
|
||||
adds r0, r1\n\
|
||||
lsrs r4, r0, 24\n\
|
||||
asrs r0, 24\n\
|
||||
cmp r0, 0x1D\n\
|
||||
bgt _080CF168\n\
|
||||
b _080CF358\n\
|
||||
_080CF168:\n\
|
||||
movs r2, 0x3\n\
|
||||
mov r8, r2\n\
|
||||
subs r0, 0x1E\n\
|
||||
lsls r0, 24\n\
|
||||
asrs r0, 24\n\
|
||||
movs r1, 0x3\n\
|
||||
bl __divsi3\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r4, r0, 24\n\
|
||||
ldr r0, [r5]\n\
|
||||
add r0, r10\n\
|
||||
strb r6, [r0]\n\
|
||||
ldr r0, [r5]\n\
|
||||
add r0, r9\n\
|
||||
strb r6, [r0]\n\
|
||||
b _080CF358\n\
|
||||
.pool\n\
|
||||
_080CF1A8:\n\
|
||||
movs r0, 0x20\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF1DE\n\
|
||||
movs r6, 0x1\n\
|
||||
movs r0, 0\n\
|
||||
ldrsb r0, [r3, r0]\n\
|
||||
movs r1, 0x6\n\
|
||||
bl __modsi3\n\
|
||||
lsls r0, 24\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF1CA\n\
|
||||
lsls r0, r4, 24\n\
|
||||
movs r3, 0xFF\n\
|
||||
lsls r3, 24\n\
|
||||
b _080CF34C\n\
|
||||
_080CF1CA:\n\
|
||||
ldr r0, [r5]\n\
|
||||
adds r0, r7\n\
|
||||
movs r1, 0xFF\n\
|
||||
strb r1, [r0]\n\
|
||||
lsls r0, r4, 24\n\
|
||||
movs r1, 0xA0\n\
|
||||
lsls r1, 19\n\
|
||||
adds r0, r1\n\
|
||||
lsrs r4, r0, 24\n\
|
||||
b _080CF358\n\
|
||||
_080CF1DE:\n\
|
||||
movs r0, 0x10\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF212\n\
|
||||
movs r6, 0x1\n\
|
||||
movs r0, 0\n\
|
||||
ldrsb r0, [r3, r0]\n\
|
||||
adds r0, 0x1\n\
|
||||
movs r1, 0x6\n\
|
||||
bl __modsi3\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF204\n\
|
||||
lsls r0, r4, 24\n\
|
||||
movs r2, 0x80\n\
|
||||
lsls r2, 17\n\
|
||||
adds r0, r2\n\
|
||||
lsrs r4, r0, 24\n\
|
||||
b _080CF358\n\
|
||||
_080CF204:\n\
|
||||
ldr r0, [r5]\n\
|
||||
adds r0, r7\n\
|
||||
strb r6, [r0]\n\
|
||||
lsls r0, r4, 24\n\
|
||||
movs r3, 0xFB\n\
|
||||
lsls r3, 24\n\
|
||||
b _080CF34C\n\
|
||||
_080CF212:\n\
|
||||
ldrh r1, [r6, 0x2E]\n\
|
||||
movs r0, 0x8\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF220\n\
|
||||
movs r6, 0x1\n\
|
||||
b _080CF352\n\
|
||||
_080CF220:\n\
|
||||
movs r4, 0x1\n\
|
||||
movs r0, 0x1\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF2E4\n\
|
||||
bl sub_80CFA5C\n\
|
||||
lsls r0, 24\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF2E4\n\
|
||||
ldr r0, =sCanOnlyMove\n\
|
||||
ldrb r0, [r0]\n\
|
||||
cmp r0, 0\n\
|
||||
bne _080CF244\n\
|
||||
movs r0, 0x8\n\
|
||||
b _080CF366\n\
|
||||
.pool\n\
|
||||
_080CF244:\n\
|
||||
ldr r1, [r5]\n\
|
||||
ldrb r0, [r1, 0x1]\n\
|
||||
cmp r0, 0x2\n\
|
||||
bne _080CF254\n\
|
||||
ldr r0, =sIsMonBeingMoved\n\
|
||||
ldrb r0, [r0]\n\
|
||||
cmp r0, 0x1\n\
|
||||
bne _080CF2D4\n\
|
||||
_080CF254:\n\
|
||||
movs r0, 0\n\
|
||||
bl sub_80CFF98\n\
|
||||
subs r0, 0x1\n\
|
||||
lsls r0, 24\n\
|
||||
asrs r0, 24\n\
|
||||
cmp r0, 0xE\n\
|
||||
bhi _080CF2E4\n\
|
||||
lsls r0, 2\n\
|
||||
ldr r1, =_080CF278\n\
|
||||
adds r0, r1\n\
|
||||
ldr r0, [r0]\n\
|
||||
mov pc, r0\n\
|
||||
.pool\n\
|
||||
.align 2, 0\n\
|
||||
_080CF278:\n\
|
||||
.4byte _080CF2B4\n\
|
||||
.4byte _080CF2B8\n\
|
||||
.4byte _080CF2BC\n\
|
||||
.4byte _080CF2C0\n\
|
||||
.4byte _080CF2C4\n\
|
||||
.4byte _080CF2E4\n\
|
||||
.4byte _080CF2E4\n\
|
||||
.4byte _080CF2E4\n\
|
||||
.4byte _080CF2E4\n\
|
||||
.4byte _080CF2E4\n\
|
||||
.4byte _080CF2E4\n\
|
||||
.4byte _080CF2C8\n\
|
||||
.4byte _080CF2CC\n\
|
||||
.4byte _080CF2E4\n\
|
||||
.4byte _080CF2D0\n\
|
||||
_080CF2B4:\n\
|
||||
movs r0, 0xB\n\
|
||||
b _080CF366\n\
|
||||
_080CF2B8:\n\
|
||||
movs r0, 0xC\n\
|
||||
b _080CF366\n\
|
||||
_080CF2BC:\n\
|
||||
movs r0, 0xD\n\
|
||||
b _080CF366\n\
|
||||
_080CF2C0:\n\
|
||||
movs r0, 0xE\n\
|
||||
b _080CF366\n\
|
||||
_080CF2C4:\n\
|
||||
movs r0, 0xF\n\
|
||||
b _080CF366\n\
|
||||
_080CF2C8:\n\
|
||||
movs r0, 0x10\n\
|
||||
b _080CF366\n\
|
||||
_080CF2CC:\n\
|
||||
movs r0, 0x11\n\
|
||||
b _080CF366\n\
|
||||
_080CF2D0:\n\
|
||||
movs r0, 0x12\n\
|
||||
b _080CF366\n\
|
||||
_080CF2D4:\n\
|
||||
ldr r2, =0x000021ff\n\
|
||||
adds r0, r1, r2\n\
|
||||
strb r4, [r0]\n\
|
||||
movs r0, 0x14\n\
|
||||
b _080CF366\n\
|
||||
.pool\n\
|
||||
_080CF2E4:\n\
|
||||
ldr r2, =gMain\n\
|
||||
ldrh r1, [r2, 0x2E]\n\
|
||||
movs r0, 0x2\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF2F8\n\
|
||||
movs r0, 0x13\n\
|
||||
b _080CF366\n\
|
||||
.pool\n\
|
||||
_080CF2F8:\n\
|
||||
ldr r0, =gSaveBlock2Ptr\n\
|
||||
ldr r0, [r0]\n\
|
||||
ldrb r0, [r0, 0x13]\n\
|
||||
cmp r0, 0x1\n\
|
||||
bne _080CF326\n\
|
||||
ldrh r1, [r2, 0x2C]\n\
|
||||
movs r0, 0x80\n\
|
||||
lsls r0, 2\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF318\n\
|
||||
movs r0, 0xA\n\
|
||||
b _080CF366\n\
|
||||
.pool\n\
|
||||
_080CF318:\n\
|
||||
movs r0, 0x80\n\
|
||||
lsls r0, 1\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF326\n\
|
||||
movs r0, 0x9\n\
|
||||
b _080CF366\n\
|
||||
_080CF326:\n\
|
||||
ldrh r1, [r2, 0x2E]\n\
|
||||
movs r0, 0x4\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF338\n\
|
||||
bl sub_80CFDC4\n\
|
||||
movs r0, 0\n\
|
||||
b _080CF366\n\
|
||||
_080CF338:\n\
|
||||
movs r6, 0\n\
|
||||
b _080CF364\n\
|
||||
_080CF33C:\n\
|
||||
movs r6, 0x1\n\
|
||||
movs r0, 0\n\
|
||||
ldrsb r0, [r2, r0]\n\
|
||||
cmp r0, 0x5\n\
|
||||
ble _080CF352\n\
|
||||
lsls r0, r4, 24\n\
|
||||
movs r3, 0xFA\n\
|
||||
lsls r3, 24\n\
|
||||
_080CF34C:\n\
|
||||
adds r0, r3\n\
|
||||
lsrs r4, r0, 24\n\
|
||||
b _080CF358\n\
|
||||
_080CF352:\n\
|
||||
movs r0, 0x2\n\
|
||||
mov r8, r0\n\
|
||||
movs r4, 0\n\
|
||||
_080CF358:\n\
|
||||
cmp r6, 0\n\
|
||||
beq _080CF364\n\
|
||||
mov r0, r8\n\
|
||||
adds r1, r4, 0\n\
|
||||
bl sub_80CD894\n\
|
||||
_080CF364:\n\
|
||||
adds r0, r6, 0\n\
|
||||
_080CF366:\n\
|
||||
pop {r3-r5}\n\
|
||||
mov r8, r3\n\
|
||||
mov r9, r4\n\
|
||||
mov r10, r5\n\
|
||||
pop {r4-r7}\n\
|
||||
pop {r1}\n\
|
||||
bx r1\n\
|
||||
");
|
||||
}
|
||||
#endif
|
||||
|
||||
static u8 InBoxInput_GrabbingMultiple(void)
|
||||
{
|
||||
@ -7526,22 +7221,23 @@ static u8 InBoxInput_MovingMultiple(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
static u8 HandleInput_InParty(void)
|
||||
{
|
||||
u8 retVal;
|
||||
bool8 gotoBox;
|
||||
s8 cursorArea = sBoxCursorArea;
|
||||
s8 cursorPosition = sBoxCursorPosition;
|
||||
s8 cursorArea;
|
||||
s8 cursorPosition;
|
||||
|
||||
do
|
||||
{
|
||||
cursorArea = sBoxCursorArea;
|
||||
cursorPosition = sBoxCursorPosition;
|
||||
sPSSData->field_CD3 = 0;
|
||||
sPSSData->field_CD2 = 0;
|
||||
sPSSData->field_CD7 = 0;
|
||||
gotoBox = FALSE;
|
||||
retVal = 0;
|
||||
|
||||
do
|
||||
{
|
||||
if (gMain.newAndRepeatedKeys & DPAD_UP)
|
||||
{
|
||||
if (--cursorPosition < 0)
|
||||
@ -7647,290 +7343,19 @@ static u8 HandleInput_InParty(void)
|
||||
|
||||
return retVal;
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
static u8 HandleInput_InParty(void)
|
||||
{
|
||||
asm_unified("\n\
|
||||
push {r4-r7,lr}\n\
|
||||
mov r7, r9\n\
|
||||
mov r6, r8\n\
|
||||
push {r6,r7}\n\
|
||||
ldr r0, =sBoxCursorArea\n\
|
||||
ldrb r0, [r0]\n\
|
||||
mov r9, r0\n\
|
||||
ldr r6, =sBoxCursorPosition\n\
|
||||
ldrb r4, [r6]\n\
|
||||
ldr r2, =sPSSData\n\
|
||||
ldr r0, [r2]\n\
|
||||
ldr r1, =0x00000cd3\n\
|
||||
adds r0, r1\n\
|
||||
movs r1, 0\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r0, [r2]\n\
|
||||
ldr r3, =0x00000cd2\n\
|
||||
adds r0, r3\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r0, [r2]\n\
|
||||
adds r3, 0x5\n\
|
||||
adds r0, r3\n\
|
||||
strb r1, [r0]\n\
|
||||
mov r8, r1\n\
|
||||
movs r7, 0\n\
|
||||
ldr r1, =gMain\n\
|
||||
ldrh r3, [r1, 0x30]\n\
|
||||
movs r0, 0x40\n\
|
||||
ands r0, r3\n\
|
||||
adds r5, r6, 0\n\
|
||||
mov r12, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF608\n\
|
||||
b _080CF7A8\n\
|
||||
_080CF608:\n\
|
||||
movs r0, 0x80\n\
|
||||
ands r0, r3\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF64C\n\
|
||||
lsls r0, r4, 24\n\
|
||||
movs r1, 0x80\n\
|
||||
lsls r1, 17\n\
|
||||
adds r0, r1\n\
|
||||
lsrs r4, r0, 24\n\
|
||||
asrs r0, 24\n\
|
||||
cmp r0, 0x6\n\
|
||||
ble _080CF622\n\
|
||||
movs r4, 0\n\
|
||||
_080CF622:\n\
|
||||
lsls r0, r4, 24\n\
|
||||
asrs r0, 24\n\
|
||||
movs r1, 0\n\
|
||||
ldrsb r1, [r5, r1]\n\
|
||||
cmp r0, r1\n\
|
||||
bne _080CF630\n\
|
||||
b _080CF7C6\n\
|
||||
_080CF630:\n\
|
||||
movs r7, 0x1\n\
|
||||
b _080CF7CA\n\
|
||||
.pool\n\
|
||||
_080CF64C:\n\
|
||||
movs r0, 0x20\n\
|
||||
ands r0, r3\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF670\n\
|
||||
ldrb r1, [r5]\n\
|
||||
movs r0, 0\n\
|
||||
ldrsb r0, [r5, r0]\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF670\n\
|
||||
movs r7, 0x1\n\
|
||||
ldr r0, [r2]\n\
|
||||
ldr r2, =0x00000cd6\n\
|
||||
adds r0, r2\n\
|
||||
strb r1, [r0]\n\
|
||||
movs r4, 0\n\
|
||||
b _080CF7C6\n\
|
||||
.pool\n\
|
||||
_080CF670:\n\
|
||||
mov r3, r12\n\
|
||||
ldrh r1, [r3, 0x30]\n\
|
||||
movs r0, 0x10\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF69E\n\
|
||||
movs r0, 0\n\
|
||||
ldrsb r0, [r5, r0]\n\
|
||||
cmp r0, 0\n\
|
||||
bne _080CF694\n\
|
||||
movs r7, 0x1\n\
|
||||
ldr r0, [r2]\n\
|
||||
ldr r1, =0x00000cd6\n\
|
||||
adds r0, r1\n\
|
||||
ldrb r4, [r0]\n\
|
||||
b _080CF7C6\n\
|
||||
.pool\n\
|
||||
_080CF694:\n\
|
||||
movs r7, 0x6\n\
|
||||
movs r2, 0\n\
|
||||
mov r9, r2\n\
|
||||
movs r4, 0\n\
|
||||
b _080CF7C6\n\
|
||||
_080CF69E:\n\
|
||||
mov r3, r12\n\
|
||||
ldrh r1, [r3, 0x2E]\n\
|
||||
movs r0, 0x1\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF75C\n\
|
||||
movs r0, 0\n\
|
||||
ldrsb r0, [r5, r0]\n\
|
||||
cmp r0, 0x6\n\
|
||||
bne _080CF6C4\n\
|
||||
ldr r0, [r2]\n\
|
||||
ldrb r0, [r0, 0x1]\n\
|
||||
cmp r0, 0x1\n\
|
||||
bne _080CF6BE\n\
|
||||
movs r0, 0x4\n\
|
||||
b _080CF7D8\n\
|
||||
_080CF6BE:\n\
|
||||
movs r0, 0x1\n\
|
||||
mov r8, r0\n\
|
||||
b _080CF75C\n\
|
||||
_080CF6C4:\n\
|
||||
bl sub_80CFA5C\n\
|
||||
lsls r0, 24\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF75C\n\
|
||||
ldr r0, =sCanOnlyMove\n\
|
||||
ldrb r0, [r0]\n\
|
||||
cmp r0, 0\n\
|
||||
bne _080CF6E0\n\
|
||||
movs r0, 0x8\n\
|
||||
b _080CF7D8\n\
|
||||
.pool\n\
|
||||
_080CF6E0:\n\
|
||||
movs r0, 0\n\
|
||||
bl sub_80CFF98\n\
|
||||
subs r0, 0x1\n\
|
||||
lsls r0, 24\n\
|
||||
asrs r0, 24\n\
|
||||
cmp r0, 0xE\n\
|
||||
bhi _080CF75C\n\
|
||||
lsls r0, 2\n\
|
||||
ldr r1, =_080CF700\n\
|
||||
adds r0, r1\n\
|
||||
ldr r0, [r0]\n\
|
||||
mov pc, r0\n\
|
||||
.pool\n\
|
||||
.align 2, 0\n\
|
||||
_080CF700:\n\
|
||||
.4byte _080CF73C\n\
|
||||
.4byte _080CF740\n\
|
||||
.4byte _080CF744\n\
|
||||
.4byte _080CF748\n\
|
||||
.4byte _080CF74C\n\
|
||||
.4byte _080CF75C\n\
|
||||
.4byte _080CF75C\n\
|
||||
.4byte _080CF75C\n\
|
||||
.4byte _080CF75C\n\
|
||||
.4byte _080CF75C\n\
|
||||
.4byte _080CF75C\n\
|
||||
.4byte _080CF750\n\
|
||||
.4byte _080CF754\n\
|
||||
.4byte _080CF75C\n\
|
||||
.4byte _080CF758\n\
|
||||
_080CF73C:\n\
|
||||
movs r0, 0xB\n\
|
||||
b _080CF7D8\n\
|
||||
_080CF740:\n\
|
||||
movs r0, 0xC\n\
|
||||
b _080CF7D8\n\
|
||||
_080CF744:\n\
|
||||
movs r0, 0xD\n\
|
||||
b _080CF7D8\n\
|
||||
_080CF748:\n\
|
||||
movs r0, 0xE\n\
|
||||
b _080CF7D8\n\
|
||||
_080CF74C:\n\
|
||||
movs r0, 0xF\n\
|
||||
b _080CF7D8\n\
|
||||
_080CF750:\n\
|
||||
movs r0, 0x10\n\
|
||||
b _080CF7D8\n\
|
||||
_080CF754:\n\
|
||||
movs r0, 0x11\n\
|
||||
b _080CF7D8\n\
|
||||
_080CF758:\n\
|
||||
movs r0, 0x12\n\
|
||||
b _080CF7D8\n\
|
||||
_080CF75C:\n\
|
||||
ldr r2, =gMain\n\
|
||||
ldrh r1, [r2, 0x2E]\n\
|
||||
movs r0, 0x2\n\
|
||||
ands r0, r1\n\
|
||||
mov r12, r2\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF784\n\
|
||||
ldr r0, =sPSSData\n\
|
||||
ldr r0, [r0]\n\
|
||||
ldrb r0, [r0, 0x1]\n\
|
||||
cmp r0, 0x1\n\
|
||||
bne _080CF780\n\
|
||||
movs r0, 0x13\n\
|
||||
b _080CF7D8\n\
|
||||
.pool\n\
|
||||
_080CF780:\n\
|
||||
movs r1, 0x1\n\
|
||||
mov r8, r1\n\
|
||||
_080CF784:\n\
|
||||
mov r2, r8\n\
|
||||
cmp r2, 0\n\
|
||||
beq _080CF794\n\
|
||||
movs r7, 0x6\n\
|
||||
movs r3, 0\n\
|
||||
mov r9, r3\n\
|
||||
movs r4, 0\n\
|
||||
b _080CF7C6\n\
|
||||
_080CF794:\n\
|
||||
mov r0, r12\n\
|
||||
ldrh r1, [r0, 0x2E]\n\
|
||||
movs r0, 0x4\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF7C6\n\
|
||||
bl sub_80CFDC4\n\
|
||||
movs r0, 0\n\
|
||||
b _080CF7D8\n\
|
||||
_080CF7A8:\n\
|
||||
lsls r0, r4, 24\n\
|
||||
movs r1, 0xFF\n\
|
||||
lsls r1, 24\n\
|
||||
adds r0, r1\n\
|
||||
lsrs r4, r0, 24\n\
|
||||
cmp r0, 0\n\
|
||||
bge _080CF7B8\n\
|
||||
movs r4, 0x6\n\
|
||||
_080CF7B8:\n\
|
||||
lsls r0, r4, 24\n\
|
||||
asrs r0, 24\n\
|
||||
movs r1, 0\n\
|
||||
ldrsb r1, [r6, r1]\n\
|
||||
cmp r0, r1\n\
|
||||
beq _080CF7C6\n\
|
||||
movs r7, 0x1\n\
|
||||
_080CF7C6:\n\
|
||||
cmp r7, 0\n\
|
||||
beq _080CF7D6\n\
|
||||
_080CF7CA:\n\
|
||||
cmp r7, 0x6\n\
|
||||
beq _080CF7D6\n\
|
||||
mov r0, r9\n\
|
||||
adds r1, r4, 0\n\
|
||||
bl sub_80CD894\n\
|
||||
_080CF7D6:\n\
|
||||
adds r0, r7, 0\n\
|
||||
_080CF7D8:\n\
|
||||
pop {r3,r4}\n\
|
||||
mov r8, r3\n\
|
||||
mov r9, r4\n\
|
||||
pop {r4-r7}\n\
|
||||
pop {r1}\n\
|
||||
bx r1");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NONMATCHING
|
||||
static u8 HandleInput_OnBox(void)
|
||||
{
|
||||
u8 retVal;
|
||||
s8 cursorArea;
|
||||
s8 cursorPosition;
|
||||
|
||||
do
|
||||
{
|
||||
sPSSData->field_CD3 = 0;
|
||||
sPSSData->field_CD2 = 0;
|
||||
sPSSData->field_CD7 = 0;
|
||||
|
||||
do
|
||||
{
|
||||
if (gMain.newAndRepeatedKeys & DPAD_UP)
|
||||
{
|
||||
retVal = 1;
|
||||
@ -7989,152 +7414,30 @@ static u8 HandleInput_OnBox(void)
|
||||
|
||||
return retVal;
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
static u8 HandleInput_OnBox(void)
|
||||
{
|
||||
asm_unified("\n\
|
||||
push {r4-r6,lr}\n\
|
||||
ldr r3, =sPSSData\n\
|
||||
ldr r0, [r3]\n\
|
||||
ldr r1, =0x00000cd3\n\
|
||||
adds r0, r1\n\
|
||||
movs r1, 0\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r0, [r3]\n\
|
||||
ldr r2, =0x00000cd2\n\
|
||||
adds r0, r2\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r0, [r3]\n\
|
||||
ldr r5, =0x00000cd7\n\
|
||||
adds r0, r5\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r1, =gMain\n\
|
||||
ldrh r2, [r1, 0x30]\n\
|
||||
movs r0, 0x40\n\
|
||||
ands r0, r2\n\
|
||||
cmp r0, 0\n\
|
||||
bne _080CF8AA\n\
|
||||
movs r0, 0x80\n\
|
||||
ands r0, r2\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF834\n\
|
||||
movs r4, 0x1\n\
|
||||
movs r1, 0\n\
|
||||
movs r6, 0x2\n\
|
||||
b _080CF8B6\n\
|
||||
.pool\n\
|
||||
_080CF834:\n\
|
||||
ldrh r2, [r1, 0x2C]\n\
|
||||
movs r0, 0x20\n\
|
||||
ands r0, r2\n\
|
||||
cmp r0, 0\n\
|
||||
bne _080CF85A\n\
|
||||
movs r0, 0x10\n\
|
||||
ands r0, r2\n\
|
||||
cmp r0, 0\n\
|
||||
bne _080CF86E\n\
|
||||
ldr r0, =gSaveBlock2Ptr\n\
|
||||
ldr r0, [r0]\n\
|
||||
ldrb r0, [r0, 0x13]\n\
|
||||
cmp r0, 0x1\n\
|
||||
bne _080CF872\n\
|
||||
movs r0, 0x80\n\
|
||||
lsls r0, 2\n\
|
||||
ands r0, r2\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF864\n\
|
||||
_080CF85A:\n\
|
||||
movs r0, 0xA\n\
|
||||
b _080CF8D2\n\
|
||||
.pool\n\
|
||||
_080CF864:\n\
|
||||
movs r0, 0x80\n\
|
||||
lsls r0, 1\n\
|
||||
ands r0, r2\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF872\n\
|
||||
_080CF86E:\n\
|
||||
movs r0, 0x9\n\
|
||||
b _080CF8D2\n\
|
||||
_080CF872:\n\
|
||||
ldrh r1, [r1, 0x2E]\n\
|
||||
movs r0, 0x1\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF88A\n\
|
||||
movs r0, 0\n\
|
||||
bl sub_80CD1A8\n\
|
||||
bl AddBoxMenu\n\
|
||||
movs r0, 0x7\n\
|
||||
b _080CF8D2\n\
|
||||
_080CF88A:\n\
|
||||
movs r0, 0x2\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF896\n\
|
||||
movs r0, 0x13\n\
|
||||
b _080CF8D2\n\
|
||||
_080CF896:\n\
|
||||
movs r0, 0x4\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF8A6\n\
|
||||
bl sub_80CFDC4\n\
|
||||
movs r0, 0\n\
|
||||
b _080CF8D2\n\
|
||||
_080CF8A6:\n\
|
||||
movs r4, 0\n\
|
||||
b _080CF8D0\n\
|
||||
_080CF8AA:\n\
|
||||
movs r4, 0x1\n\
|
||||
movs r1, 0x3\n\
|
||||
movs r6, 0\n\
|
||||
ldr r0, [r3]\n\
|
||||
adds r0, r5\n\
|
||||
strb r4, [r0]\n\
|
||||
_080CF8B6:\n\
|
||||
cmp r4, 0\n\
|
||||
beq _080CF8D0\n\
|
||||
lsls r5, r1, 24\n\
|
||||
cmp r1, 0x2\n\
|
||||
beq _080CF8C6\n\
|
||||
movs r0, 0\n\
|
||||
bl sub_80CD1A8\n\
|
||||
_080CF8C6:\n\
|
||||
lsrs r0, r5, 24\n\
|
||||
lsls r1, r6, 24\n\
|
||||
lsrs r1, 24\n\
|
||||
bl sub_80CD894\n\
|
||||
_080CF8D0:\n\
|
||||
adds r0, r4, 0\n\
|
||||
_080CF8D2:\n\
|
||||
pop {r4-r6}\n\
|
||||
pop {r1}\n\
|
||||
bx r1\n\
|
||||
");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NONMATCHING
|
||||
static u8 HandleInput_OnButtons(void)
|
||||
{
|
||||
u8 retVal;
|
||||
s8 cursorArea = sBoxCursorArea;
|
||||
s8 cursorPosition = sBoxCursorPosition;
|
||||
s8 cursorArea;
|
||||
s8 cursorPosition;
|
||||
|
||||
do
|
||||
{
|
||||
cursorArea = sBoxCursorArea;
|
||||
cursorPosition = sBoxCursorPosition;
|
||||
sPSSData->field_CD3 = 0;
|
||||
sPSSData->field_CD2 = 0;
|
||||
sPSSData->field_CD7 = 0;
|
||||
|
||||
do
|
||||
{
|
||||
if (gMain.newAndRepeatedKeys & DPAD_UP)
|
||||
{
|
||||
retVal = 1;
|
||||
cursorArea = CURSOR_AREA_IN_BOX;
|
||||
sPSSData->field_CD2 = -1;
|
||||
cursorPosition = (sBoxCursorPosition == 0) ? IN_BOX_COUNT - 1 - 5 : IN_BOX_COUNT - 1;
|
||||
if (sBoxCursorPosition == 0)
|
||||
cursorPosition = IN_BOX_COUNT - 1 - 5;
|
||||
else
|
||||
cursorPosition = IN_BOX_COUNT - 1;
|
||||
sPSSData->field_CD7 = 1;
|
||||
break;
|
||||
}
|
||||
@ -8181,148 +7484,6 @@ static u8 HandleInput_OnButtons(void)
|
||||
|
||||
return retVal;
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
static u8 HandleInput_OnButtons(void)
|
||||
{
|
||||
asm_unified("\n\
|
||||
push {r4-r7,lr}\n\
|
||||
mov r7, r8\n\
|
||||
push {r7}\n\
|
||||
ldr r0, =sBoxCursorArea\n\
|
||||
ldrb r0, [r0]\n\
|
||||
mov r8, r0\n\
|
||||
ldr r0, =sBoxCursorPosition\n\
|
||||
mov r12, r0\n\
|
||||
ldrb r2, [r0]\n\
|
||||
ldr r3, =sPSSData\n\
|
||||
ldr r0, [r3]\n\
|
||||
ldr r1, =0x00000cd3\n\
|
||||
adds r0, r1\n\
|
||||
movs r1, 0\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r0, [r3]\n\
|
||||
ldr r6, =0x00000cd2\n\
|
||||
adds r0, r6\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r0, [r3]\n\
|
||||
ldr r5, =0x00000cd7\n\
|
||||
adds r0, r5\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r7, =gMain\n\
|
||||
ldrh r1, [r7, 0x30]\n\
|
||||
movs r0, 0x40\n\
|
||||
ands r0, r1\n\
|
||||
adds r4, r3, 0\n\
|
||||
cmp r0, 0\n\
|
||||
bne _080CF9B2\n\
|
||||
movs r0, 0x88\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF944\n\
|
||||
movs r7, 0x1\n\
|
||||
movs r0, 0x2\n\
|
||||
mov r8, r0\n\
|
||||
movs r2, 0\n\
|
||||
ldr r0, [r4]\n\
|
||||
b _080CF9D0\n\
|
||||
.pool\n\
|
||||
_080CF944:\n\
|
||||
movs r0, 0x20\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF960\n\
|
||||
movs r7, 0x1\n\
|
||||
lsls r0, r2, 24\n\
|
||||
movs r1, 0xFF\n\
|
||||
lsls r1, 24\n\
|
||||
adds r0, r1\n\
|
||||
lsrs r2, r0, 24\n\
|
||||
cmp r0, 0\n\
|
||||
bge _080CF9D4\n\
|
||||
movs r2, 0x1\n\
|
||||
b _080CF9D4\n\
|
||||
_080CF960:\n\
|
||||
movs r0, 0x10\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF97E\n\
|
||||
movs r7, 0x1\n\
|
||||
lsls r0, r2, 24\n\
|
||||
movs r1, 0x80\n\
|
||||
lsls r1, 17\n\
|
||||
adds r0, r1\n\
|
||||
lsrs r2, r0, 24\n\
|
||||
asrs r0, 24\n\
|
||||
cmp r0, 0x1\n\
|
||||
ble _080CF9D4\n\
|
||||
movs r2, 0\n\
|
||||
b _080CF9D4\n\
|
||||
_080CF97E:\n\
|
||||
ldrh r1, [r7, 0x2E]\n\
|
||||
movs r0, 0x1\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF992\n\
|
||||
movs r0, 0x4\n\
|
||||
cmp r2, 0\n\
|
||||
bne _080CF9E2\n\
|
||||
movs r0, 0x5\n\
|
||||
b _080CF9E2\n\
|
||||
_080CF992:\n\
|
||||
movs r0, 0x2\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF99E\n\
|
||||
movs r0, 0x13\n\
|
||||
b _080CF9E2\n\
|
||||
_080CF99E:\n\
|
||||
movs r0, 0x4\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _080CF9AE\n\
|
||||
bl sub_80CFDC4\n\
|
||||
movs r0, 0\n\
|
||||
b _080CF9E2\n\
|
||||
_080CF9AE:\n\
|
||||
movs r7, 0\n\
|
||||
b _080CF9E0\n\
|
||||
_080CF9B2:\n\
|
||||
movs r7, 0x1\n\
|
||||
movs r0, 0\n\
|
||||
mov r8, r0\n\
|
||||
ldr r0, [r3]\n\
|
||||
adds r0, r6\n\
|
||||
movs r1, 0xFF\n\
|
||||
strb r1, [r0]\n\
|
||||
mov r1, r12\n\
|
||||
movs r0, 0\n\
|
||||
ldrsb r0, [r1, r0]\n\
|
||||
movs r2, 0x1D\n\
|
||||
cmp r0, 0\n\
|
||||
bne _080CF9CE\n\
|
||||
movs r2, 0x18\n\
|
||||
_080CF9CE:\n\
|
||||
ldr r0, [r3]\n\
|
||||
_080CF9D0:\n\
|
||||
adds r0, r5\n\
|
||||
strb r7, [r0]\n\
|
||||
_080CF9D4:\n\
|
||||
cmp r7, 0\n\
|
||||
beq _080CF9E0\n\
|
||||
mov r0, r8\n\
|
||||
adds r1, r2, 0\n\
|
||||
bl sub_80CD894\n\
|
||||
_080CF9E0:\n\
|
||||
adds r0, r7, 0\n\
|
||||
_080CF9E2:\n\
|
||||
pop {r3}\n\
|
||||
mov r8, r3\n\
|
||||
pop {r4-r7}\n\
|
||||
pop {r1}\n\
|
||||
bx r1");
|
||||
}
|
||||
#endif
|
||||
|
||||
static u8 HandleInput(void)
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,7 @@
|
||||
#include "bg.h"
|
||||
#include "window.h"
|
||||
#include "constants/coins.h"
|
||||
#include "constants/slot_machine.h"
|
||||
|
||||
// Text
|
||||
extern const u8 gText_YouDontHaveThreeCoins[];
|
||||
@ -33,31 +34,6 @@ extern const u8 gText_YouveGot9999Coins[];
|
||||
extern const u8 gText_YouveRunOutOfCoins[];
|
||||
extern const u8 gText_ReelTimeHelp[];
|
||||
|
||||
enum
|
||||
{
|
||||
SLOT_MACHINE_TAG_7_RED,
|
||||
SLOT_MACHINE_TAG_7_BLUE,
|
||||
SLOT_MACHINE_TAG_AZURILL,
|
||||
SLOT_MACHINE_TAG_LOTAD,
|
||||
SLOT_MACHINE_TAG_CHERRY,
|
||||
SLOT_MACHINE_TAG_POWER,
|
||||
SLOT_MACHINE_TAG_REPLAY
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SLOT_MACHINE_MATCHED_1CHERRY,
|
||||
SLOT_MACHINE_MATCHED_2CHERRY,
|
||||
SLOT_MACHINE_MATCHED_REPLAY,
|
||||
SLOT_MACHINE_MATCHED_LOTAD,
|
||||
SLOT_MACHINE_MATCHED_AZURILL,
|
||||
SLOT_MACHINE_MATCHED_POWER,
|
||||
SLOT_MACHINE_MATCHED_777_MIXED,
|
||||
SLOT_MACHINE_MATCHED_777_RED,
|
||||
SLOT_MACHINE_MATCHED_777_BLUE,
|
||||
SLOT_MACHINE_MATCHED_NONE
|
||||
};
|
||||
|
||||
struct SlotMachineEwramStruct
|
||||
{
|
||||
/*0x00*/ u8 state;
|
||||
@ -81,7 +57,7 @@ struct SlotMachineEwramStruct
|
||||
/*0x1A*/ s16 reelIncrement; // speed of reel
|
||||
/*0x1C*/ s16 reelPixelOffsets[3];
|
||||
/*0x22*/ u16 reelPixelOffsetsWhileStopping[3];
|
||||
/*0x28*/ s16 reelTagOffsets[3];
|
||||
/*0x28*/ s16 reelPositions[3];
|
||||
/*0x2E*/ s16 reelExtraTurns[3];
|
||||
/*0x34*/ s16 winnerRows[3];
|
||||
/*0x3A*/ u8 slotReelTasks[3];
|
||||
@ -184,7 +160,7 @@ static bool8 IsFinalTask_RunAwardPayoutActions(void);
|
||||
static bool8 AwardPayoutAction0(struct Task *task);
|
||||
static bool8 AwardPayoutAction_GivePayoutToPlayer(struct Task *task);
|
||||
static bool8 AwardPayoutAction_FreeTask(struct Task *task);
|
||||
static u8 GetNearbyTag_Quantized(u8 x, s16 y);
|
||||
static u8 GetTagAtRest(u8 x, s16 y);
|
||||
static void GameplayTask_StopSlotReel(void);
|
||||
static void ReelTasks_SetUnkTaskData(u8 a0);
|
||||
static void sub_8102E1C(u8 a0);
|
||||
@ -890,8 +866,8 @@ static void SlotMachineSetup_0_1(void)
|
||||
for (i = 0; i < NUM_REELS; i++)
|
||||
{
|
||||
sSlotMachine->reelPixelOffsetsWhileStopping[i] = 0;
|
||||
sSlotMachine->reelTagOffsets[i] = gInitialReelPositions[i][sSlotMachine->luckyGame] % REEL_NUM_TAGS;
|
||||
sSlotMachine->reelPixelOffsets[i] = REEL_NUM_TAGS * REEL_TAG_HEIGHT - sSlotMachine->reelTagOffsets[i] * REEL_TAG_HEIGHT;
|
||||
sSlotMachine->reelPositions[i] = gInitialReelPositions[i][sSlotMachine->luckyGame] % REEL_NUM_TAGS;
|
||||
sSlotMachine->reelPixelOffsets[i] = REEL_NUM_TAGS * REEL_TAG_HEIGHT - sSlotMachine->reelPositions[i] * REEL_TAG_HEIGHT;
|
||||
sSlotMachine->reelPixelOffsets[i] %= REEL_NUM_TAGS * REEL_TAG_HEIGHT;
|
||||
}
|
||||
AlertTVThatPlayerPlayedSlotMachine(GetCoins());
|
||||
@ -1598,9 +1574,9 @@ static void CheckMatch_CenterRow(void)
|
||||
{
|
||||
u8 c1, c2, c3, match;
|
||||
|
||||
c1 = GetNearbyTag_Quantized(0, 2);
|
||||
c2 = GetNearbyTag_Quantized(1, 2);
|
||||
c3 = GetNearbyTag_Quantized(2, 2);
|
||||
c1 = GetTagAtRest(LEFT_REEL, 2);
|
||||
c2 = GetTagAtRest(MIDDLE_REEL, 2);
|
||||
c3 = GetTagAtRest(RIGHT_REEL, 2);
|
||||
match = GetMatchFromSymbolsInRow(c1, c2, c3);
|
||||
if (match != SLOT_MACHINE_MATCHED_NONE)
|
||||
{
|
||||
@ -1614,9 +1590,9 @@ static void CheckMatch_TopAndBottom(void)
|
||||
{
|
||||
u8 c1, c2, c3, match;
|
||||
|
||||
c1 = GetNearbyTag_Quantized(0, 1);
|
||||
c2 = GetNearbyTag_Quantized(1, 1);
|
||||
c3 = GetNearbyTag_Quantized(2, 1);
|
||||
c1 = GetTagAtRest(LEFT_REEL, 1);
|
||||
c2 = GetTagAtRest(MIDDLE_REEL, 1);
|
||||
c3 = GetTagAtRest(RIGHT_REEL, 1);
|
||||
match = GetMatchFromSymbolsInRow(c1, c2, c3);
|
||||
if (match != SLOT_MACHINE_MATCHED_NONE)
|
||||
{
|
||||
@ -1626,9 +1602,9 @@ static void CheckMatch_TopAndBottom(void)
|
||||
sSlotMachine->matchedSymbols |= gSlotMatchFlags[match];
|
||||
sub_8103E04(1);
|
||||
}
|
||||
c1 = GetNearbyTag_Quantized(0, 3);
|
||||
c2 = GetNearbyTag_Quantized(1, 3);
|
||||
c3 = GetNearbyTag_Quantized(2, 3);
|
||||
c1 = GetTagAtRest(LEFT_REEL, 3);
|
||||
c2 = GetTagAtRest(MIDDLE_REEL, 3);
|
||||
c3 = GetTagAtRest(RIGHT_REEL, 3);
|
||||
match = GetMatchFromSymbolsInRow(c1, c2, c3);
|
||||
if (match != SLOT_MACHINE_MATCHED_NONE)
|
||||
{
|
||||
@ -1644,9 +1620,9 @@ static void CheckMatch_Diagonals(void)
|
||||
{
|
||||
u8 c1, c2, c3, match;
|
||||
|
||||
c1 = GetNearbyTag_Quantized(0, 1);
|
||||
c2 = GetNearbyTag_Quantized(1, 2);
|
||||
c3 = GetNearbyTag_Quantized(2, 3);
|
||||
c1 = GetTagAtRest(LEFT_REEL, 1);
|
||||
c2 = GetTagAtRest(MIDDLE_REEL, 2);
|
||||
c3 = GetTagAtRest(RIGHT_REEL, 3);
|
||||
match = GetMatchFromSymbolsInRow(c1, c2, c3);
|
||||
if (match != SLOT_MACHINE_MATCHED_NONE)
|
||||
{
|
||||
@ -1657,9 +1633,9 @@ static void CheckMatch_Diagonals(void)
|
||||
}
|
||||
sub_8103E04(3);
|
||||
}
|
||||
c1 = GetNearbyTag_Quantized(0, 3);
|
||||
c2 = GetNearbyTag_Quantized(1, 2);
|
||||
c3 = GetNearbyTag_Quantized(2, 1);
|
||||
c1 = GetTagAtRest(LEFT_REEL, 3);
|
||||
c2 = GetTagAtRest(MIDDLE_REEL, 2);
|
||||
c3 = GetTagAtRest(RIGHT_REEL, 1);
|
||||
match = GetMatchFromSymbolsInRow(c1, c2, c3);
|
||||
if (match != SLOT_MACHINE_MATCHED_NONE)
|
||||
{
|
||||
@ -1751,25 +1727,34 @@ static bool8 AwardPayoutAction_FreeTask(struct Task *task)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
// Returns the tag that is posOffset below the tag at the top of reelIndex's tape
|
||||
static u8 GetNearbyTag_Quantized(u8 reelIndex, s16 posOffset)
|
||||
// Get the tag at position `offset` below the top of the reel's tape. Note that
|
||||
// if `offset` is negative, it wraps around to the bottom of the tape.
|
||||
// .-----------------.
|
||||
// | [ ] | [ ] | [ ] | <- offset = 0
|
||||
// /-----|-----|-----\
|
||||
// screen -> | [ ] | [ ] | [ ] | <- offset = 1
|
||||
// | [ ] | [ ] | [ ] | <- offset = 2
|
||||
// | [ ] | [ ] | [ ] | <- offset = 3
|
||||
// \-----|-----|-----/
|
||||
// | ... | ... | ... |
|
||||
// | [ ] | [ ] | [ ] | <- offset = 20
|
||||
// .-----------------.
|
||||
static u8 GetTagAtRest(u8 reel, s16 offset)
|
||||
{
|
||||
s16 tagIndex = (sSlotMachine->reelTagOffsets[reelIndex] + posOffset) % REEL_NUM_TAGS;
|
||||
if (tagIndex < 0)
|
||||
tagIndex += REEL_NUM_TAGS;
|
||||
return gReelSymbols[reelIndex][tagIndex];
|
||||
s16 pos = (sSlotMachine->reelPositions[reel] + offset) % REEL_NUM_TAGS;
|
||||
if (pos < 0)
|
||||
pos += REEL_NUM_TAGS;
|
||||
return gReelSymbols[reel][pos];
|
||||
}
|
||||
|
||||
|
||||
// Calculates GetNearbyTag_Quantized as if the reel was snapped downwards into place
|
||||
static u8 GetNearbyTag(u8 reelIndex, s16 posOffset)
|
||||
// Calculates GetTagAtRest as if the reel were snapped downwards into place.
|
||||
static u8 GetTag(u8 reel, s16 offset)
|
||||
{
|
||||
s16 tagOffset = 0;
|
||||
s16 result = sSlotMachine->reelPixelOffsets[reelIndex] % 24;
|
||||
if (result != 0)
|
||||
tagOffset = -1;
|
||||
return GetNearbyTag_Quantized(reelIndex, posOffset + tagOffset);
|
||||
s16 inc = 0;
|
||||
s16 pixelOffset = sSlotMachine->reelPixelOffsets[reel] % REEL_TAG_HEIGHT;
|
||||
if (pixelOffset != 0)
|
||||
inc = -1;
|
||||
return GetTagAtRest(reel, offset + inc);
|
||||
}
|
||||
|
||||
static u8 GetNearbyReelTimeTag(s16 n)
|
||||
@ -1784,7 +1769,7 @@ static void AdvanceSlotReel(u8 reelIndex, s16 value)
|
||||
{
|
||||
sSlotMachine->reelPixelOffsets[reelIndex] += value;
|
||||
sSlotMachine->reelPixelOffsets[reelIndex] %= 504;
|
||||
sSlotMachine->reelTagOffsets[reelIndex] = REEL_NUM_TAGS - sSlotMachine->reelPixelOffsets[reelIndex] / 24;
|
||||
sSlotMachine->reelPositions[reelIndex] = REEL_NUM_TAGS - sSlotMachine->reelPixelOffsets[reelIndex] / 24;
|
||||
}
|
||||
|
||||
s16 AdvanceSlotReelToNextTag(u8 reelIndex, s16 value)
|
||||
@ -1940,7 +1925,7 @@ static bool8 DecideReelTurns_BiasTag_Reel1(void)
|
||||
|
||||
static bool8 AreTagsAtPosition_Reel1(s16 pos, u8 tag1, u8 tag2)
|
||||
{
|
||||
u8 tag = GetNearbyTag(0, pos);
|
||||
u8 tag = GetTag(LEFT_REEL, pos);
|
||||
if (tag == tag1 || tag == tag2)
|
||||
{
|
||||
sSlotMachine->biasTag = tag;
|
||||
@ -1951,7 +1936,7 @@ static bool8 AreTagsAtPosition_Reel1(s16 pos, u8 tag1, u8 tag2)
|
||||
|
||||
static bool8 AreCherriesOnScreen_Reel1(s16 offsetFromCenter)
|
||||
{
|
||||
if (GetNearbyTag(0, 1 - offsetFromCenter) == SLOT_MACHINE_TAG_CHERRY || GetNearbyTag(0, 2 - offsetFromCenter) == SLOT_MACHINE_TAG_CHERRY || GetNearbyTag(0, 3 - offsetFromCenter) == SLOT_MACHINE_TAG_CHERRY)
|
||||
if (GetTag(LEFT_REEL, 1 - offsetFromCenter) == SLOT_MACHINE_TAG_CHERRY || GetTag(LEFT_REEL, 2 - offsetFromCenter) == SLOT_MACHINE_TAG_CHERRY || GetTag(LEFT_REEL, 3 - offsetFromCenter) == SLOT_MACHINE_TAG_CHERRY)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
@ -2046,7 +2031,7 @@ static bool8 DecideReelTurns_BiasTag_Reel2_Bet1or2(void)
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
// if biasTag appears in the same row within 4 turns
|
||||
if (GetNearbyTag(1, biasTagLocation_Reel1 - i) == sSlotMachine->biasTag)
|
||||
if (GetTag(MIDDLE_REEL, biasTagLocation_Reel1 - i) == sSlotMachine->biasTag)
|
||||
{
|
||||
sSlotMachine->winnerRows[1] = biasTagLocation_Reel1;
|
||||
sSlotMachine->reelExtraTurns[1] = i;
|
||||
@ -2068,7 +2053,7 @@ static bool8 DecideReelTurns_BiasTag_Reel2_Bet3(void)
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
//...and if the bias tag will appear in the middle row within 4 turns
|
||||
if (GetNearbyTag(1, 2 - i) == sSlotMachine->biasTag)
|
||||
if (GetTag(MIDDLE_REEL, 2 - i) == sSlotMachine->biasTag)
|
||||
{
|
||||
sSlotMachine->winnerRows[1] = 2;
|
||||
sSlotMachine->reelExtraTurns[1] = i;
|
||||
@ -2084,7 +2069,7 @@ static bool8 DecideReelTurns_BiasTag_Reel2_Bet3(void)
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
//...and if the biasTag will appear in the center row of reel 2 within 4 turns
|
||||
if (GetNearbyTag(1, 2 - i) == sSlotMachine->biasTag)
|
||||
if (GetTag(MIDDLE_REEL, 2 - i) == sSlotMachine->biasTag)
|
||||
{
|
||||
sSlotMachine->winnerRows[1] = 2;
|
||||
sSlotMachine->reelExtraTurns[1] = i;
|
||||
@ -2117,7 +2102,7 @@ static bool8 DecideReelTurns_BiasTag_Reel3_Bet1or2(u8 biasTag)
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
// if the biasTag appears in the same row as in reel 2 within 4 turns
|
||||
if (GetNearbyTag(2, biasTagLocation_Reel2 - i) == biasTag)
|
||||
if (GetTag(RIGHT_REEL, biasTagLocation_Reel2 - i) == biasTag)
|
||||
{
|
||||
sSlotMachine->winnerRows[2] = biasTagLocation_Reel2;
|
||||
sSlotMachine->reelExtraTurns[2] = i;
|
||||
@ -2143,7 +2128,7 @@ static bool8 DecideReelTurns_BiasTag_Reel3_Bet3(u8 biasTag)
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
// if the biasTag lands in that position within 4 turns
|
||||
if (GetNearbyTag(2, biasTagFinalPos - i) == biasTag)
|
||||
if (GetTag(RIGHT_REEL, biasTagFinalPos - i) == biasTag)
|
||||
{
|
||||
sSlotMachine->reelExtraTurns[2] = i;
|
||||
sSlotMachine->winnerRows[2] = biasTagFinalPos;
|
||||
@ -2189,7 +2174,7 @@ static void DecideReelTurns_NoBiasTag_Reel2_Bet1(void)
|
||||
{
|
||||
if (sSlotMachine->winnerRows[0] != 0 && sSlotMachine->luckyFlags & LUCKY_BIAS_777)
|
||||
{
|
||||
u8 biasTag = GetNearbyTag(0, 2 - sSlotMachine->reelExtraTurns[0]);
|
||||
u8 biasTag = GetTag(LEFT_REEL, 2 - sSlotMachine->reelExtraTurns[0]);
|
||||
//...and if biasTag is one of the 7's...
|
||||
if (IsBiasTag777_SwitchColor(&biasTag))
|
||||
//...swap color of biasTag...
|
||||
@ -2198,7 +2183,7 @@ static void DecideReelTurns_NoBiasTag_Reel2_Bet1(void)
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
//...and if the biasTag appears within 4 turns
|
||||
if (biasTag == GetNearbyTag(1, 2 - i))
|
||||
if (biasTag == GetTag(MIDDLE_REEL, 2 - i))
|
||||
{
|
||||
sSlotMachine->winnerRows[1] = 2;
|
||||
sSlotMachine->reelExtraTurns[1] = i;
|
||||
@ -2213,7 +2198,7 @@ static void DecideReelTurns_NoBiasTag_Reel2_Bet2(void)
|
||||
{
|
||||
if (sSlotMachine->winnerRows[0] != 0 && sSlotMachine->luckyFlags & LUCKY_BIAS_777)
|
||||
{
|
||||
u8 biasTag = GetNearbyTag(0, sSlotMachine->winnerRows[0] - sSlotMachine->reelExtraTurns[0]);
|
||||
u8 biasTag = GetTag(LEFT_REEL, sSlotMachine->winnerRows[0] - sSlotMachine->reelExtraTurns[0]);
|
||||
//...and if biasTag is one of the 7's...
|
||||
if (IsBiasTag777_SwitchColor(&biasTag))
|
||||
//...swap color of biasTag...
|
||||
@ -2222,7 +2207,7 @@ static void DecideReelTurns_NoBiasTag_Reel2_Bet2(void)
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
//...and if the biasTag appears in same row in reel 2 within 4 turns
|
||||
if (biasTag == GetNearbyTag(1, sSlotMachine->winnerRows[0] - i))
|
||||
if (biasTag == GetTag(MIDDLE_REEL, sSlotMachine->winnerRows[0] - i))
|
||||
{
|
||||
sSlotMachine->winnerRows[1] = sSlotMachine->winnerRows[0];
|
||||
sSlotMachine->reelExtraTurns[1] = i;
|
||||
@ -2247,7 +2232,7 @@ static void DecideReelTurns_NoBiasTag_Reel2_Bet3(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
u8 biasTag = GetNearbyTag(0, sSlotMachine->winnerRows[0] - sSlotMachine->reelExtraTurns[0]);
|
||||
u8 biasTag = GetTag(LEFT_REEL, sSlotMachine->winnerRows[0] - sSlotMachine->reelExtraTurns[0]);
|
||||
//...and if biasTag is one of the 7's...
|
||||
if (IsBiasTag777_SwitchColor(&biasTag))
|
||||
//...swap the color of the 7...
|
||||
@ -2257,7 +2242,7 @@ static void DecideReelTurns_NoBiasTag_Reel2_Bet3(void)
|
||||
j = 3;
|
||||
for (i = 0; i < 2; i++, j--)
|
||||
{
|
||||
if (biasTag == GetNearbyTag(1, j))
|
||||
if (biasTag == GetTag(MIDDLE_REEL, j))
|
||||
{
|
||||
sSlotMachine->winnerRows[1] = j;
|
||||
sSlotMachine->reelExtraTurns[1] = 0;
|
||||
@ -2266,7 +2251,7 @@ static void DecideReelTurns_NoBiasTag_Reel2_Bet3(void)
|
||||
}
|
||||
for (j = 1; j < 5; j++)
|
||||
{
|
||||
if (biasTag == GetNearbyTag(1, sSlotMachine->winnerRows[0] - j))
|
||||
if (biasTag == GetTag(MIDDLE_REEL, sSlotMachine->winnerRows[0] - j))
|
||||
{
|
||||
if (sSlotMachine->winnerRows[0] == 1)
|
||||
{
|
||||
@ -2340,8 +2325,8 @@ static void DecideReelTurns_NoBiasTag_Reel3(void)
|
||||
static void DecideReelTurns_NoBiasTag_Reel3_Bet1(void)
|
||||
{
|
||||
s16 i = 0;
|
||||
u8 tag1 = GetNearbyTag(0, 2 - sSlotMachine->reelExtraTurns[0]);
|
||||
u8 tag2 = GetNearbyTag(1, 2 - sSlotMachine->reelExtraTurns[1]);
|
||||
u8 tag1 = GetTag(LEFT_REEL, 2 - sSlotMachine->reelExtraTurns[0]);
|
||||
u8 tag2 = GetTag(MIDDLE_REEL, 2 - sSlotMachine->reelExtraTurns[1]);
|
||||
// if tags match in first 2 reels...
|
||||
if (tag1 == tag2)
|
||||
{
|
||||
@ -2349,7 +2334,7 @@ static void DecideReelTurns_NoBiasTag_Reel3_Bet1(void)
|
||||
while (1)
|
||||
{
|
||||
u8 tag3;
|
||||
if (!(tag1 == (tag3 = GetNearbyTag(2, 2 - i)) || (tag1 == SLOT_MACHINE_TAG_7_RED && tag3 == SLOT_MACHINE_TAG_7_BLUE) || (tag1 == SLOT_MACHINE_TAG_7_BLUE && tag3 == SLOT_MACHINE_TAG_7_RED)))
|
||||
if (!(tag1 == (tag3 = GetTag(RIGHT_REEL, 2 - i)) || (tag1 == SLOT_MACHINE_TAG_7_RED && tag3 == SLOT_MACHINE_TAG_7_BLUE) || (tag1 == SLOT_MACHINE_TAG_7_BLUE && tag3 == SLOT_MACHINE_TAG_7_RED)))
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
@ -2361,7 +2346,7 @@ static void DecideReelTurns_NoBiasTag_Reel3_Bet1(void)
|
||||
//...see if you can match with reel 1 within 4 turns
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
if (tag1 == GetNearbyTag(2, 2 - i))
|
||||
if (tag1 == GetTag(RIGHT_REEL, 2 - i))
|
||||
{
|
||||
sSlotMachine->reelExtraTurns[2] = i;
|
||||
return;
|
||||
@ -2372,7 +2357,7 @@ static void DecideReelTurns_NoBiasTag_Reel3_Bet1(void)
|
||||
i = 0;
|
||||
while (1)
|
||||
{
|
||||
if (tag1 != GetNearbyTag(2, 2 - i))
|
||||
if (tag1 != GetTag(RIGHT_REEL, 2 - i))
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
@ -2389,15 +2374,15 @@ static void DecideReelTurns_NoBiasTag_Reel3_Bet2(void)
|
||||
u8 tag3;
|
||||
if (sSlotMachine->winnerRows[1] != 0 && sSlotMachine->winnerRows[0] == sSlotMachine->winnerRows[1] && sSlotMachine->luckyFlags & LUCKY_BIAS_777)
|
||||
{
|
||||
tag1 = GetNearbyTag(0, sSlotMachine->winnerRows[0] - sSlotMachine->reelExtraTurns[0]);
|
||||
tag2 = GetNearbyTag(1, sSlotMachine->winnerRows[1] - sSlotMachine->reelExtraTurns[1]);
|
||||
tag1 = GetTag(LEFT_REEL, sSlotMachine->winnerRows[0] - sSlotMachine->reelExtraTurns[0]);
|
||||
tag2 = GetTag(MIDDLE_REEL, sSlotMachine->winnerRows[1] - sSlotMachine->reelExtraTurns[1]);
|
||||
//...and if tags are mixed 7s...
|
||||
if (AreTagsMixed77(tag1, tag2))
|
||||
{
|
||||
//...try to match with reel 1 within 4 turns
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
tag3 = GetNearbyTag(2, sSlotMachine->winnerRows[1] - i);
|
||||
tag3 = GetTag(RIGHT_REEL, sSlotMachine->winnerRows[1] - i);
|
||||
if (tag1 == tag3)
|
||||
{
|
||||
extraTurns = i;
|
||||
@ -2412,9 +2397,9 @@ static void DecideReelTurns_NoBiasTag_Reel3_Bet2(void)
|
||||
s16 loopExit;
|
||||
for (i = 1, loopExit = 0; i < 4; i++)
|
||||
{
|
||||
tag1 = GetNearbyTag(0, i - sSlotMachine->reelExtraTurns[0]); // why does this update with i
|
||||
tag2 = GetNearbyTag(1, i - sSlotMachine->reelExtraTurns[1]);
|
||||
tag3 = GetNearbyTag(2, i - extraTurns);
|
||||
tag1 = GetTag(LEFT_REEL, i - sSlotMachine->reelExtraTurns[0]); // why does this update with i
|
||||
tag2 = GetTag(MIDDLE_REEL, i - sSlotMachine->reelExtraTurns[1]);
|
||||
tag3 = GetTag(RIGHT_REEL, i - extraTurns);
|
||||
// if bit 7 of luckyFlags is unset...
|
||||
//...and if all 3 tags match and they're not mixed 7s
|
||||
if (!TagsDontMatchOrHaveAny7s(tag1, tag2, tag3) && (!AreTagsMixed777(tag1, tag2, tag3) || !(sSlotMachine->luckyFlags & LUCKY_BIAS_777)))
|
||||
@ -2441,8 +2426,8 @@ static void DecideReelTurns_NoBiasTag_Reel3_Bet3(void)
|
||||
DecideReelTurns_NoBiasTag_Reel3_Bet2();
|
||||
if (sSlotMachine->winnerRows[1] != 0 && sSlotMachine->winnerRows[0] != sSlotMachine->winnerRows[1] && sSlotMachine->luckyFlags & LUCKY_BIAS_777)
|
||||
{
|
||||
tag1 = GetNearbyTag(0, sSlotMachine->winnerRows[0] - sSlotMachine->reelExtraTurns[0]);
|
||||
tag2 = GetNearbyTag(1, sSlotMachine->winnerRows[1] - sSlotMachine->reelExtraTurns[1]);
|
||||
tag1 = GetTag(LEFT_REEL, sSlotMachine->winnerRows[0] - sSlotMachine->reelExtraTurns[0]);
|
||||
tag2 = GetTag(MIDDLE_REEL, sSlotMachine->winnerRows[1] - sSlotMachine->reelExtraTurns[1]);
|
||||
//..and if tags are mixed 7s...
|
||||
if (AreTagsMixed77(tag1, tag2))
|
||||
{
|
||||
@ -2451,7 +2436,7 @@ static void DecideReelTurns_NoBiasTag_Reel3_Bet3(void)
|
||||
j = 3;
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
tag3 = GetNearbyTag(2, j - (sSlotMachine->reelExtraTurns[2] + i));
|
||||
tag3 = GetTag(RIGHT_REEL, j - (sSlotMachine->reelExtraTurns[2] + i));
|
||||
if (tag1 == tag3)
|
||||
{
|
||||
sSlotMachine->reelExtraTurns[2] += i;
|
||||
@ -2462,18 +2447,18 @@ static void DecideReelTurns_NoBiasTag_Reel3_Bet3(void)
|
||||
}
|
||||
while (1)
|
||||
{
|
||||
tag1 = GetNearbyTag(0, 1 - sSlotMachine->reelExtraTurns[0]);
|
||||
tag2 = GetNearbyTag(1, 2 - sSlotMachine->reelExtraTurns[1]);
|
||||
tag3 = GetNearbyTag(2, 3 - sSlotMachine->reelExtraTurns[2]);
|
||||
tag1 = GetTag(LEFT_REEL, 1 - sSlotMachine->reelExtraTurns[0]);
|
||||
tag2 = GetTag(MIDDLE_REEL, 2 - sSlotMachine->reelExtraTurns[1]);
|
||||
tag3 = GetTag(RIGHT_REEL, 3 - sSlotMachine->reelExtraTurns[2]);
|
||||
if (TagsDontMatchOrHaveAny7s(tag1, tag2, tag3) || (AreTagsMixed777(tag1, tag2, tag3) && sSlotMachine->luckyFlags & LUCKY_BIAS_777))
|
||||
break;
|
||||
sSlotMachine->reelExtraTurns[2]++;
|
||||
}
|
||||
while (1)
|
||||
{
|
||||
tag1 = GetNearbyTag(0, 3 - sSlotMachine->reelExtraTurns[0]);
|
||||
tag2 = GetNearbyTag(1, 2 - sSlotMachine->reelExtraTurns[1]);
|
||||
tag3 = GetNearbyTag(2, 1 - sSlotMachine->reelExtraTurns[2]);
|
||||
tag1 = GetTag(LEFT_REEL, 3 - sSlotMachine->reelExtraTurns[0]);
|
||||
tag2 = GetTag(MIDDLE_REEL, 2 - sSlotMachine->reelExtraTurns[1]);
|
||||
tag3 = GetTag(RIGHT_REEL, 1 - sSlotMachine->reelExtraTurns[2]);
|
||||
if (TagsDontMatchOrHaveAny7s(tag1, tag2, tag3) || (AreTagsMixed777(tag1, tag2, tag3) && sSlotMachine->luckyFlags & LUCKY_BIAS_777))
|
||||
break;
|
||||
sSlotMachine->reelExtraTurns[2]++;
|
||||
@ -3314,7 +3299,7 @@ static void sub_8104F18(struct Sprite *sprite)
|
||||
sprite->data[2] = sSlotMachine->reelPixelOffsets[sprite->data[0]] + sprite->data[1];
|
||||
sprite->data[2] %= 120;
|
||||
sprite->pos1.y = sSlotMachine->reelPixelOffsetsWhileStopping[sprite->data[0]] + 28 + sprite->data[2];
|
||||
sprite->sheetTileStart = GetSpriteTileStartByTag(GetNearbyTag_Quantized(sprite->data[0], sprite->data[2] / 24));
|
||||
sprite->sheetTileStart = GetSpriteTileStartByTag(GetTagAtRest(sprite->data[0], sprite->data[2] / 24));
|
||||
SetSpriteSheetFrameTileNum(sprite);
|
||||
}
|
||||
|
||||
|
@ -1464,10 +1464,10 @@ static void TradeMenuShowMonSummaryScreen(void)
|
||||
{
|
||||
// Player's party
|
||||
if (sTradeMenuData->cursorPosition < PARTY_SIZE)
|
||||
ShowPokemonSummaryScreen(PSS_MODE_UNK1, gPlayerParty, sTradeMenuData->cursorPosition, sTradeMenuData->partyCounts[TRADE_PLAYER] - 1, CB2_ReturnToTradeMenu);
|
||||
ShowPokemonSummaryScreen(PSS_MODE_LOCK_MOVES, gPlayerParty, sTradeMenuData->cursorPosition, sTradeMenuData->partyCounts[TRADE_PLAYER] - 1, CB2_ReturnToTradeMenu);
|
||||
// Partner's party
|
||||
else
|
||||
ShowPokemonSummaryScreen(PSS_MODE_UNK1, gEnemyParty, sTradeMenuData->cursorPosition - PARTY_SIZE, sTradeMenuData->partyCounts[TRADE_PARTNER] - 1, CB2_ReturnToTradeMenu);
|
||||
ShowPokemonSummaryScreen(PSS_MODE_LOCK_MOVES, gEnemyParty, sTradeMenuData->cursorPosition - PARTY_SIZE, sTradeMenuData->partyCounts[TRADE_PARTNER] - 1, CB2_ReturnToTradeMenu);
|
||||
FreeAllWindowBuffers();
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ static const u16 sPrizeListElixir2[] = {ITEM_ELIXIR, ITEM_ETHER, I
|
||||
static const u16 sPrizeListBrickBreak[] = {ITEM_TM31_BRICK_BREAK, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
|
||||
static const u16 sPrizeListTorment[] = {ITEM_TM41_TORMENT, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
|
||||
static const u16 sPrizeListSkillSwap[] = {ITEM_TM48_SKILL_SWAP, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
|
||||
static const u16 sPrizeListGigaSwap[] = {ITEM_TM19_GIGA_DRAIN, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
|
||||
static const u16 sPrizeListGigaDrain[] = {ITEM_TM19_GIGA_DRAIN, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
|
||||
static const u16 sPrizeListAttract[] = {ITEM_TM45_ATTRACT, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL};
|
||||
|
||||
static const u16 *const sPrizeLists1[NUM_TRAINER_HILL_PRIZE_LISTS] =
|
||||
@ -192,7 +192,7 @@ static const u16 *const sPrizeLists2[NUM_TRAINER_HILL_PRIZE_LISTS] =
|
||||
sPrizeListBrickBreak,
|
||||
sPrizeListTorment,
|
||||
sPrizeListSkillSwap,
|
||||
sPrizeListGigaSwap,
|
||||
sPrizeListGigaDrain,
|
||||
sPrizeListAttract
|
||||
};
|
||||
|
||||
|
@ -13,13 +13,13 @@ static void DecompressGlyphFont6(u16);
|
||||
u16 Font6Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
u16 char_;
|
||||
struct TextPrinterSubStruct *sub;
|
||||
struct TextPrinterSubStruct *subStruct;
|
||||
subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
sub = &textPrinter->subUnion.sub;
|
||||
switch (textPrinter->state)
|
||||
{
|
||||
case 0:
|
||||
if (gMain.heldKeys & (A_BUTTON | B_BUTTON) && sub->hasPrintBeenSpedUp)
|
||||
if (gMain.heldKeys & (A_BUTTON | B_BUTTON) && subStruct->hasPrintBeenSpedUp)
|
||||
{
|
||||
textPrinter->delayCounter = 0;
|
||||
}
|
||||
@ -28,7 +28,7 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
||||
textPrinter->delayCounter --;
|
||||
if (gTextFlags.canABSpeedUpPrint && gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||
{
|
||||
sub->hasPrintBeenSpedUp = TRUE;
|
||||
subStruct->hasPrintBeenSpedUp = TRUE;
|
||||
textPrinter->delayCounter = 0;
|
||||
}
|
||||
return 3;
|
||||
@ -81,7 +81,7 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case 6:
|
||||
sub->glyphId = *textPrinter->printerTemplate.currentChar;
|
||||
subStruct->glyphId = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case 7:
|
||||
@ -94,7 +94,7 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
||||
textPrinter->state = 1;
|
||||
if (gTextFlags.autoScroll)
|
||||
{
|
||||
sub->autoScrollDelay = 0;
|
||||
subStruct->autoScrollDelay = 0;
|
||||
}
|
||||
return 3;
|
||||
case 10:
|
||||
|
@ -210,7 +210,7 @@ void HandlePngToGbaCommand(char *inputPath, char *outputPath, int argc, char **a
|
||||
|
||||
void HandlePngToJascPaletteCommand(char *inputPath, char *outputPath, int argc UNUSED, char **argv UNUSED)
|
||||
{
|
||||
struct Palette palette = {0};
|
||||
struct Palette palette = {};
|
||||
|
||||
ReadPngPalette(inputPath, &palette);
|
||||
WriteJascPalette(outputPath, &palette);
|
||||
@ -218,7 +218,7 @@ void HandlePngToJascPaletteCommand(char *inputPath, char *outputPath, int argc U
|
||||
|
||||
void HandlePngToGbaPaletteCommand(char *inputPath, char *outputPath, int argc UNUSED, char **argv UNUSED)
|
||||
{
|
||||
struct Palette palette = {0};
|
||||
struct Palette palette = {};
|
||||
|
||||
ReadPngPalette(inputPath, &palette);
|
||||
WriteGbaPalette(outputPath, &palette);
|
||||
@ -226,7 +226,7 @@ void HandlePngToGbaPaletteCommand(char *inputPath, char *outputPath, int argc UN
|
||||
|
||||
void HandleGbaToJascPaletteCommand(char *inputPath, char *outputPath, int argc UNUSED, char **argv UNUSED)
|
||||
{
|
||||
struct Palette palette = {0};
|
||||
struct Palette palette = {};
|
||||
|
||||
ReadGbaPalette(inputPath, &palette);
|
||||
WriteJascPalette(outputPath, &palette);
|
||||
@ -259,7 +259,7 @@ void HandleJascToGbaPaletteCommand(char *inputPath, char *outputPath, int argc,
|
||||
}
|
||||
}
|
||||
|
||||
struct Palette palette = {0};
|
||||
struct Palette palette = {};
|
||||
|
||||
ReadJascPalette(inputPath, &palette);
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdarg>
|
||||
#include <stdexcept>
|
||||
#include "preproc.h"
|
||||
#include "asm_file.h"
|
||||
#include "char_util.h"
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdarg>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include "preproc.h"
|
||||
|
Loading…
Reference in New Issue
Block a user