Merge branch 'master' into battle_engine_v2

This commit is contained in:
DizzyEggg 2019-03-01 13:29:50 +01:00
commit bfe95bc4b9
20 changed files with 1622 additions and 1509 deletions

View File

@ -1163,12 +1163,12 @@
.endm
@ Changes the metatile at (x, y) on the current map.
.macro setmetatile x:req, y:req, metatile_number:req, tile_attrib:req
.macro setmetatile x:req, y:req, metatile_number:req, has_collision:req
.byte 0xa2
.2byte \x
.2byte \y
.2byte \metatile_number
.2byte \tile_attrib
.2byte \has_collision
.endm
@ Queues a weather change to the default weather for the map.

10
data/slot_machine.s Normal file → Executable file
View File

@ -712,7 +712,7 @@ gUnknown_083EDBC4:: @ 85A82CC
.4byte NULL
.align 2
sSlotMachineSpriteSheets:: @ 85A8334
gSlotMachineSpriteSheets:: @ 85A8334
obj_tiles gSlotMachineReelSymbol1Tiles, 0x0200, 0x0000
obj_tiles gSlotMachineReelSymbol2Tiles, 0x0200, 0x0001
obj_tiles gSlotMachineReelSymbol3Tiles, 0x0200, 0x0002
@ -771,12 +771,12 @@ gUnknown_083EDD1C:: @ 85A841C
gUnknown_083EDD30:: @ 85A8430
.byte 0x4A, 0x4B, 0x4C, 0x4E, 0x4D
gUnknown_083EDD35:: @ 85A8435
gBettingTilesId:: @ 85A8435
.byte 0, 0
.byte 1, 2
.byte 3, 4
gUnknown_083EDD3B:: @ 85A843B
gNumberBettingTiles:: @ 85A843B
.byte 1, 2, 2
gUnknown_085A843E:: @ 85A843E
@ -830,10 +830,10 @@ gSlotMachineSpritePalettes:: @ 85A8544
obj_pal gUnknown_08DCF1F0, 7
null_obj_pal
sReelTimeGfx:: @ 85A858C
gReelTimeGfx:: @ 85A858C
.incbin "graphics/slot_machine/reel_time_gfx.4bpp.lz"
sReelTimeWindowTilemap:: @ 85A96E0
gReelTimeWindowTilemap:: @ 85A96E0
@if anyone knows what this tilemap is please do share
.incbin "graphics/slot_machine/85A96E0.bin"

View File

@ -1,6 +1,13 @@
#ifndef GUARD_GLOBAL_FIELDMAP_H
#define GUARD_GLOBAL_FIELDMAP_H
#define METATILE_COLLISION_MASK 0x0C00
#define METATILE_ID_MASK 0x03FF
#define METATILE_ID_UNDEFINED 0x03FF
#define METATILE_ELEVATION_SHIFT 12
#define METATILE_COLLISION_SHIFT 10
#define METATILE_ELEVATION_MASK 0xF000
enum
{
CONNECTION_SOUTH = 1,
@ -19,8 +26,8 @@ struct Tileset
/*0x01*/ bool8 isSecondary;
/*0x04*/ void *tiles;
/*0x08*/ void *palettes;
/*0x0c*/ void *metatiles;
/*0x10*/ void *metatileAttributes;
/*0x0c*/ u16 *metatiles;
/*0x10*/ u16 *metatileAttributes;
/*0x14*/ TilesetCB callback;
};

View File

@ -1,6 +1,20 @@
#ifndef GUARD_SLOT_MACHINE_H
#define GUARD_SLOT_MACHINE_H
#define NUM_REELS 3
#define REEL_NUM_TAGS 21
#define REEL_TAG_HEIGHT 24
// 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

View File

@ -1,6 +1,9 @@
#ifndef GUARD_TASK_H
#define GUARD_TASK_H
#define HEAD_SENTINEL 0xFE
#define TAIL_SENTINEL 0xFF
#define NUM_TASKS 16
typedef void (*TaskFunc)(u8 taskId);

View File

