Merge commit 'd1d543548772cbdf087c5ccc1e0b19980aa9ad87' into pret-merge

Conflicts:
	spritesheet_rules.mk
	tools/mapjson/mapjson.cpp
This commit is contained in:
Hedara 2025-11-01 15:13:16 +01:00
commit 5c31b58b81
16 changed files with 94 additions and 46 deletions

View File

@ -684,6 +684,14 @@
map \map
.endm
@ Set the player object's invisibility to FALSE.
.macro showplayer
.byte SCR_OP_SHOWOBJECTAT
.2byte LOCALID_PLAYER
.byte 0 @ map group
.byte 0 @ map num
.endm
@ Sets the specified object's invisibility to TRUE.
.macro hideobjectat localId:req, map:req
.byte SCR_OP_HIDEOBJECTAT
@ -691,6 +699,14 @@
map \map
.endm
@ Set the player object's invisibility to TRUE.
.macro hideplayer
.byte SCR_OP_HIDEOBJECTAT
.2byte LOCALID_PLAYER
.byte 0 @ map group
.byte 0 @ map num
.endm
@ Turns the currently selected object (if there is one) to face the player.
.macro faceplayer
.byte SCR_OP_FACEPLAYER

View File

@ -2,8 +2,12 @@
@ Takes a MAP constant and outputs the map group and map number as separate bytes
.macro map map_id:req
.ifdef \map_id
.byte \map_id >> 8 @ map group
.byte \map_id & 0xFF @ map num
.else
.error "undefined map (check for typos)"
.endif
.endm
@ Defines a map script. 'type' is any MAP_SCRIPT_* constant (see include/constants/map_scripts.h)

View File

@ -835,7 +835,7 @@ EventScript_UnusedBoardFerry::
delay 30
applymovement LOCALID_PLAYER, Common_Movement_WalkInPlaceFasterUp
waitmovement 0
showobjectat LOCALID_PLAYER, 0
showplayer
delay 30
applymovement LOCALID_PLAYER, Movement_UnusedBoardFerry
waitmovement 0
@ -850,7 +850,7 @@ Common_EventScript_FerryDepartIsland::
call_if_eq VAR_FACING, DIR_SOUTH, Ferry_EventScript_DepartIslandSouth
call_if_eq VAR_FACING, DIR_WEST, Ferry_EventScript_DepartIslandWest
delay 30
hideobjectat LOCALID_PLAYER, 0
hideplayer
call Common_EventScript_FerryDepart
return

View File

@ -333,7 +333,7 @@ LilycoveCity_Harbor_EventScript_BoardFerryWithSailor::
call_if_eq VAR_FACING, DIR_NORTH, LilycoveCity_Harbor_EventScript_PlayerBoardFerryNorth
call_if_eq VAR_FACING, DIR_EAST, LilycoveCity_Harbor_EventScript_PlayerBoardFerryEast
delay 30
hideobjectat LOCALID_PLAYER, 0
hideplayer
setvar VAR_0x8004, LOCALID_LILYCOVE_HARBOR_SS_TIDAL
call Common_EventScript_FerryDepart
return
@ -393,7 +393,7 @@ LilycoveCity_Harbor_EventScript_BoardFerry::
call_if_eq VAR_FACING, DIR_NORTH, LilycoveCity_Harbor_EventScript_PlayerBoardFerryNorth
call_if_eq VAR_FACING, DIR_EAST, LilycoveCity_Harbor_EventScript_PlayerBoardFerryEast
delay 30
hideobjectat LOCALID_PLAYER, 0
hideplayer
setvar VAR_0x8004, LOCALID_LILYCOVE_HARBOR_SS_TIDAL
call Common_EventScript_FerryDepart
return

View File

@ -156,7 +156,7 @@ LittlerootTown_EventScript_GoInsideWithMom::
waitmovement 0
setflag FLAG_HIDE_LITTLEROOT_TOWN_MOM_OUTSIDE
setvar VAR_LITTLEROOT_INTRO_STATE, 3
hideobjectat LOCALID_PLAYER, 0
hideplayer
closedoor VAR_0x8004, VAR_0x8005
waitdooranim
clearflag FLAG_HIDE_LITTLEROOT_TOWN_FAT_MAN

View File

@ -228,7 +228,7 @@ SlateportCity_Harbor_EventScript_BoardFerry::
call_if_eq VAR_FACING, DIR_NORTH, SlateportCity_Harbor_EventScript_BoardFerryNorth
call_if_eq VAR_FACING, DIR_EAST, SlateportCity_Harbor_EventScript_BoardFerryEast
delay 30
hideobjectat LOCALID_PLAYER, 0
hideplayer
setvar VAR_0x8004, LOCALID_SLATEPORT_HARBOR_SS_TIDAL
call Common_EventScript_FerryDepart
return

View File

@ -356,7 +356,7 @@ CableClub_EventScript_EnterColosseum::
waitdooranim
applymovement LOCALID_PLAYER, Movement_PlayerEnterLinkRoom
waitmovement 0
hideobjectat LOCALID_PLAYER, 0
hideplayer
closedoor 9, 1
waitdooranim
release
@ -450,7 +450,7 @@ CableClub_EventScript_EnterTradeCenter::
waitdooranim
applymovement LOCALID_PLAYER, Movement_PlayerEnterLinkRoom
waitmovement 0
hideobjectat LOCALID_PLAYER, 0
hideplayer
closedoor 9, 1
waitdooranim
release
@ -515,7 +515,7 @@ CableClub_EventScript_EnterRecordCorner::
waitdooranim
applymovement LOCALID_PLAYER, Movement_PlayerEnterLinkRoom
waitmovement 0
hideobjectat LOCALID_PLAYER, 0
hideplayer
closedoor 9, 1
waitdooranim
release
@ -902,7 +902,7 @@ CableClub_EventScript_EnterUnionRoom::
waitdooranim
applymovement LOCALID_PLAYER, Movement_PlayerEnterLinkRoom
waitmovement 0
hideobjectat LOCALID_PLAYER, 0
hideplayer
closedoor 5, 1
waitdooranim
special Script_ResetUnionRoomTrade
@ -1202,7 +1202,7 @@ CableClub_EventScript_EnterWirelessLinkRoom::
waitdooranim
applymovement LOCALID_PLAYER, Movement_PlayerEnterLinkRoom
waitmovement 0
hideobjectat LOCALID_PLAYER, 0
hideplayer
closedoor 9, 1
waitdooranim
release
@ -1384,7 +1384,7 @@ MossdeepCity_GameCorner_1F_EventScript_EnterMinigameRoom::
closemessage
applymovement LOCALID_PLAYER, Movement_PlayerEnterMinigameRoom
waitmovement 0
hideobjectat LOCALID_PLAYER, 0
hideplayer
release
waitstate
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 B

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 293 B

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 B

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 B

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

After

Width:  |  Height:  |  Size: 328 B

View File

@ -3,11 +3,14 @@
#include "map_groups.h"
// Warps using this map will instead use the warp data stored in gSaveBlock1Ptr->dynamicWarp.
// Used for warps that need to change destinations, e.g. when stepping off an elevator.
#define MAP_DYNAMIC (0x7F | (0x7F << 8))
enum
{
// Warps using this map will instead use the warp data stored in gSaveBlock1Ptr->dynamicWarp.
// Used for warps that need to change destinations, e.g. when stepping off an elevator.
MAP_DYNAMIC = (0x7F | (0x7F << 8)),
#define MAP_UNDEFINED (0xFF | (0xFF << 8))
MAP_UNDEFINED = (0xFF | (0xFF << 8)),
};
#define MAP_GROUP(map) (map >> 8)
#define MAP_NUM(map) (map & 0xFF)

View File

@ -1,6 +1,7 @@
POKEMONGFXDIR := graphics/pokemon
OBJEVENTGFXDIR := graphics/object_events/pics
FLDEFFGFXDIR := graphics/field_effects/pics
BATINTGFXDIR := graphics/battle_interface
MISCGFXDIR := graphics/misc
$(OBJEVENTGFXDIR)/people/brendan/walking.4bpp: %.4bpp: %.png
@ -4934,3 +4935,18 @@ $(OBJEVENTGFXDIR)/misc/ball_%.4bpp: $(OBJEVENTGFXDIR)/misc/ball_%.png ; $(GFX) $
graphics/door_anims/battle_tower_multi_corridor.4bpp: %.4bpp: %.png
$(GFX) $< $@ -mwidth 2 -mheight 4
$(BATINTGFXDIR)/healthbox_doubles_opponent.4bpp: %.4bpp: %.png
$(GFX) $< $@ -mwidth 8 -mheight 4
$(BATINTGFXDIR)/healthbox_doubles_player.4bpp: %.4bpp: %.png
$(GFX) $< $@ -mwidth 8 -mheight 4
$(BATINTGFXDIR)/healthbox_safari.4bpp: %.4bpp: %.png
$(GFX) $< $@ -mwidth 8 -mheight 8
$(BATINTGFXDIR)/healthbox_singles_opponent.4bpp: %.4bpp: %.png
$(GFX) $< $@ -mwidth 8 -mheight 4
$(BATINTGFXDIR)/healthbox_singles_player.4bpp: %.4bpp: %.png
$(GFX) $< $@ -mwidth 8 -mheight 8