@ -1,6 +1,9 @@
#ifndef GUARD_TV_H
#define GUARD_TV_H
#define SLOT_MACHINE 0
#define ROULETTE 1
extern u8 *const gTVStringVarPtrs[3];
void ClearTVShowData(void);
@ -23,9 +26,9 @@ bool8 GetPriceReduction(u8 newsKind);
void sub_80F14F8(TVShow *shows);
size_t CountDigits(int value);
u8 GetRibbonCount(struct Pokemon *pokemon);
void sub_80EDE70(u16 nCoinsSpent);
void sub_80EDE84(u16 nCoinsSpent);
void sub_80EDD78(u16 nCoinsPaidOut);
void AlertTVThatPlayerPlayedSlotMachine(u16 nCoinsSpent);
void AlertTVThatPlayerPlayedRoulette(u16 nCoinsSpent);
void AlertTVOfNewCoinTotal(u16 nCoinsPaidOut);
void sub_80EEA70(void);
void sub_80EDB44(void);
void sub_80EDC60(const u16 *words);

View File

@ -3470,7 +3470,7 @@ void AnimOrbitFast(struct Sprite *sprite)
static void AnimOrbitFastStep(struct Sprite *sprite)
{
if ((u16)(sprite->data[1] - 64) < 128)
if (sprite->data[1] >= 64 && sprite->data[1] <= 191)
sprite->subpriority = sprite->data[7] + 1;
else
sprite->subpriority = sprite->data[7] - 1;

View File

@ -1267,7 +1267,7 @@ static u8 GetPostBattleDirectionHintTextIndex(int *hintType, u8 minDistanceForEx
{
for (x = 0; x < 32; x++)
{
if ((map[x] & 0x3FF) == FLOOR_EXIT_METATILE)
if ((map[x] & METATILE_ID_MASK) == FLOOR_EXIT_METATILE)
{
x += 7 - gEventObjects[gSelectedEventObject].initialCoords.x;
y += 7 - gEventObjects[gSelectedEventObject].initialCoords.y;
@ -1568,7 +1568,7 @@ void GenerateBattlePyramidFloorLayout(u16 *backupMapData, bool8 setPlayerPositio
{
for (x = 0; x < mapLayout->width; x++)
{
if ((layoutMap[x] & 0x3FF) != FLOOR_EXIT_METATILE)
if ((layoutMap[x] & METATILE_ID_MASK) != FLOOR_EXIT_METATILE)
{
map[x] = layoutMap[x];
}

View File

@ -1056,7 +1056,7 @@ void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 widt
for (x16 = x; x16 < (x + width); x16++)
{
CopyTileMapEntry(&firstTileNum, &((u16*)sGpuBgConfigs2[bg].tilemap)[(u16)GetTileMapIndexFromCoords(x16, y16, attribute, mode, mode2)], paletteSlot, 0, 0);
firstTileNum = (firstTileNum & 0xFC00) + ((firstTileNum + tileNumDelta) & 0x3FF);
firstTileNum = (firstTileNum & (METATILE_COLLISION_MASK | METATILE_ELEVATION_MASK)) + ((firstTileNum + tileNumDelta) & METATILE_ID_MASK);
}
}
break;
@ -1067,7 +1067,7 @@ void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 widt
for (x16 = x; x16 < (x + width); x16++)
{
((u8*)sGpuBgConfigs2[bg].tilemap)[(y16 * mode3) + x16] = firstTileNum;
firstTileNum = (firstTileNum & 0xFC00) + ((firstTileNum + tileNumDelta) & 0x3FF);
firstTileNum = (firstTileNum & (METATILE_COLLISION_MASK | METATILE_ELEVATION_MASK)) + ((firstTileNum + tileNumDelta) & METATILE_ID_MASK);
}
}
break;

View File

@ -1158,7 +1158,7 @@ void sub_8127B90(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight, u16 decor)
u16 i;
u16 j;
u16 behavior;
u16 flags;
u16 impassableFlag;
u16 v0;
u16 v1;
s16 decLeft;
@ -1173,11 +1173,11 @@ void sub_8127B90(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight, u16 decor)
behavior = GetBehaviorByMetatileId(0x200 + gDecorations[decor].tiles[i * decWidth + j]);
if (MetatileBehavior_IsSecretBaseImpassable(behavior) == TRUE || (gDecorations[decor].permission != DECORPERM_PASS_FLOOR && (behavior >> 12)))
{
flags = 0xc00;
impassableFlag = METATILE_COLLISION_MASK;
}
else
{
flags = 0x000;
impassableFlag = 0x000;
}
if (gDecorations[decor].permission != DECORPERM_NA_WALL && MetatileBehavior_IsSecretBaseNorthWall(MapGridGetMetatileBehaviorAt(decLeft, decBottom)) == TRUE)
{
@ -1190,11 +1190,11 @@ void sub_8127B90(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight, u16 decor)
v1 = sub_8127B54(gDecorations[decor].id, i * decWidth + j);
if (v1 != 0xFFFF)
{
MapGridSetMetatileEntryAt(decLeft, decBottom, (gDecorations[decor].tiles[i * decWidth + j] + (0x200 | v0)) | flags | v1);
MapGridSetMetatileEntryAt(decLeft, decBottom, (gDecorations[decor].tiles[i * decWidth + j] + (0x200 | v0)) | impassableFlag | v1);
}
else
{
MapGridSetMetatileIdAt(decLeft, decBottom, (gDecorations[decor].tiles[i * decWidth + j] + (0x200 | v0)) | flags);
MapGridSetMetatileIdAt(decLeft, decBottom, (gDecorations[decor].tiles[i * decWidth + j] + (0x200 | v0)) | impassableFlag);
}
}
}
@ -1502,7 +1502,7 @@ bool8 sub_812853C(u8 taskId, const struct Decoration *decoration)
{
curX = gTasks[taskId].data[0] + j;
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & 0xf000;
behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & METATILE_ELEVATION_MASK;
if (!sub_81284F4(behaviorAt, decoration))
{
return FALSE;
@ -1527,7 +1527,7 @@ bool8 sub_812853C(u8 taskId, const struct Decoration *decoration)
{
curX = gTasks[taskId].data[0] + j;
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & 0xf000;
behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & METATILE_ELEVATION_MASK;
if (!MetatileBehavior_IsNormal(behaviorAt) && !sub_8128484(behaviorAt, behaviorBy))
{
return FALSE;
@ -1547,7 +1547,7 @@ bool8 sub_812853C(u8 taskId, const struct Decoration *decoration)
{
curX = gTasks[taskId].data[0] + j;
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[j]) & 0xf000;
behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[j]) & METATILE_ELEVATION_MASK;
if (!MetatileBehavior_IsNormal(behaviorAt) && !MetatileBehavior_IsSecretBaseNorthWall(behaviorAt))
{
return FALSE;

View File

@ -2620,7 +2620,7 @@ static void sub_80B8874(u16 offs)
dest = (u16 *)(VRAM + 0x140 + offs);
for (i = 0; i < 0x140; i++, dest++)
{
*dest = gFieldMoveStreaksTilemap[i] | 0xf000;
*dest = gFieldMoveStreaksTilemap[i] | METATILE_ELEVATION_MASK;
}
}

View File

@ -887,8 +887,8 @@ static void PetalburgGymFunc(u8 a0, u16 a1)
}
for (i = 0; i < nDoors; i++)
{
MapGridSetMetatileIdAt(x[i] + 7, y[i] + 7, a1 | 0xc00);
MapGridSetMetatileIdAt(x[i] + 7, y[i] + 8, (a1 + 8) | 0xc00);
MapGridSetMetatileIdAt(x[i] + 7, y[i] + 7, a1 | METATILE_COLLISION_MASK);
MapGridSetMetatileIdAt(x[i] + 7, y[i] + 8, (a1 + 8) | METATILE_COLLISION_MASK);
}
DrawWholeMapView();
}
@ -1100,7 +1100,7 @@ static void PCTurnOnEffect_1(s16 flag, s8 dx, s8 dy)
tileId = 0x27e;
}
}
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | 0xc00);
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | METATILE_COLLISION_MASK);
}
void DoPCTurnOffEffect(void)
@ -1141,7 +1141,7 @@ static void PCTurnOffEffect(void)
{
tileId = 0x259;
}
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | 0xc00);
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | METATILE_COLLISION_MASK);
DrawWholeMapView();
}
@ -1892,7 +1892,7 @@ static void sub_8139C80(u8 taskId)
{
for (x = 0; x < 3; x++)
{
MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2BF4[y][data[0] % 3] | 0xC00);
MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2BF4[y][data[0] % 3] | METATILE_COLLISION_MASK);
}
}
}
@ -1902,7 +1902,7 @@ static void sub_8139C80(u8 taskId)
{
for (x = 0; x < 3; x++)
{
MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2C06[y][data[0] % 3] | 0xC00);
MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2C06[y][data[0] % 3] | METATILE_COLLISION_MASK);
}
}
}

View File

@ -383,15 +383,15 @@ u8 MapGridGetZCoordAt(int x, int y)
i = (x + 1) & 1;
i += ((y + 1) & 1) * 2;
block = gMapHeader.mapLayout->border[i];
block |= 0xc00;
block |= METATILE_COLLISION_MASK;
}
if (block == 0x3ff)
if (block == METATILE_ID_UNDEFINED)
{
return 0;
}
return block >> 12;
return block >> METATILE_ELEVATION_SHIFT;
}
u8 MapGridIsImpassableAt(int x, int y)
@ -411,13 +411,13 @@ u8 MapGridIsImpassableAt(int x, int y)
i = (x + 1) & 1;
i += ((y + 1) & 1) * 2;
block = gMapHeader.mapLayout->border[i];
block |= 0xc00;
block |= METATILE_COLLISION_MASK;
}
if (block == 0x3ff)
if (block == METATILE_ID_UNDEFINED)
{
return 1;
}
return (block & 0xc00) >> 10;
return (block & METATILE_COLLISION_MASK) >> METATILE_COLLISION_SHIFT;
}
u32 MapGridGetMetatileIdAt(int x, int y)
@ -439,18 +439,19 @@ u32 MapGridGetMetatileIdAt(int x, int y)
mapLayout = gMapHeader.mapLayout;
i = (x + 1) & 1;
i += ((y + 1) & 1) * 2;
block = mapLayout->border[i] | 0xc00;
block = mapLayout->border[i] | METATILE_COLLISION_MASK;
}
if (block == 0x3ff)
if (block == METATILE_ID_UNDEFINED)
{
border = gMapHeader.mapLayout->border;
j = (x + 1) & 1;
j += ((y + 1) & 1) * 2;
block2 = gMapHeader.mapLayout->border[j];
block2 |= 0xc00;
return block2 & block;
// This OR is completely pointless.
block2 |= METATILE_COLLISION_MASK;
return block2 & METATILE_ID_MASK;
}
return block & 0x3ff;
return block & METATILE_ID_MASK;
}
u32 MapGridGetMetatileBehaviorAt(int x, int y)
@ -464,7 +465,7 @@ u8 MapGridGetMetatileLayerTypeAt(int x, int y)
{
u16 metatile;
metatile = MapGridGetMetatileIdAt(x, y);
return (GetBehaviorByMetatileId(metatile) & 0xf000) >> 12;
return (GetBehaviorByMetatileId(metatile) & METATILE_ELEVATION_MASK) >> METATILE_ELEVATION_SHIFT;
}
void MapGridSetMetatileIdAt(int x, int y, u16 metatile)
@ -474,7 +475,7 @@ void MapGridSetMetatileIdAt(int x, int y, u16 metatile)
&& y >= 0 && y < gBackupMapLayout.height)
{
i = x + y * gBackupMapLayout.width;
gBackupMapLayout.map[i] = (gBackupMapLayout.map[i] & 0xf000) | (metatile & 0xfff);
gBackupMapLayout.map[i] = (gBackupMapLayout.map[i] & METATILE_ELEVATION_MASK) | (metatile & ~METATILE_ELEVATION_MASK);
}
}
@ -654,7 +655,7 @@ int GetMapBorderIdAt(int x, int y)
i = gBackupMapLayout.width;
i *= y;
block = gBackupMapLayout.map[x + i];
if (block == 0x3ff)
if (block == METATILE_ID_UNDEFINED)
{
goto fail;
}
@ -664,8 +665,8 @@ int GetMapBorderIdAt(int x, int y)
mapLayout = gMapHeader.mapLayout;
j = (x + 1) & 1;
j += ((y + 1) & 1) * 2;
block2 = 0xc00 | mapLayout->border[j];
if (block2 == 0x3ff)
block2 = METATILE_COLLISION_MASK | mapLayout->border[j];
if (block2 == METATILE_ID_UNDEFINED)
{
goto fail;
}
@ -921,9 +922,9 @@ void sub_8088B94(int x, int y, int a2)
if (x >= 0 && x < gBackupMapLayout.width && y >= 0 && y < gBackupMapLayout.height)
{
if (a2 != 0)
gBackupMapLayout.map[x + gBackupMapLayout.width * y] |= 0xC00;
gBackupMapLayout.map[x + gBackupMapLayout.width * y] |= METATILE_COLLISION_MASK;
else
gBackupMapLayout.map[x + gBackupMapLayout.width * y] &= 0xF3FF;
gBackupMapLayout.map[x + gBackupMapLayout.width * y] &= ~METATILE_COLLISION_MASK;
}
}
@ -937,7 +938,7 @@ static bool8 SkipCopyingMetatileFromSavedMap(u16* mapMetatilePtr, u16 mapWidth,
else
mapMetatilePtr += mapWidth;
if (sub_80FADE4(*mapMetatilePtr & 0x3FF, yMode) == 1)
if (sub_80FADE4(*mapMetatilePtr & METATILE_ID_MASK, yMode) == 1)
return TRUE;
return FALSE;
}