View File

@ -314,6 +314,11 @@ enum {
DIG_DISPLAY_BONUS_BIG
};
// IDs for the text windows
enum {
WIN_MSG,
WIN_INFO,
};
// How ReelTime works
// ==================
@ -1249,7 +1254,7 @@ static void SlotMachineSetup_LoadGfxAndTilemaps(void)
LoadSlotMachineGfx();
LoadMessageBoxGfx(0, 0x200, BG_PLTT_ID(15));
LoadUserWindowBorderGfx(0, 0x214, BG_PLTT_ID(14));
PutWindowTilemap(0);
PutWindowTilemap(WIN_MSG);
}
static void CreateSlotMachineSprites(void)
@ -1390,9 +1395,9 @@ static bool8 SlotTask_HandleBetInput(struct Task *task)
// SLOTTASK_MSG_NEED_3_COINS
static bool8 SlotTask_PrintMsg_Need3Coins(struct Task *task)
{
DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized(0, FONT_NORMAL, gText_YouDontHaveThreeCoins, 0, 1, 0, 0);
CopyWindowToVram(0, COPYWIN_FULL);
DrawDialogueFrame(WIN_MSG, FALSE);
AddTextPrinterParameterized(WIN_MSG, FONT_NORMAL, gText_YouDontHaveThreeCoins, 0, 1, 0, 0);
CopyWindowToVram(WIN_MSG, COPYWIN_FULL);
sSlotMachine->state = SLOTTASK_WAIT_MSG_NEED_3_COINS;
return FALSE;
}
@ -1402,7 +1407,7 @@ static bool8 SlotTask_WaitMsg_Need3Coins(struct Task *task)
{
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
ClearDialogWindowAndFrame(0, TRUE);
ClearDialogWindowAndFrame(WIN_MSG, TRUE);
sSlotMachine->state = SLOTTASK_BET_INPUT;
}
return FALSE;
@ -1655,9 +1660,9 @@ static bool8 SlotTask_NoMatches(struct Task *task)
// SLOTTASK_ASK_QUIT
static bool8 SlotTask_AskQuit(struct Task *task)
{
DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized(0, FONT_NORMAL, gText_QuitTheGame, 0, 1, 0, 0);
CopyWindowToVram(0, COPYWIN_FULL);
DrawDialogueFrame(WIN_MSG, FALSE);
AddTextPrinterParameterized(WIN_MSG, FONT_NORMAL, gText_QuitTheGame, 0, 1, 0, 0);
CopyWindowToVram(WIN_MSG, COPYWIN_FULL);
CreateYesNoMenuParameterized(0x15, 7, 0x214, 0x180, 0xE, 0xF);
sSlotMachine->state = SLOTTASK_HANDLE_QUIT_INPUT;
return FALSE;
@ -1669,16 +1674,16 @@ static bool8 SlotTask_HandleQuitInput(struct Task *task)
s8 input = Menu_ProcessInputNoWrapClearOnChoose();
if (input == 0) // Chose to quit
{
ClearDialogWindowAndFrame(0, TRUE);
ClearDialogWindowAndFrame(WIN_MSG, TRUE);
DarkenBetTiles(0);
DarkenBetTiles(1);
DarkenBetTiles(2);
sSlotMachine->coins += sSlotMachine->bet;
sSlotMachine->state = SLOTTASK_END;
}
else if (input == 1 || input == -1) // Chose not to quit
else if (input == 1 || input == MENU_B_PRESSED) // Chose not to quit
{
ClearDialogWindowAndFrame(0, TRUE);
ClearDialogWindowAndFrame(WIN_MSG, TRUE);
sSlotMachine->state = SLOTTASK_BET_INPUT;
}
return FALSE;
@ -1687,9 +1692,9 @@ static bool8 SlotTask_HandleQuitInput(struct Task *task)
// SLOTTASK_MSG_MAX_COINS
static bool8 SlotTask_PrintMsg_MaxCoins(struct Task *task)
{
DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized(0, FONT_NORMAL, gText_YouveGot9999Coins, 0, 1, 0, 0);
CopyWindowToVram(0, COPYWIN_FULL);
DrawDialogueFrame(WIN_MSG, FALSE);
AddTextPrinterParameterized(WIN_MSG, FONT_NORMAL, gText_YouveGot9999Coins, 0, 1, 0, 0);
CopyWindowToVram(WIN_MSG, COPYWIN_FULL);
sSlotMachine->state = SLOTTASK_WAIT_MSG_MAX_COINS;
return FALSE;
}
@ -1699,7 +1704,7 @@ static bool8 SlotTask_WaitMsg_MaxCoins(struct Task *task)
{
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
ClearDialogWindowAndFrame(0, TRUE);
ClearDialogWindowAndFrame(WIN_MSG, TRUE);
sSlotMachine->state = SLOTTASK_BET_INPUT;
}
return FALSE;
@ -1708,9 +1713,9 @@ static bool8 SlotTask_WaitMsg_MaxCoins(struct Task *task)
// SLOTTASK_MSG_NO_MORE_COINS
static bool8 SlotTask_PrintMsg_NoMoreCoins(struct Task *task)
{
DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized(0, FONT_NORMAL, gText_YouveRunOutOfCoins, 0, 1, 0, 0);
CopyWindowToVram(0, COPYWIN_FULL);
DrawDialogueFrame(WIN_MSG, FALSE);
AddTextPrinterParameterized(WIN_MSG, FONT_NORMAL, gText_YouveRunOutOfCoins, 0, 1, 0, 0);
CopyWindowToVram(WIN_MSG, COPYWIN_FULL);
sSlotMachine->state = SLOTTASK_WAIT_MSG_NO_MORE_COINS;
return FALSE;
}
@ -1720,7 +1725,7 @@ static bool8 SlotTask_WaitMsg_NoMoreCoins(struct Task *task)
{
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
ClearDialogWindowAndFrame(0, TRUE);
ClearDialogWindowAndFrame(WIN_MSG, TRUE);
sSlotMachine->state = SLOTTASK_END;
}
return FALSE;
@ -3922,15 +3927,15 @@ static void InfoBox_DrawWindow(struct Task *task)
DestroyDigitalDisplayScene();
LoadInfoBoxTilemap();
AddWindow(&sWindowTemplate_InfoBox);
PutWindowTilemap(1);
FillWindowPixelBuffer(1, PIXEL_FILL(0));
PutWindowTilemap(WIN_INFO);
FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0));
task->tState++;
}
static void InfoBox_AddText(struct Task *task)
{
AddTextPrinterParameterized3(1, FONT_NORMAL, 2, 5, sColors_ReeltimeHelp, 0, gText_ReelTimeHelp);
CopyWindowToVram(1, COPYWIN_FULL);
AddTextPrinterParameterized3(WIN_INFO, FONT_NORMAL, 2, 5, sColors_ReeltimeHelp, 0, gText_ReelTimeHelp);
CopyWindowToVram(WIN_INFO, COPYWIN_FULL);
BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK);
task->tState++;
}
@ -3939,10 +3944,10 @@ static void InfoBox_WaitInput(struct Task *task)
{
if (JOY_NEW(B_BUTTON | SELECT_BUTTON))
{
FillWindowPixelBuffer(1, PIXEL_FILL(0));
ClearWindowTilemap(1);
CopyWindowToVram(1, COPYWIN_MAP);
RemoveWindow(1);
FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0));
ClearWindowTilemap(WIN_INFO);
CopyWindowToVram(WIN_INFO, COPYWIN_MAP);
RemoveWindow(WIN_INFO);
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK);
task->tState++;
}

View File

@ -530,12 +530,14 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) {
text << "//\n// DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n//\n\n";
text << "enum\n{\n";
int group_num = 0;
vector<int> map_count_vec; //DEBUG
for (auto &group : groups_data["group_order"].array_items()) {
string groupName = json_to_string(group);
text << "// " << groupName << "\n";
text << " // " << groupName << "\n";
vector<string> map_ids;
size_t max_length = 0;
@ -556,8 +558,8 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) {
int map_id_num = 0;
for (string map_id : map_ids) {
text << "#define " << map_id << string((max_length - map_id.length() + 1), ' ')
<< "(" << map_id_num++ << " | (" << group_num << " << 8))\n";
text << " " << map_id << string(max_length - map_id.length(), ' ')
<< " = (" << map_id_num++ << " | (" << group_num << " << 8)),\n";
}
text << "\n";
@ -565,6 +567,8 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) {
map_count_vec.push_back(map_count); //DEBUG
}
text << "};\n\n";
text << "#define MAP_GROUPS_COUNT " << group_num << "\n\n";
text << get_include_guard_end(guard_name);