View File

@ -7,7 +7,7 @@
static EWRAM_DATA u8 sEscalatorAnim_TaskId = 0;
static void sub_80E12E8(u8 taskId, const s16 *list, u16 c)
static void sub_80E12E8(u8 taskId, const s16 *list, u16 isImpassableFlag)
{
s16 r5 = gTasks[taskId].data[4] - 1;
s16 r3 = gTasks[taskId].data[5] - 1;
@ -26,9 +26,9 @@ static void sub_80E12E8(u8 taskId, const s16 *list, u16 c)
if (list[r4] == metatileId)
{
if (r4 != 2)
MapGridSetMetatileIdAt(r5 + x, r3 + y, c | list[r4 + 1]);
MapGridSetMetatileIdAt(r5 + x, r3 + y, isImpassableFlag | list[r4 + 1]);
else
MapGridSetMetatileIdAt(r5 + x, r3 + y, c | list[0]);
MapGridSetMetatileIdAt(r5 + x, r3 + y, isImpassableFlag | list[0]);
}
}
}
@ -44,9 +44,9 @@ static void sub_80E12E8(u8 taskId, const s16 *list, u16 c)
if (list[2 - r4] == metatileId)
{
if (r4 != 2)
MapGridSetMetatileIdAt(r5 + x, r3 + y, c | list[1 - r4]);
MapGridSetMetatileIdAt(r5 + x, r3 + y, isImpassableFlag | list[1 - r4]);
else
MapGridSetMetatileIdAt(r5 + x, r3 + y, c | list[2]);
MapGridSetMetatileIdAt(r5 + x, r3 + y, isImpassableFlag | list[2]);
}
}
}
@ -76,13 +76,13 @@ static void sub_80E1444(u8 taskId)
sub_80E12E8(taskId, gUnknown_08589AC0, 0);
break;
case 2:
sub_80E12E8(taskId, gUnknown_08589AC6, 0xC00);
sub_80E12E8(taskId, gUnknown_08589AC6, METATILE_COLLISION_MASK);
break;
case 3:
sub_80E12E8(taskId, gUnknown_08589ACC, 0);
break;
case 4:
sub_80E12E8(taskId, gUnknown_08589AD2, 0xC00);
sub_80E12E8(taskId, gUnknown_08589AD2, METATILE_COLLISION_MASK);
break;
case 5:
sub_80E12E8(taskId, gUnknown_08589AD8, 0);

View File

@ -996,7 +996,7 @@ static void sub_81405CC(void)
taskId = gUnknown_0203AB88->varA4 = CreateTask(sub_81408A8, 0);
gTasks[taskId].data[6] = 6;
gTasks[taskId].data[13] = GetCoins();
sub_80EDE84(GetCoins());
AlertTVThatPlayerPlayedRoulette(GetCoins());
gUnknown_0203AB88->varA5 = CreateTask(sub_8140814, 1);
SetMainCallback2(sub_8140238);
return;
@ -1964,7 +1964,7 @@ static void sub_8141DE4(u8 taskId)
gSpecialVar_0x8004 = TRUE;
else
gSpecialVar_0x8004 = FALSE;
sub_80EDD78(GetCoins());
AlertTVOfNewCoinTotal(GetCoins());
BeginHardwarePaletteFade(0xFF, 0, 0, 16, 0);
gTasks[taskId].func = sub_8141E7C;
}

View File

@ -2028,14 +2028,14 @@ bool8 ScrCmd_setmetatile(struct ScriptContext *ctx)
u16 x = VarGet(ScriptReadHalfword(ctx));
u16 y = VarGet(ScriptReadHalfword(ctx));
u16 tileId = VarGet(ScriptReadHalfword(ctx));
u16 v8 = VarGet(ScriptReadHalfword(ctx));
u16 isImpassable = VarGet(ScriptReadHalfword(ctx));
x += 7;
y += 7;
if (!v8)
if (!isImpassable)
MapGridSetMetatileIdAt(x, y, tileId);
else
MapGridSetMetatileIdAt(x, y, tileId | 0xC00);
MapGridSetMetatileIdAt(x, y, tileId | METATILE_COLLISION_MASK);
return FALSE;
}

View File

@ -259,7 +259,7 @@ void sub_80E8CB0(s16 *xPtr, s16 *yPtr, u16 tile)
{
for (x = 0; x < mapLayout->width; x ++)
{
if ((mapLayout->map[y * mapLayout->width + x] & 0x3ff) == tile)
if ((mapLayout->map[y * mapLayout->width + x] & METATILE_ID_MASK) == tile)
{
*xPtr = x;
*yPtr = y;
@ -282,7 +282,7 @@ void sub_80E8D4C(void)
{
if (gUnknown_0858CFCC[i].tile1 == tile)
{
MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile2 | 0xC00);
MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile2 | METATILE_COLLISION_MASK);
CurrentMapDrawMetatileAt(x, y);
return;
}
@ -291,7 +291,7 @@ void sub_80E8D4C(void)
{
if (gUnknown_0858CFCC[i].tile2 == tile)
{
MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile1 | 0xC00);
MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile1 | METATILE_COLLISION_MASK);
CurrentMapDrawMetatileAt(x, y);
return;
}
@ -352,7 +352,7 @@ void sub_80E8EE0(struct MapEvents const *events)
{
if (gUnknown_0858CFCC[i].tile1 == tile_id)
{
MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile2 | 0xc00);
MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile2 | METATILE_COLLISION_MASK);
break;
}
}
@ -434,7 +434,7 @@ void sub_80E9108(void)
sub_80E8CB0(&x, &y, 0x220);
x += 7;
y += 7;
MapGridSetMetatileIdAt(x, y, 0x220 | 0xC00);
MapGridSetMetatileIdAt(x, y, 0x220 | METATILE_COLLISION_MASK);
CurrentMapDrawMetatileAt(x, y);
pal_fill_black();
CreateTask(sub_80E90C8, 0);
@ -492,12 +492,12 @@ void sub_80E9238(u8 flagIn)
if (curBaseId != 0)
{
sub_80E8CB0(&x, &y, 0x220);
MapGridSetMetatileIdAt(x + 7, y + 7, 0x221 | 0xc00);
MapGridSetMetatileIdAt(x + 7, y + 7, 0x221 | METATILE_COLLISION_MASK);
}
else if (flagIn == 1 && VarGet(VAR_0x4089) == 1)
{
sub_80E8CB0(&x, &y, 0x220);
MapGridSetMetatileIdAt(x + 7, y + 7, 0x20a | 0xc00);
MapGridSetMetatileIdAt(x + 7, y + 7, 0x20a | METATILE_COLLISION_MASK);
}
}
}
@ -791,7 +791,7 @@ void sub_80E9AD0(void)
{
if (gUnknown_0858CFCC[j].tile2 == tile)
{
MapGridSetMetatileIdAt(events->bgEvents[i].x + 7, events->bgEvents[i].y + 7, gUnknown_0858CFCC[j].tile1 | 0xc00);
MapGridSetMetatileIdAt(events->bgEvents[i].x + 7, events->bgEvents[i].y + 7, gUnknown_0858CFCC[j].tile1 | METATILE_COLLISION_MASK);
break;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,6 @@
#include "global.h"
#include "task.h"
#define HEAD_SENTINEL 0xFE
#define TAIL_SENTINEL 0xFF
struct Task gTasks[NUM_TASKS];
static void InsertTask(u8 newTaskId);

View File

@ -39,6 +39,7 @@
#include "tv.h"
#include "data2.h"
#include "constants/layouts.h"
#include "constants/metatile_behaviors.h"
// Static type declarations
@ -62,7 +63,7 @@ IWRAM_DATA s8 sTVShowMixingCurSlot;
EWRAM_DATA u16 sPokemonAnglerSpecies = 0;
EWRAM_DATA u16 sPokemonAnglerAttemptCounters = 0;
EWRAM_DATA u16 sFindThatGamerCoinsSpent = 0;
EWRAM_DATA bool8 sFindThatGamerWhichGame = FALSE;
EWRAM_DATA u8 sFindThatGamerWhichGame = SLOT_MACHINE;
EWRAM_DATA ALIGNED(4) u8 sRecordMixingPartnersWithoutShowsToShare = 0;
EWRAM_DATA ALIGNED(4) u8 sTVShowState = 0;
EWRAM_DATA u8 sTVSecretBaseSecretsRandomValues[3] = {};
@ -853,9 +854,9 @@ void SetTVMetatilesOnMap(int width, int height, u16 tileId)
{
for (x = 0; x < width; x ++)
{
if (MapGridGetMetatileBehaviorAt(x, y) == 0x86) // is this tile a TV?
if (MapGridGetMetatileBehaviorAt(x, y) == MB_TELEVISION)
{
MapGridSetMetatileIdAt(x, y, tileId | 0xc00);
MapGridSetMetatileIdAt(x, y, tileId | METATILE_COLLISION_MASK);
}
}
}
@ -2019,7 +2020,7 @@ void sub_80EDCE8(void)
}
}
void sub_80EDD78(u16 nCoinsPaidOut)
void AlertTVOfNewCoinTotal(u16 nCoinsPaidOut)
{
TVShow *show;
bool8 flag;
@ -2031,7 +2032,7 @@ void sub_80EDD78(u16 nCoinsPaidOut)
flag = FALSE;
switch (sFindThatGamerWhichGame)
{
case FALSE:
case SLOT_MACHINE:
if (nCoinsPaidOut >= sFindThatGamerCoinsSpent + 200)
{
flag = TRUE;
@ -2044,7 +2045,7 @@ void sub_80EDD78(u16 nCoinsPaidOut)
break;
}
return;
case TRUE:
case ROULETTE:
if (nCoinsPaidOut >= sFindThatGamerCoinsSpent + 50)
{
flag = TRUE;
@ -2072,15 +2073,15 @@ void sub_80EDD78(u16 nCoinsPaidOut)
}
}
void sub_80EDE70(u16 nCoinsSpent)
void AlertTVThatPlayerPlayedSlotMachine(u16 nCoinsSpent)
{
sFindThatGamerWhichGame = FALSE;
sFindThatGamerWhichGame = SLOT_MACHINE;
sFindThatGamerCoinsSpent = nCoinsSpent;
}
void sub_80EDE84(u16 nCoinsSpent)
void AlertTVThatPlayerPlayedRoulette(u16 nCoinsSpent)
{
sFindThatGamerWhichGame = TRUE;
sFindThatGamerWhichGame = ROULETTE;
sFindThatGamerCoinsSpent = nCoinsSpent;
}