underground cleanup pass (#961)
Some checks are pending
build / build (push) Waiting to run

This commit is contained in:
scbroede 2026-02-21 18:49:30 -05:00 committed by GitHub
parent bb8f64b627
commit d1e71999e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
73 changed files with 2414 additions and 2277 deletions

View File

@ -137,4 +137,4 @@ UG_GOOD_DAINTY_FLOWERS
UG_GOOD_LOVELY_FLOWERS
UG_GOOD_PRETTY_FLOWERS
UG_GOOD_LAVISH_FLOWERS
UG_GOOD_MAX
UG_GOOD_MAX

View File

@ -103,6 +103,7 @@ metang_generators = {
'shadow_sizes': { 'type': 'enum', 'tag': 'ShadowSize' },
'species': { 'type': 'enum', 'tag': 'Species' },
'species_data_params': { 'type': 'enum', 'tag': 'SpeciesDataParam' },
'sphere_types': { 'type': 'enum', 'tag': 'SphereType' },
'string_padding_mode': { 'type': 'enum', 'tag': 'PaddingMode' },
'text_banks': { 'type': 'enum', 'tag': 'TextBank' },
'time_of_day': { 'type': 'enum', 'tag': 'TimeOfDay' },

View File

@ -0,0 +1,7 @@
SPHERE_NONE
SPHERE_PRISM
SPHERE_PALE
SPHERE_RED
SPHERE_BLUE
SPHERE_GREEN
SPHERE_MAX

View File

@ -32,4 +32,4 @@ TRAP_EMBER
TRAP_FIRE
TRAP_RADAR_DUMMY
TRAP_DIGGER_DRILL
TRAP_MAX
TRAP_MAX

View File

@ -6,7 +6,7 @@
#include "struct_defs/underground.h"
#include "field/field_system_decl.h"
#include "overlay023/underground_player_status.h"
#include "underground/player_status.h"
#include "communication_system.h"
#include "overworld_anim_manager.h"
@ -20,7 +20,7 @@ enum PauseBit {
PAUSE_BIT_TRAPS = 1 << 4,
PAUSE_BIT_BURIED_OBJECT_WITH_FLAG = 1 << 5,
PAUSE_BIT_LINK_PC = 1 << 6,
PAUSE_BIT_RADAR = 1 << 7,
PAUSE_BIT_TOUCH_RADAR = 1 << 7,
};
enum Emote {

View File

@ -8,5 +8,6 @@
#define BASE_TILE_MAP_TRANSITION_DROPDOWN (BASE_TILE_STANDARD_WINDOW_FRAME - MAP_TRANSITION_DROPDOWN_TILE_COUNT)
#define BASE_TILE_SIGNPOST (BASE_TILE_MAP_TRANSITION_DROPDOWN - (SIGNPOST_FRAME_TILE_COUNT + SCROLLING_CURSOR_TILE_COUNT + SIGNPOST_CONTENT_SIZE_TILES))
#define BASE_TILE_MESSAGE_WINDOW (BASE_TILE_SIGNPOST - MESSAGE_WINDOW_TILE_COUNT)
#define BASE_TILE_YES_NO_MENU (BASE_TILE_MESSAGE_WINDOW - YES_NO_MENU_TILE_COUNT)
#endif // POKEPLATINUM_CONSTANTS_FIELD_BASE_TILES_H

View File

@ -22,9 +22,9 @@
#include "overlay005/signpost.h"
#include "overlay005/struct_ov5_021D1A68_decl.h"
#include "overlay005/struct_ov5_021D57D8_decl.h"
#include "overlay023/struct_underground_top_screen_context_decl.h"
#include "overlay056/struct_ov56_02256468_decl.h"
#include "overlay066/struct_ov66_0222DCE0_sub1.h"
#include "underground/struct_underground_top_screen_context_decl.h"
#include "bag.h"
#include "battle_regulation.h"

View File

@ -1,10 +0,0 @@
#ifndef POKEPLATINUM_UNDERGROUND_TRAP_PRICES_H
#define POKEPLATINUM_UNDERGROUND_TRAP_PRICES_H
#define RANDOM_SPHERE_TYPE 6
const u8 TrapGetSpherePriceType(const int trapID);
const u8 TrapGetSpherePriceMinSize(const int trapID);
const u8 TrapGetSpherePriceMaxSize(const int trapID);
#endif // POKEPLATINUM_UNDERGROUND_TRAP_PRICES_H

View File

@ -1,41 +0,0 @@
#ifndef POKEPLATINUM_OV23_022416A8_H
#define POKEPLATINUM_OV23_022416A8_H
#include <nitro/math.h>
#include "field/field_system_decl.h"
typedef struct TouchRadarSearchContext {
u16 iterator;
u16 radius;
} TouchRadarSearchContext;
typedef struct TouchRadarCoordinates {
s16 x;
s16 z;
} TouchRadarCoordinates;
#include "string_gf.h"
void BuriedSpheresEnv_Init(void *dest, FieldSystem *fieldSystem);
int BuriedSpheresEnv_Size(void);
void UndergroundSpheres_DisableBuriedSphereSparkles(void);
void UndergroundSpheres_EnableBuriedSphereSparkles(void);
void BuriedSpheresEnv_Free(void);
void UndergroundSpheres_AdvanceBuriedSphereSparkleTimer(void);
void UndergroundSpheres_RetrieveBuriedSphere(int unused, int unused2, void *src, void *unused3);
void TouchRadarSearch_Init(TouchRadarSearchContext *ctx, int radius);
BOOL TouchRadarSearch_GetNextCoords(TouchRadarSearchContext *ctx, TouchRadarCoordinates *out);
void UndergroundSpheres_TryBurySphere(int sphereType, int sphereSize, int x, int z);
BOOL UndergroundSpheres_IsMiningItemSphere(int miningItemID);
BOOL UndergroundSpheres_IsBuriedSphereAtCoordinates(int x, int z);
int UndergroundSpheres_GetBuriedSphereXCoordAtIndex(int idx);
int UndergroundSpheres_GetBuriedSphereZCoordAtIndex(int idx);
BOOL UndergroundSpheres_GetQueuedMessage(String *string);
int UndergroundSpheres_SpawnMiningSpotsNearBuriedSpheres(MATHRandContext16 *rand);
void SphereRadar_Start(void);
void SphereRadar_Exit(void);
int SphereRadar_GetXCoordOfBuriedSphere(int radarIndex);
int SphereRadar_GetZCoordOfBuriedSphere(int radarIndex);
#endif // POKEPLATINUM_OV23_022416A8_H

View File

@ -1,71 +0,0 @@
#ifndef POKEPLATINUM_UNDERGROUND_TRAPS_H
#define POKEPLATINUM_UNDERGROUND_TRAPS_H
#include <nitro/math.h>
#include "field/field_system_decl.h"
#include "overlay023/underground_defs.h"
#include "bg_window.h"
#include "string_gf.h"
void TrapsEnv_Init(void *dest, FieldSystem *fieldSystem);
void UndergroundTraps_DisableTrapGraphics(void);
void UndergroundTraps_EnableTrapGraphics(void);
void TrapsEnv_Free(void);
void UndergroundTraps_Reinit(FieldSystem *fieldSystem);
void UndergroundTraps_RemoveLinkData(int netID);
int TrapsEnv_Size(void);
int CommPacketSizeOf_AllTrapsPlacedPlayer(void);
void Underground_SendPlacedTrap(u8 trapID);
void UndergroundTraps_SendTrapRadarResults(void);
void UndergroundTraps_SendPlacedTraps(void);
void UndergroundTraps_TryPlaceTrap(int netID, int unused1, void *data, void *unused3);
int CommPacketSizeOf_PlaceTrapResult(void);
int UndergroundTraps_SpawnRandomTrap(int x, int z, MATHRandContext16 *rand, int index);
void UndergroundTraps_LoadSpawnedTraps(void);
void UndergroundTraps_ProcessPlaceTrapResult(int unused0, int unused1, void *data, void *unused3);
void UndergroundTraps_RemoveBuriedTrapAtIndex_Unused(int unused0, int unused1, void *data, void *unused3);
int CommPacketSizeOf_2Bytes_Unused(void);
void UndergroundTraps_LoadLinkPlacedTraps(int netID, int size, void *data, void *unused3);
void UndergroundTraps_ReceiveLoadTrapsResult(int unused0, int unused1, void *data, void *unused3);
int CommPacketSizeOf_LoadTrapsResult(void);
BOOL UndergroundTraps_HaveLinksReceivedPlacedTraps(void);
void UndergroundTraps_ClearLinksReceivedPlacedTraps(void);
int CommPacketSizeOf_Coordinates(void);
BOOL UndergroundTraps_TryDisengageTrap(int netID, Coordinates *unused, u8 flags);
int CommPacketSizeOf_TriggeredTrap(void);
void UndergroundTraps_ProcessDisengagedTrap(int unused0, int unused1, void *data, void *unused3);
BOOL UndergroundTraps_IsTrapAtCoordinates(int x, int z);
int CommPacketSizeOf_TriggeredTrap2(void);
void UndergroundTraps_HandleTriggeredTool(int victimNetID, int setterNetID, int trapID, int x, int z, int victimDir);
BOOL UndergroundTraps_CheckPlayerSteppedOnTrap(int netID);
BOOL UndergroundTraps_HasPlayerTriggeredTool(int netID);
void UndergroundTraps_HandleTriggeredTrap(int unused0, int unused1, void *data, void *unused3);
void UndergroundTraps_CallSecondTrapEffectServerFunc(int netID, int unused1, void *data, void *unused3);
void UndergroundTraps_StartLinkSlideAnimation_Unused(int unused0, int unused1, void *data, void *unused3);
void UndergroundTraps_SendTriggeredTrapBits(void);
void UndergroundTraps_ProcessTriggeredTrapBits(int unused0, int unused1, void *data, void *unused3);
BOOL UndergroundTraps_GetQueuedMessage(String *dest);
BOOL UndergroundTraps_GetQueuedMessage2(String *dest);
void UndergroundTraps_ForceEndCurrentTrapEffectClient(int netID, BOOL allowToolStepBack);
int CommPacketSizeOf_EscapedTrap(void);
void UndergroundTraps_EscapeTrapServer(int netID, int unused1, void *unused2, void *unused3);
void UndergroundTraps_EndCurrentTrapEffectServer(int netID, int unused1, void *unused2, void *unused3);
void UndergroundTraps_ProcessEscapedTrap(int unused0, int unused1, void *data, void *unused3);
void UndergroundTraps_EscapeHole(int unused0, int unused1, void *data, void *unused3);
void UndergroundTraps_HelpLink(int netID, int linkNetID);
void UndergroundTraps_ProcessTrapHelp(int unused0, int unused1, void *data, void *unused3);
int CommPacketSizeOf_TrapHelpData(void);
int TrapRadar_GetXCoordOfBuriedTrap(int radarIndex);
int TrapRadar_GetZCoordOfBuriedTrap(int radarIndex);
void TrapRadar_Start(void);
void TrapRadar_Exit(void);
void UndergroundTraps_QueueSendTrapRadarResults(int netID, int unused1, void *unused2, void *unused3);
void UndergroundTraps_ReceiveTrapRadarResults(int unused0, int unused1, void *data, void *unused3);
int CommPacketSizeOf_TrapRadarResult(void);
void UndergroundTraps_Dummy2(BgConfig *bgConfig);
void UndergroundTraps_StartTouchRadarTask(FieldSystem *fieldSystem, int param1, int param2, int param3, int param4, u8 *param5, int param6, u8 *param7, int param8, u8 *param9, int param10);
void UndergroundTraps_StopLinkSpin(int netID);
#endif // POKEPLATINUM_UNDERGROUND_TRAPS_H

View File

@ -43,6 +43,10 @@
#define SIGNPOST_FRAME_TILE_H 3
#define SIGNPOST_FRAME_TILE_COUNT (SIGNPOST_FRAME_TILE_W * SIGNPOST_FRAME_TILE_H)
#define YES_NO_MENU_TILE_W 6
#define YES_NO_MENU_TILE_H 4
#define YES_NO_MENU_TILE_COUNT (YES_NO_MENU_TILE_W * YES_NO_MENU_TILE_H)
typedef struct WaitDial WaitDial;
enum StandardWindowType {

View File

@ -5,7 +5,7 @@
#include "struct_defs/underground_record.h"
#include "overlay023/underground_defs.h"
#include "underground/defs.h"
#include "charcode.h"
@ -48,7 +48,7 @@ typedef struct Underground {
u8 miningSpots[MAX_MINING_SPOTS + 5][3];
u8 placedTrapIDs[MAX_PLACED_TRAPS];
u8 placedTrapCoordinates[MAX_PLACED_TRAPS][3];
u8 unk_548[MAX_PLACED_TRAPS];
u8 placedTrapSpawnedIndices[MAX_PLACED_TRAPS]; // pointless field
u8 buriedSphereTypes[MAX_BURIED_SPHERES];
u8 buriedSphereGrowth[MAX_BURIED_SPHERES];
u8 buriedSphereInitialSizes[MAX_BURIED_SPHERES];

View File

@ -5,6 +5,6 @@
#include "field_task.h"
void BaseDecoration_StartDecorationTask(FieldSystem *fieldSystem, FieldTask *task);
void BaseDecoration_StartDecorationMenuTask(FieldSystem *fieldSystem, FieldTask *task);
#endif // POKEPLATINUM_UNDERGROUND_BASE_DECORATION_H

View File

@ -2,7 +2,7 @@
#define POKEPLATINUM_UNDERGROUND_DECORATION_MENU_H
#include "field/field_system_decl.h"
#include "overlay023/underground_item_list_menu.h"
#include "underground/item_list_menu.h"
#include "list_menu.h"
#include "scroll_prompts.h"

View File

@ -29,15 +29,10 @@
#define UNDERGROUND_MAIN_AREA_WIDTH (UNDERGROUND_MAX_X - UNDERGROUND_MAIN_AREA_START_X)
#define UNDERGROUND_MAIN_AREA_DEPTH (UNDERGROUND_MAX_Z - UNDERGROUND_MAIN_AREA_START_Z)
enum SphereTypes {
SPHERE_NONE = 0,
PRISM_SPHERE,
PALE_SPHERE,
RED_SPHERE,
BLUE_SPHERE,
GREEN_SPHERE,
SPHERE_TYPE_MAX,
};
#define MAX_SECRET_BASE_GOODS (MAX_PLACED_GOODS + MAX_BASE_BOULDERS + 1)
#define MAX_GOOD_WIDTH 3
#define MAX_GOOD_DEPTH 3
typedef struct Coordinates {
u16 x;

View File

@ -4,8 +4,8 @@
#include "struct_defs/underground.h"
#include "field/field_system_decl.h"
#include "overlay023/underground_defs.h"
#include "overlay023/underground_text_printer.h"
#include "underground/defs.h"
#include "underground/text_printer.h"
#include "savedata.h"
#include "string_gf.h"
@ -14,9 +14,13 @@
#define MAX_NORMAL_RADAR_BLIPS 8
#define TOUCH_RADAR_RADIUS 6
#define MAX_TOUCH_RADAR_RESULTS_OF_TYPE 8
typedef void (*EndSysTaskFunc)(SysTask *sysTask, void *ctx);
enum UndergroundStoredPosKeys {
enum UndergroundStoredPosKey {
UNDERGROUND_STORED_POS_NONE = 0,
UNDERGROUND_STORED_POS_KEY_PC,
UNDERGROUND_STORED_POS_KEY_START_MENU,
@ -25,7 +29,7 @@ enum UndergroundStoredPosKeys {
UNDERGROUND_STORED_POS_KEY_TREASURES_VENDOR,
};
enum UndergroundMenuKeys {
enum UndergroundMenuKey {
UNDERGROUND_MENU_KEY_STORE_GOODS = 2,
UNDERGROUND_MENU_KEY_WITHDRAW_GOODS = 6,
UNDERGROUND_MENU_KEY_TRAPS = 8,
@ -123,6 +127,6 @@ BOOL UndergroundMan_ShouldFieldSystemBeResumed(int netID);
void UndergroundMan_SendPlayerState(void);
void UndergroundMan_ProcessPlayerState(int netID, int unused1, void *data, void *unused3);
int CommPacketSizeOf_UndergroundPlayerState(void);
void ov23_022433BC(int netID, int unused1, void *unused2, void *unused3);
void UndergroundMan_ProcessAllDataSentMessage(int netID, int unused1, void *unused2, void *unused3);
#endif // POKEPLATINUM_UNDERGROUND_MANAGER_H

View File

@ -1,12 +1,16 @@
#ifndef POKEPLATINUM_UNDERGROUND_MENU_H
#define POKEPLATINUM_UNDERGROUND_MENU_H
#include "generated/goods.h"
#include "generated/sphere_types.h"
#include "generated/traps.h"
#include "struct_defs/underground.h"
#include "field/field_system_decl.h"
#include "overlay005/sprite_resource_manager.h"
#include "overlay023/underground_item_list_menu.h"
#include "overlay023/underground_records.h"
#include "underground/item_list_menu.h"
#include "underground/records.h"
#include "bg_window.h"
#include "list_menu.h"
@ -18,7 +22,7 @@
#include "string_template.h"
#include "sys_task_manager.h"
enum UndergroundStartMenuOptions {
enum UndergroundStartMenuOption {
UNDERGROUND_START_MENU_OPTION_TRAPS = 0,
UNDERGROUND_START_MENU_OPTION_SPHERES,
UNDERGROUND_START_MENU_OPTION_GOODS,
@ -90,22 +94,22 @@ void UndergroundMenuContext_Init(Underground *underground);
void UndergroundMenuContext_Free(void);
int UndergroundMenu_GetGoodAtSlotPC(int slot, void *menu);
int UndergroundMenu_GetGoodAtSlotBag(int slot, void *menu);
void UndergroundMenu_RemoveSelectedGoodBag(int goodID);
void UndergroundMenu_RemoveSelectedGoodBag(enum Good goodID);
int UndergroundMenu_GetTrapAtSlot(int slot, void *menu);
int UndergroundMenu_GetSphereTypeAtSlot(int slot, void *menu);
int UndergroundMenu_GetSphereSizeAtSlot(int slot, void *menu);
int UndergroundMenu_GetTreasureAtSlot(int slot, void *menu);
BOOL UndergroundInventory_TryAddSphere(int sphereType, int sphereSize);
BOOL UndergroundInventory_TryAddSphere(enum SphereType sphereType, int sphereSize);
BOOL UndergroundInventory_TryAddTreasure(int treasureID);
BOOL UndergroundInventory_TryAddTrap(int trapID);
BOOL UndergroundInventory_TryAddGoodBag(int goodID);
BOOL UndergroundInventory_TryAddTrap(enum Trap trapID);
BOOL UndergroundInventory_TryAddGoodBag(enum Good goodID);
void UndergroundMenu_Start(ExitCallback exitCallback, FieldSystem *fieldSystem);
void UndergroundMenu_EraseCurrentMenu(UndergroundMenu *menu);
void UndergroundMenu_RemoveSelectedTrap(int trapID);
void UndergroundMenu_RemoveSelectedTrap(enum Trap trapID);
void UndergroundMenu_PrintTrapDescription(ListMenu *listMenu, u32 index, u8 onInit);
void UndergroundMenu_OpenSellTrapsMenu(UndergroundMenu *menu);
void UndergroundMenu_OpenTrapsMenu(UndergroundMenu *menu);
void UndergroundMenu_RemoveSelectedSphere(int sphereType);
void UndergroundMenu_RemoveSelectedSphere(enum SphereType sphereType);
void UndergroundMenu_OpenPayWithSpheresMenu(UndergroundMenu *menu);
void UndergroundMenu_PrintTreasureDescription(ListMenu *listMenu, u32 index, u8 onInit);
void UndergroundMenu_OpenSellTreasuresMenu(UndergroundMenu *menu);

View File

@ -4,7 +4,7 @@
#include <nitro/math.h>
#include "field/field_system_decl.h"
#include "overlay023/underground_defs.h"
#include "underground/defs.h"
#include "string_gf.h"
@ -41,7 +41,7 @@ void Mining_ResetPlayerData(int netID);
BOOL Mining_IsMiningGameTaskActive(void);
void Mining_SetPlayerMiningStatus(int netID, int isMining);
enum MiningObjectIDs {
enum MiningObjectID {
MINING_TREASURE_NONE = 0,
MINING_SMALL_PRISM_SPHERE,
MINING_SMALL_PALE_SPHERE,

View File

@ -1,12 +1,10 @@
#ifndef POKEPLATINUM_UNDERGROUND_PC_H
#define POKEPLATINUM_UNDERGROUND_PC_H
#include "overlay023/underground_defs.h"
#include "overlay023/underground_menu.h"
#include "underground/defs.h"
#include "underground/menus.h"
#define PC_NONE 0xFF
int UndergroundPC_GetPCAtCoordinates(Coordinates *coordinates, int dir);
int UndergroundPC_GetPCOwnerNetIDAtCoordinates(Coordinates *coordinates, int dir);
BOOL UndergroundPC_TryUsePC(int netID, Coordinates *coordinates);
void UndergroundPC_ProcessPCInteraction(int unused0, int unused1, void *data, void *data2);
int CommPacketSizeOf_PCInteraction(void);

View File

@ -31,7 +31,7 @@ BOOL UndergroundPlayer_TalkHeldFlagCheck(int netID, int targetNetID, BOOL blockI
BOOL UndergroundPlayer_BuriedObjectHeldFlagCheck(int netID);
void UndergroundPlayer_ProcessFlagEvent(int unused0, int unused1, void *data, void *unused3);
void UndergroundPlayer_ClearHeldFlagInfo(void);
u8 *ov23_0224AAA0(int unused0, void *unused1, int unused2);
u8 *UndergroundPlayer_GetHeldFlagInfoBuffer(int unused0, void *unused1, int unused2);
void UndergroundPlayer_SendHeldFlagOwnerInfo(void);
int CommPacketSizeOf_TrainerInfo(void);
void UndergroundPlayer_ProcessHeldFlagOwnerInfo(int flagOwnerNetID, int unused1, void *data, void *unused3);
@ -39,7 +39,7 @@ void UndergroundPlayer_ProcessHeldFlagOwnerInfoServer(int unused0, int unused1,
int CommPacketSizeOf_HeldFlagInfo(void);
void UndergroundPlayer_ProcessHeldFlagOwnerInfoAck(int unused0, int unused1, void *data, void *unused3);
BOOL UndergroundPlayer_HaveLinksReceivedHeldFlagData(void);
void ov23_0224AC4C(void);
void UndergroundPlayer_ResetHeldFlagInfo(void);
BOOL UndergroundPlayer_IsAffectedByTrap(int netID);
void UndergroundPlayer_ProcessVendorTalk(int netID, int unused1, void *unused2, void *unused3);
void UndergroundPlayer_ProcessVendorTalkServer(int unused0, int unused1, void *data, void *unused3);

View File

@ -1,10 +1,12 @@
#ifndef POKEPLATINUM_UNDERGROUND_SECRET_BASES_H
#define POKEPLATINUM_UNDERGROUND_SECRET_BASES_H
#include "generated/goods.h"
#include "struct_defs/underground.h"
#include "field/field_system_decl.h"
#include "overlay023/underground_defs.h"
#include "underground/defs.h"
#include "savedata.h"
#include "string_gf.h"
@ -61,7 +63,7 @@ int SecretBases_GetBaseZCoordinate(void);
BOOL SecretBases_AreCoordinatesWalkable(int x, int z);
int SecretBases_PrintBaseDecorationMessage(int bankEntry);
void SecretBases_EraseBaseDecorationMessageBox(void);
void SecretBases_SetGoodNameForPrinter(int goodID);
void SecretBases_SetGoodNameForPrinter(enum Good goodID);
void SecretBases_SetTwoDigitNumberWithIndexForPrinter(int num, int index);
BOOL SecretBases_CheckForInteractableGood(int netID, Coordinates *coordinates);
void SecretBases_ProcessGoodInteractionEvent(int unused0, int unused1, void *data, void *unused3);

View File

@ -0,0 +1,43 @@
#ifndef POKEPLATINUM_UNDERGROUND_SPHERES_H
#define POKEPLATINUM_UNDERGROUND_SPHERES_H
#include <nitro/math.h>
#include "generated/sphere_types.h"
#include "field/field_system_decl.h"
#include "string_gf.h"
typedef struct TouchRadarSearchContext {
u16 iterator;
u16 radius;
} TouchRadarSearchContext;
typedef struct TouchRadarCoordinates {
s16 x;
s16 z;
} TouchRadarCoordinates;
void SpheresEnv_Init(void *dest, FieldSystem *fieldSystem);
int SpheresEnv_Size(void);
void Spheres_DisableBuriedSphereSparkles(void);
void Spheres_EnableBuriedSphereSparkles(void);
void SpheresEnv_Free(void);
void Spheres_AdvanceBuriedSphereSparkleTimer(void);
void Spheres_ProcessRetrieveBuriedSphereRequest(int unused, int unused2, void *src, void *unused3);
void TouchRadarSearch_Init(TouchRadarSearchContext *ctx, int radius);
BOOL TouchRadarSearch_GetNextCoords(TouchRadarSearchContext *ctx, TouchRadarCoordinates *out);
void Spheres_TryBurySphere(enum SphereType sphereType, int sphereSize, int x, int z);
BOOL Spheres_IsMiningItemSphere(int miningItemID);
BOOL Spheres_IsBuriedSphereAtCoordinates(int x, int z);
int Spheres_GetBuriedSphereXCoordAtIndex(int index);
int Spheres_GetBuriedSphereZCoordAtIndex(int index);
BOOL Spheres_GetQueuedMessage(String *string);
int Spheres_SpawnMiningSpotsNearBuriedSpheres(MATHRandContext16 *rand);
void SphereRadar_Start(void);
void SphereRadar_Exit(void);
int SphereRadar_GetXCoordOfBuriedSphere(int radarIndex);
int SphereRadar_GetZCoordOfBuriedSphere(int radarIndex);
#endif // POKEPLATINUM_UNDERGROUND_SPHERES_H

View File

@ -2,6 +2,8 @@
#define POKEPLATINUM_UNDERGROUND_TEXT_PRINTER_H
#include "constants/field_base_tiles.h"
#include "generated/goods.h"
#include "generated/traps.h"
#include "bg_window.h"
#include "list_menu.h"
@ -52,18 +54,18 @@ void UndergroundTextPrinter_SetUndergroundItemNameWithArticle(UndergroundTextPri
void UndergroundTextPrinter_SetUndergroundTrapName(UndergroundTextPrinter *textPrinter, int trap);
void UndergroundTextPrinter_SetUndergroundQuestion(UndergroundTextPrinter *textPrinter, int question);
void UndergroundTextPrinter_SetUndergroundAnswer(UndergroundTextPrinter *textPrinter, int answer);
void UndergroundTextPrinter_SetUndergroundAnswerWithIndex(UndergroundTextPrinter *textPrinter, int idx, int answer);
void UndergroundTextPrinter_SetUndergroundGoodsName(UndergroundTextPrinter *textPrinter, int idx);
void UndergroundTextPrinter_SetSingleDigitNumber(UndergroundTextPrinter *textPrinter, int idx, int num);
void UndergroundTextPrinter_SetUndergroundAnswerWithIndex(UndergroundTextPrinter *textPrinter, int index, int answer);
void UndergroundTextPrinter_SetUndergroundGoodsName(UndergroundTextPrinter *textPrinter, enum Good goodID);
void UndergroundTextPrinter_SetSingleDigitNumber(UndergroundTextPrinter *textPrinter, int index, int num);
void UndergroundTextPrinter_SetTwoDigitNumber(UndergroundTextPrinter *textPrinter, int num);
void UndergroundTextPrinter_SetTwoDigitNumberWithIndex(UndergroundTextPrinter *textPrinter, int idx, int num);
void UndergroundTextPrinter_SetTwoDigitNumberWithIndex(UndergroundTextPrinter *textPrinter, int index, int num);
void UndergroundTextPrinter_SetNumber(UndergroundTextPrinter *textPrinter, int num);
void UndergroundTextPrinter_SetUndergroundItemName(UndergroundTextPrinter *textPrinter, int idx, int item);
void UndergroundTextPrinter_SetUndergroundTrapNameWithIndex(UndergroundTextPrinter *textPrinter, int idx, int trap);
void UndergroundTextPrinter_SetGoodNameWithIndex(UndergroundTextPrinter *textPrinter, int idx, int goods);
void UndergroundTextPrinter_SetUndergroundItemNameWithArticleWithIndex(UndergroundTextPrinter *textPrinter, int idx, int item);
void UndergroundTextPrinter_SetUndergroundTrapNameWithArticle(UndergroundTextPrinter *textPrinter, int idx, int trap);
void UndergroundTextPrinter_CapitalizeArgAtIndex(UndergroundTextPrinter *textPrinter, int idx);
void UndergroundTextPrinter_SetUndergroundItemName(UndergroundTextPrinter *textPrinter, int index, int itemID);
void UndergroundTextPrinter_SetUndergroundTrapNameWithIndex(UndergroundTextPrinter *textPrinter, int index, enum Trap trapID);
void UndergroundTextPrinter_SetGoodNameWithIndex(UndergroundTextPrinter *textPrinter, int index, enum Good goodID);
void UndergroundTextPrinter_SetUndergroundItemNameWithArticleWithIndex(UndergroundTextPrinter *textPrinter, int index, int itemID);
void UndergroundTextPrinter_SetUndergroundTrapNameWithArticle(UndergroundTextPrinter *textPrinter, int index, enum Trap trapID);
void UndergroundTextPrinter_CapitalizeArgAtIndex(UndergroundTextPrinter *textPrinter, int index);
void UndergroundTextPrinter_RemovePrinter(UndergroundTextPrinter *textPrinter);
BOOL UndergroundTextPrinter_IsPrinterActive(UndergroundTextPrinter *textPrinter);
void UndergroundTextPrinter_ClearPrinterID(UndergroundTextPrinter *textPrinter);

View File

@ -2,7 +2,7 @@
#define POKEPLATINUM_UNDERGROUND_TOP_SCREEN_H
#include "field/field_system_decl.h"
#include "overlay023/struct_underground_top_screen_context_decl.h"
#include "underground/struct_underground_top_screen_context_decl.h"
UndergroundTopScreenContext *UndergroundTopScreen_StartTask(FieldSystem *fieldSystem);
void UndergroundTopScreen_EndTask(UndergroundTopScreenContext *ctx);

View File

@ -0,0 +1,12 @@
#ifndef POKEPLATINUM_UNDERGROUND_TRAP_PRICES_H
#define POKEPLATINUM_UNDERGROUND_TRAP_PRICES_H
#include "generated/traps.h"
#define RANDOM_SPHERE_TYPE 6
const u8 Trap_GetSpherePriceType(const enum Trap trapID);
const u8 Trap_GetSpherePriceMinSize(const enum Trap trapID);
const u8 Trap_GetSpherePriceMaxSize(const enum Trap trapID);
#endif // POKEPLATINUM_UNDERGROUND_TRAP_PRICES_H

View File

@ -0,0 +1,73 @@
#ifndef POKEPLATINUM_UNDERGROUND_TRAPS_H
#define POKEPLATINUM_UNDERGROUND_TRAPS_H
#include <nitro/math.h>
#include "generated/traps.h"
#include "field/field_system_decl.h"
#include "underground/defs.h"
#include "bg_window.h"
#include "string_gf.h"
void TrapsEnv_Init(void *dest, FieldSystem *fieldSystem);
void Traps_DisableTrapGraphics(void);
void Traps_EnableTrapGraphics(void);
void TrapsEnv_Free(void);
void Traps_Reinit(FieldSystem *fieldSystem);
void Traps_RemoveLinkData(int netID);
int TrapsEnv_Size(void);
int CommPacketSizeOf_AllTrapsPlacedPlayer(void);
void Underground_SendPlacedTrap(u8 trapID);
void Traps_SendTrapRadarResults(void);
void Traps_SendPlacedTraps(void);
void Traps_TryPlaceTrap(int netID, int unused1, void *data, void *unused3);
int CommPacketSizeOf_PlaceTrapResult(void);
enum Trap Traps_SpawnRandomTrap(int x, int z, MATHRandContext16 *rand, int index);
void Traps_LoadSpawnedTraps(void);
void Traps_ProcessPlaceTrapResult(int unused0, int unused1, void *data, void *unused3);
void Traps_RemoveBuriedTrapAtIndex_Unused(int unused0, int unused1, void *data, void *unused3);
int CommPacketSizeOf_2Bytes_Unused(void);
void Traps_LoadLinkPlacedTraps(int netID, int size, void *data, void *unused3);
void Traps_ReceiveLoadTrapsResult(int unused0, int unused1, void *data, void *unused3);
int CommPacketSizeOf_LoadTrapsResult(void);
BOOL Traps_HaveLinksReceivedPlacedTraps(void);
void Traps_ClearLinksReceivedPlacedTraps(void);
int CommPacketSizeOf_Coordinates(void);
BOOL Traps_TryDisengageTrap(int netID, Coordinates *unused, u8 flags);
int CommPacketSizeOf_TriggeredTrap(void);
void Traps_ProcessDisengagedTrap(int unused0, int unused1, void *data, void *unused3);
BOOL Traps_IsTrapAtCoordinates(int x, int z);
int CommPacketSizeOf_TriggeredTrap2(void);
void Traps_HandleTriggeredTool(int victimNetID, int setterNetID, enum Trap trapID, int x, int z, int victimDir);
BOOL Traps_CheckPlayerSteppedOnTrap(int netID);
BOOL Traps_HasPlayerTriggeredTool(int netID);
void Traps_HandleTriggeredTrap(int unused0, int unused1, void *data, void *unused3);
void Traps_CallSecondTrapEffectServerFunc(int netID, int unused1, void *data, void *unused3);
void Traps_StartLinkSlideAnimation_Unused(int unused0, int unused1, void *data, void *unused3);
void Traps_SendTriggeredTrapBits(void);
void Traps_ProcessTriggeredTrapBits(int unused0, int unused1, void *data, void *unused3);
BOOL Traps_GetQueuedMessage(String *dest);
BOOL Traps_GetQueuedMessage2(String *dest);
void Traps_ForceEndCurrentTrapEffectClient(int netID, BOOL allowToolStepBack);
int CommPacketSizeOf_EscapedTrap(void);
void Traps_EscapeTrapServer(int netID, int unused1, void *unused2, void *unused3);
void Traps_EndCurrentTrapEffectServer(int netID, int unused1, void *unused2, void *unused3);
void Traps_ProcessEscapedTrap(int unused0, int unused1, void *data, void *unused3);
void Traps_EscapeHole(int unused0, int unused1, void *data, void *unused3);
void Traps_HelpLink(int netID, int linkNetID);
void Traps_ProcessTrapHelp(int unused0, int unused1, void *data, void *unused3);
int CommPacketSizeOf_TrapHelpData(void);
int TrapRadar_GetXCoordOfBuriedTrap(int radarIndex);
int TrapRadar_GetZCoordOfBuriedTrap(int radarIndex);
void TrapRadar_Start(void);
void TrapRadar_Exit(void);
void Traps_QueueSendTrapRadarResults(int netID, int unused1, void *unused2, void *unused3);
void Traps_ReceiveTrapRadarResults(int unused0, int unused1, void *data, void *unused3);
int CommPacketSizeOf_TrapRadarResult(void);
void Traps_Dummy2(BgConfig *bgConfig);
void TouchRadar_StartTask(FieldSystem *fieldSystem, int touchedTileX, int touchedTileZ, int touchX, int touchY, u8 *trapResults, int trapResultCount, u8 *miningSpotResults, int miningSpotResultCount, u8 *buriedSphereResults, int buriedSphereResultCount);
void Traps_StopLinkSpin(int netID);
#endif // POKEPLATINUM_UNDERGROUND_TRAPS_H

View File

@ -1,16 +1,18 @@
#ifndef POKEPLATINUM_UNDERGROUND_VENDORS_H
#define POKEPLATINUM_UNDERGROUND_VENDORS_H
#include "generated/traps.h"
#include "field/field_system_decl.h"
#include "overlay023/underground_menu.h"
#include "underground/menus.h"
int UndergroundVendors_ReturnFFFE(void *unused);
void *UndergroundVendors_ReturnNull(int unused0, FieldSystem *unused1, int unused2);
int UndergroundVendors_PrintNPCMessage(int bankEntry);
void UndergroundVendors_EraseMessageBoxWindow(void);
void UndergroundVendors_SetTreasureNameForPrinter(int index, int treasureID);
void UndergroundVendors_SetTrapNameForPrinter(int index, int trapID);
void UndergroundVendors_SetGoodNameForPrinter(int index, int goodID);
void UndergroundVendors_SetTrapNameForPrinter(int index, enum Trap trapID);
void UndergroundVendors_SetGoodNameForPrinter(int index, enum Good goodID);
void UndergroundMenu_PrintMenuDescription(UndergroundMenu *menu, int bankEntry);
void UndergroundMenu_RemoveDescriptionWindow(UndergroundMenu *menu);
void UndergroundMenu_RemoveDescriptionWindowInstant(UndergroundMenu *menu);

View File

@ -1,6 +1,10 @@
#ifndef POKEPLATINUM_UNK_0202854C_H
#define POKEPLATINUM_UNK_0202854C_H
#include "generated/goods.h"
#include "generated/sphere_types.h"
#include "generated/traps.h"
#include "struct_defs/underground.h"
#include "struct_defs/underground_record.h"
@ -33,11 +37,11 @@ void Underground_StoreRegisteredFlagOwnerInfo(Underground *underground, const Tr
TrainerInfo *Underground_GetRegisteredFlagOwnerInfo(const Underground *underground, enum HeapID heapID, int param2);
u32 Underground_GetRandomSeed(Underground *underground);
int Underground_ConvertTreasureToBagItem(int treasureID);
BOOL Underground_TryAddGoodPC(Underground *underground, int goodID);
BOOL Underground_TryAddGoodPC(Underground *underground, enum Good goodID);
BOOL Underground_IsRoomForGoodsInPC(Underground *underground, int unused);
int Underground_GetGoodsCountPC(Underground *underground);
int Underground_GetGoodAtSlotPC(Underground *underground, int slot);
int Underground_RemoveGoodAtSlotPC(Underground *underground, int slot);
enum Good Underground_RemoveGoodAtSlotPC(Underground *underground, int slot);
void Underground_MoveGoodPC(Underground *underground, int origSlot, int slotToMoveAfter);
int Underground_AddPlacedGood(Underground *underground, int slot, int index);
BOOL Underground_IsGoodAtSlotPlacedInBase(Underground *underground, int slot);
@ -46,13 +50,13 @@ void Underground_InitPlacedGoodSlots(Underground *underground);
int Underground_GetGoodsCountBag(Underground *underground);
int Underground_GetGoodAtSlotBag(Underground *underground, int slot);
int Underground_RemoveGoodAtSlotBag(Underground *underground, int slot);
BOOL Underground_TryAddGoodBag(Underground *underground, int goodID);
BOOL Underground_TryAddGoodBag(Underground *underground, enum Good goodID);
void Underground_MoveGoodBag(Underground *underground, int origSlot, int slotToMoveAfter);
int Underground_GetSphereCount(Underground *underground);
int Underground_GetSphereTypeAtSlot(Underground *underground, int slot);
int Underground_GetSphereSizeAtSlot(Underground *underground, int slot);
int Underground_RemoveSphereAtSlot(Underground *underground, int slot);
BOOL Underground_TryAddSphere(Underground *underground, int sphereType, int sphereSize);
BOOL Underground_TryAddSphere(Underground *underground, enum SphereType sphereType, int sphereSize);
void Underground_MoveSphereInInventory(Underground *underground, int origSlot, int slotToMoveAfter);
int Underground_GetTreasureCount(Underground *underground);
int Underground_GetTreasureAtSlot(Underground *underground, int slot);
@ -62,18 +66,18 @@ void Underground_MoveTreasureInInventory(Underground *underground, int origSlot,
int Underground_GetTrapCount(Underground *underground);
int Underground_GetTrapAtSlot(Underground *underground, int slot);
int Underground_RemoveTrapAtSlot(Underground *underground, int slot);
BOOL Underground_TryAddTrap(Underground *underground, int trapID);
BOOL Underground_TryAddTrap(Underground *underground, enum Trap trapID);
void Underground_MoveTrapInInventory(Underground *underground, int origSlot, int slotToMoveAfter);
void Underground_SaveSpawnedTrap(Underground *underground, int trapID, int index, int x, int z);
void Underground_SaveSpawnedTrap(Underground *underground, enum Trap trapID, int index, int x, int z);
int Underground_GetSpawnedTrapIDAtIndex(Underground *underground, int index);
int Underground_GetSpawnedTrapXCoordAtIndex(Underground *underground, int index);
int Underground_GetSpawnedTrapZCoordAtIndex(Underground *underground, int index);
void Underground_RemoveSpawnedTrapAtIndex(Underground *underground, int index);
void Underground_SavePlacedTrap(Underground *underground, int trapID, int index, int x, int z, int param5);
void Underground_SavePlacedTrap(Underground *underground, enum Trap trapID, int index, int x, int z, int spawnedIndex);
int Underground_GetPlacedTrapIDAtIndex(Underground *underground, int index);
int Underground_GetPlacedTrapXCoordAtIndex(Underground *underground, int index);
int Underground_GetPlacedTrapZCoordAtIndex(Underground *underground, int index);
int sub_0202907C(Underground *underground, int index);
int Underground_GetPlacedTrapSpawnedIndexAtIndex(Underground *underground, int index);
void Underground_SaveBuriedSphere(Underground *underground, int type, int index, int x, int z, int initialSize, int growth);
int Underground_GetBuriedSphereTypeAtIndex(Underground *underground, int index);
int Underground_GetBuriedSphereXCoordAtIndex(Underground *underground, int index);
@ -95,7 +99,7 @@ int Underground_GetStepCount(Underground *underground);
void SecretBase_Init(SecretBase *secretBase);
void SecretBase_Clear(SecretBase *secretBase);
void SecretBase_SetInactive(SecretBase *secretBase);
void SecretBase_AddGoodAtIndex(SecretBase *secretBase, int index, int goodID, int x, int z);
void SecretBase_AddGoodAtIndex(SecretBase *secretBase, int index, enum Good goodID, int x, int z);
void SecretBase_SetGoodCoordsAtIndex(SecretBase *secretBase, int index, int x, int z);
int SecretBase_GetGoodIDAtIndex(const SecretBase *secretBase, int index);
int SecretBase_GetGoodXCoordAtIndex(const SecretBase *secretBase, int index);

View File

@ -832,29 +832,29 @@ Overlay overlay22
Object main.nef.p/src_overlay022_ov22_0225B660.c.o
}
Overlay overlay23
Overlay underground
{
After overlay5
Object main.nef.p/src_overlay023_mining.c.o
Object main.nef.p/src_overlay023_underground_spheres.c.o
Object main.nef.p/src_overlay023_underground_manager.c.o
Object main.nef.p/src_overlay023_underground_traps.c.o
Object main.nef.p/src_overlay023_underground_item_list_menu.c.o
Object main.nef.p/src_overlay023_underground_top_screen.c.o
Object main.nef.p/src_overlay023_underground_player_status.c.o
Object main.nef.p/src_overlay023_underground_comm_manager.c.o
Object main.nef.p/src_overlay023_underground_player.c.o
Object main.nef.p/src_overlay023_secret_bases.c.o
Object main.nef.p/src_overlay023_underground_player_talk.c.o
Object main.nef.p/src_overlay023_underground_menu.c.o
Object main.nef.p/src_overlay023_underground_pc.c.o
Object main.nef.p/src_overlay023_underground_vendors.c.o
Object main.nef.p/src_overlay023_underground_records.c.o
Object main.nef.p/src_overlay023_underground_text_printer.c.o
Object main.nef.p/src_overlay023_treasure_prices.c.o
Object main.nef.p/src_overlay023_trap_prices.c.o
Object main.nef.p/src_overlay023_decoration_menu.c.o
Object main.nef.p/src_overlay023_base_decoration.c.o
Object main.nef.p/src_underground_mining.c.o
Object main.nef.p/src_underground_spheres.c.o
Object main.nef.p/src_underground_manager.c.o
Object main.nef.p/src_underground_traps.c.o
Object main.nef.p/src_underground_item_list_menu.c.o
Object main.nef.p/src_underground_top_screen.c.o
Object main.nef.p/src_underground_player_status.c.o
Object main.nef.p/src_underground_comm_manager.c.o
Object main.nef.p/src_underground_player.c.o
Object main.nef.p/src_underground_secret_bases.c.o
Object main.nef.p/src_underground_player_talk.c.o
Object main.nef.p/src_underground_menus.c.o
Object main.nef.p/src_underground_pc.c.o
Object main.nef.p/src_underground_vendors.c.o
Object main.nef.p/src_underground_records.c.o
Object main.nef.p/src_underground_text_printer.c.o
Object main.nef.p/src_underground_treasure_prices.c.o
Object main.nef.p/src_underground_trap_prices.c.o
Object main.nef.p/src_underground_decoration_menu.c.o
Object main.nef.p/src_underground_base_decoration.c.o
}
Overlay poketch_unavailable

View File

@ -22,7 +22,7 @@ d414d37a9b80f1d346666ad9ef5ba635d5ebb552 *pc_boxes.sbin
7534ad61985affc27e8b121a6645b825ffae48c7 *overlay20.sbin
6dd9a720fe069aedd9107398c16ba93e57769c64 *pokedex.sbin
41ad74512da8c556fc28f8bf41ad77156d3d4cc9 *overlay22.sbin
2e8fcd133e2736d90dae6e23ac9a669cefc1a7c8 *overlay23.sbin
2e8fcd133e2736d90dae6e23ac9a669cefc1a7c8 *underground.sbin
cc4bb361071632627532c48af9a0b37c1751670a *poketch_unavailable.sbin
0fbd0432432d42462b9c02f07e30634987708dc6 *poketch.sbin
44e45c2b6ec6aa74142550f25f770954b8e0d555 *poketch_digital_watch.sbin

View File

@ -1,6 +1,7 @@
#include "macros/scrcmd.inc"
#include "res/text/bank/eterna_city_underground_man_house.h"
#include "generated/goods.h"
#include "generated/sphere_types.h"
#include "generated/traps.h"
@ -191,13 +192,13 @@ _023D:
SetVar VAR_UNK_0x40B6, 2
ClearFlag FLAG_UNK_0x0111
Message 10
SetVar VAR_0x8004, 1
SetVar VAR_0x8004, SPHERE_PRISM
SetVar VAR_0x8005, 1
Common_ObtainUndergroundSphere
SetVar VAR_0x8004, 3
SetVar VAR_0x8004, SPHERE_RED
SetVar VAR_0x8005, 1
Common_ObtainUndergroundSphere
SetVar VAR_0x8004, 4
SetVar VAR_0x8004, SPHERE_BLUE
SetVar VAR_0x8005, 1
Common_ObtainUndergroundSphere
Message 11

View File

@ -9,7 +9,7 @@
]
},
{
"id": "pl_msg_00000634_00001",
"id": "UndergroundCommon_Text_Dummy_00001",
"garbage": 16
},
{
@ -99,7 +99,7 @@
"en_US": "OK, see you!"
},
{
"id": "pl_msg_00000634_00016",
"id": "UndergroundCommon_Text_SorrySomethingsComeUp_Unused",
"en_US": [
"Sorry!\n",
"Somethings come up!"
@ -147,7 +147,7 @@
"en_US": "Hello!"
},
{
"id": "pl_msg_00000634_00023",
"id": "UndergroundCommon_Text_Dummy_00023",
"garbage": 16
},
{
@ -158,7 +158,7 @@
]
},
{
"id": "pl_msg_00000634_00025",
"id": "UndergroundCommon_Text_SorryToBugYou_Unused",
"en_US": [
"Oh, youre busy? Sorry to bug you!\n",
"Maybe next time!"
@ -208,7 +208,7 @@
]
},
{
"id": "pl_msg_00000634_00032",
"id": "UndergroundCommon_Text_OkSeeYouAround_Unused",
"en_US": "OK, see you around!"
},
{
@ -246,7 +246,7 @@
"en_US": "Close and decorate"
},
{
"id": "pl_msg_00000634_00040",
"id": "UndergroundCommon_Text_Dummy_00040",
"garbage": 24
},
{
@ -257,11 +257,11 @@
]
},
{
"id": "pl_msg_00000634_00042",
"id": "UndergroundCommon_Text_Dummy_00042",
"garbage": 26
},
{
"id": "pl_msg_00000634_00043",
"id": "UndergroundCommon_Text_Dummy_00043",
"garbage": 29
},
{
@ -276,7 +276,7 @@
]
},
{
"id": "pl_msg_00000634_00046",
"id": "UndergroundCommon_Text_Dummy_00046",
"garbage": 13
},
{
@ -294,7 +294,7 @@
]
},
{
"id": "pl_msg_00000634_00049",
"id": "UndergroundCommon_Text_Dummy_00049",
"garbage": 15
},
{
@ -317,7 +317,7 @@
]
},
{
"id": "pl_msg_00000634_00053",
"id": "UndergroundCommon_Text_Dummy_00053",
"garbage": 33
},
{
@ -358,7 +358,7 @@
"en_US": "You cant bury anything in a wall."
},
{
"id": "pl_msg_00000634_00061",
"id": "UndergroundCommon_Text_Dummy_00061",
"garbage": 14
},
{
@ -487,7 +487,7 @@
]
},
{
"id": "pl_msg_00000634_00082",
"id": "UndergroundCommon_Text_Dummy_00082",
"garbage": 17
},
{
@ -544,7 +544,7 @@
]
},
{
"id": "pl_msg_00000634_00089",
"id": "UndergroundCommon_Text_Dummy_00089",
"garbage": 11
},
{
@ -556,15 +556,15 @@
"en_US": "{STRVAR_1 3, 1, 0} has entered."
},
{
"id": "pl_msg_00000634_00092",
"id": "UndergroundCommon_Text_Dummy_00092",
"garbage": 14
},
{
"id": "pl_msg_00000634_00093",
"id": "UndergroundCommon_Text_Dummy_00093",
"garbage": 13
},
{
"id": "pl_msg_00000634_00094",
"id": "UndergroundCommon_Text_Dummy_00094",
"garbage": 15
},
{
@ -575,11 +575,11 @@
]
},
{
"id": "pl_msg_00000634_00096",
"id": "UndergroundCommon_Text_Dummy_00096",
"garbage": 17
},
{
"id": "pl_msg_00000634_00097",
"id": "UndergroundCommon_Text_Dummy_00097",
"garbage": 20
},
{
@ -598,15 +598,15 @@
]
},
{
"id": "pl_msg_00000634_00101",
"id": "UndergroundCommon_Text_Dummy_00101",
"garbage": 9
},
{
"id": "pl_msg_00000634_00102",
"id": "UndergroundCommon_Text_Dummy_00102",
"garbage": 12
},
{
"id": "pl_msg_00000634_00103",
"id": "UndergroundCommon_Text_Dummy_00103",
"garbage": 12
},
{
@ -621,11 +621,11 @@
"en_US": "{STRVAR_1 3, 0, 0} is digging for Treasure!"
},
{
"id": "pl_msg_00000634_00106",
"id": "UndergroundCommon_Text_Dummy_00106",
"garbage": 13
},
{
"id": "pl_msg_00000634_00107",
"id": "UndergroundCommon_Text_Dummy_00107",
"garbage": 13
},
{
@ -661,11 +661,11 @@
]
},
{
"id": "pl_msg_00000634_00113",
"id": "UndergroundCommon_Text_Dummy_00113",
"garbage": 25
},
{
"id": "pl_msg_00000634_00114",
"id": "UndergroundCommon_Text_Dummy_00114",
"garbage": 25
},
{
@ -888,19 +888,19 @@
]
},
{
"id": "pl_msg_00000634_00151",
"id": "UndergroundCommon_Text_Dummy_00151",
"garbage": 15
},
{
"id": "pl_msg_00000634_00152",
"id": "UndergroundCommon_Text_Dummy_00152",
"garbage": 29
},
{
"id": "pl_msg_00000634_00153",
"id": "UndergroundCommon_Text_Dummy_00153",
"garbage": 30
},
{
"id": "pl_msg_00000634_00154",
"id": "UndergroundCommon_Text_Dummy_00154",
"garbage": 24
},
{

View File

@ -83,43 +83,43 @@
"en_US": "ID: {STRVAR_1 54, 5, 0}"
},
{
"id": "pl_msg_00000639_00018",
"id": "UndergroundPC_Text_Dummy_00018",
"garbage": 9
},
{
"id": "pl_msg_00000639_00019",
"id": "UndergroundPC_Text_Dummy_00019",
"garbage": 9
},
{
"id": "pl_msg_00000639_00020",
"id": "UndergroundPC_Text_Dummy_00020",
"garbage": 8
},
{
"id": "pl_msg_00000639_00021",
"id": "UndergroundPC_Text_Dummy_00021",
"garbage": 10
},
{
"id": "pl_msg_00000639_00022",
"id": "UndergroundPC_Text_Dummy_00022",
"garbage": 3
},
{
"id": "pl_msg_00000639_00023",
"id": "UndergroundPC_Text_Dummy_00023",
"garbage": 9
},
{
"id": "pl_msg_00000639_00024",
"id": "UndergroundPC_Text_Dummy_00024",
"garbage": 9
},
{
"id": "pl_msg_00000639_00025",
"id": "UndergroundPC_Text_Dummy_00025",
"garbage": 8
},
{
"id": "pl_msg_00000639_00026",
"id": "UndergroundPC_Text_Dummy_00026",
"garbage": 10
},
{
"id": "pl_msg_00000639_00027",
"id": "UndergroundPC_Text_Dummy_00027",
"garbage": 3
},
{
@ -130,21 +130,21 @@
]
},
{
"id": "pl_msg_00000639_00029",
"id": "UndergroundPC_Text_TreasuresOnHand_Unused",
"en_US": [
"Treasures\n",
"on hand"
]
},
{
"id": "pl_msg_00000639_00030",
"id": "UndergroundPC_Text_TrapsOnHand_Unused",
"en_US": [
"Traps on\n",
"hand"
]
},
{
"id": "pl_msg_00000639_00031",
"id": "UndergroundPC_Text_SpheresOnHand_Unused",
"en_US": [
"Spheres\n",
"on hand"
@ -158,21 +158,21 @@
]
},
{
"id": "pl_msg_00000639_00033",
"id": "UndergroundPC_Text_TreasuresInPC_Unused",
"en_US": [
"Treasures\n",
"in PC"
]
},
{
"id": "pl_msg_00000639_00034",
"id": "UndergroundPC_Text_TrapsInPC_Unused",
"en_US": [
"Traps in\n",
"PC"
]
},
{
"id": "pl_msg_00000639_00035",
"id": "UndergroundPC_Text_SpheresInPC_Unused",
"en_US": [
"Spheres\n",
"in PC"
@ -280,11 +280,11 @@
"en_US": "ID:-------"
},
{
"id": "pl_msg_00000639_00053",
"id": "UndergroundPC_Text_Dummy_00053",
"garbage": 18
},
{
"id": "pl_msg_00000639_00054",
"id": "UndergroundPC_Text_Dummy_00054",
"garbage": 17
},
{

View File

@ -19,13 +19,13 @@
#include "field/field_system.h"
#include "overlay005/ov5_021F55CC.h"
#include "overlay023/mining.h"
#include "overlay023/secret_bases.h"
#include "overlay023/underground_comm_manager.h"
#include "overlay023/underground_manager.h"
#include "overlay023/underground_player.h"
#include "overlay023/underground_player_status.h"
#include "overlay023/underground_traps.h"
#include "underground/comm_manager.h"
#include "underground/manager.h"
#include "underground/mining.h"
#include "underground/player.h"
#include "underground/player_status.h"
#include "underground/secret_bases.h"
#include "underground/traps.h"
#include "communication_information.h"
#include "communication_system.h"
@ -525,7 +525,7 @@ static void sub_02057EF8(void *unused)
}
} else if (sCommPlayerManager->isActive[netId]) {
if (CommSys_CurNetId() == 0 && sCommPlayerManager->isUnderground) {
UndergroundTraps_RemoveLinkData(netId);
Traps_RemoveLinkData(netId);
Mining_ResetPlayerData(netId);
}
@ -712,7 +712,7 @@ static void CommPlayer_Move(SysTask *unused0, void *unused1)
if (sCommPlayerManager->moveTimerServer[netId] == 0) {
if (sCommPlayerManager->isUnderground) {
if (UndergroundTraps_CheckPlayerSteppedOnTrap(netId)) {
if (Traps_CheckPlayerSteppedOnTrap(netId)) {
continue;
}
@ -799,7 +799,7 @@ static void CommPlayer_Move(SysTask *unused0, void *unused1)
if (sCommPlayerManager->alteredMovementStepsLeft[netId] == 0) {
u8 v10 = 1;
UndergroundTraps_EscapeTrapServer(netId, 1, &v10, NULL);
Traps_EscapeTrapServer(netId, 1, &v10, NULL);
}
}
}
@ -1138,7 +1138,7 @@ static BOOL CommPlayer_MoveSlide(int netId, int speed)
} else if (sCommPlayerManager->slideTilesLeft[netId] == 0) {
u8 data = 1;
UndergroundTraps_EscapeTrapServer(netId, 1, &data, NULL);
Traps_EscapeTrapServer(netId, 1, &data, NULL);
return TRUE;
}

View File

@ -12,7 +12,7 @@
#include "field/field_system.h"
#include "functypes/funcptr_020598EC.h"
#include "overlay007/communication_club.h"
#include "overlay023/underground_manager.h"
#include "underground/manager.h"
#include "comm_player_manager.h"
#include "communication_information.h"

View File

@ -18,9 +18,9 @@
#include "overlay005/struct_ov5_021D432C_decl.h"
#include "overlay006/field_warp.h"
#include "overlay006/hm_cut_in.h"
#include "overlay023/secret_bases.h"
#include "overlay023/underground_comm_manager.h"
#include "overlay023/underground_top_screen.h"
#include "underground/comm_manager.h"
#include "underground/secret_bases.h"
#include "underground/top_screen.h"
#include "bg_window.h"
#include "brightness_controller.h"
@ -72,7 +72,7 @@
#include "unk_02070428.h"
#include "vars_flags.h"
FS_EXTERN_OVERLAY(overlay23);
FS_EXTERN_OVERLAY(underground);
typedef struct MapChangeData {
int state;
@ -1219,7 +1219,7 @@ BOOL FieldTask_MapChangeToUnderground(FieldTask *task)
break;
case 9:
fieldSystem->mapLoadType = MAP_LOAD_TYPE_UNDERGROUND;
Overlay_LoadByID(FS_OVERLAY_ID(overlay23), 2);
Overlay_LoadByID(FS_OVERLAY_ID(underground), 2);
CommManUnderground_InitUnderground(fieldSystem);
FieldTask_ChangeMapToLocation(task, mapChangeUndergroundData->mapId, -1, mapChangeUndergroundData->unk_10, mapChangeUndergroundData->unk_14, 1);
mapChangeUndergroundData->state++;
@ -1287,7 +1287,7 @@ BOOL FieldTask_MapChangeFromUnderground(FieldTask *task)
break;
case 4:
fieldSystem->mapLoadType = MAP_LOAD_TYPE_OVERWORLD;
Overlay_UnloadByID(FS_OVERLAY_ID(overlay23));
Overlay_UnloadByID(FS_OVERLAY_ID(underground));
FieldTask_ChangeMapToLocation(task, mapChangeUndergroundData->mapId, -1, mapChangeUndergroundData->unk_10, mapChangeUndergroundData->unk_14, 1);
mapChangeUndergroundData->state++;
break;

View File

@ -4,15 +4,16 @@
#include <string.h>
#include "generated/goods.h"
#include "generated/sphere_types.h"
#include "overlay023/underground_defs.h"
#include "underground/defs.h"
#include "res/text/bank/underground_records.h"
typedef struct GoodData {
u8 width;
u8 depth;
u8 collision[9];
u8 collision[MAX_GOOD_WIDTH * MAX_GOOD_DEPTH];
SpherePrice spherePrice;
int moneyPrice;
int interactMessageID;
@ -157,7 +158,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 8,
.maxSize = 10,
},
@ -175,7 +176,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 8,
.maxSize = 10,
},
@ -193,7 +194,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 8,
.maxSize = 10,
},
@ -211,7 +212,7 @@ static const GoodData sGoodData[] = {
1, 1, 1,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 12,
.maxSize = 15,
},
@ -229,7 +230,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 8,
.maxSize = 10,
},
@ -247,7 +248,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 8,
.maxSize = 10,
},
@ -265,7 +266,7 @@ static const GoodData sGoodData[] = {
1, 0, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 12,
.maxSize = 15,
},
@ -283,7 +284,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 12,
.maxSize = 15,
},
@ -301,7 +302,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 20,
.maxSize = 25,
},
@ -319,7 +320,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 20,
.maxSize = 25,
},
@ -337,7 +338,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 8,
.maxSize = 10,
},
@ -355,7 +356,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 12,
.maxSize = 15,
},
@ -373,7 +374,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 35,
.maxSize = 49,
},
@ -391,7 +392,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 35,
.maxSize = 49,
},
@ -409,7 +410,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 12,
.maxSize = 15,
},
@ -427,7 +428,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 20,
.maxSize = 25,
},
@ -445,7 +446,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 20,
.maxSize = 25,
},
@ -463,7 +464,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 50,
.maxSize = 60,
},
@ -481,7 +482,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PRISM_SPHERE,
.sphereType = SPHERE_PRISM,
.minSize = 9,
.maxSize = 10,
},
@ -499,7 +500,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 12,
.maxSize = 15,
},
@ -517,7 +518,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PRISM_SPHERE,
.sphereType = SPHERE_PRISM,
.minSize = 9,
.maxSize = 10,
},
@ -535,7 +536,7 @@ static const GoodData sGoodData[] = {
0, 1, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 33,
.maxSize = 40,
},
@ -553,7 +554,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 8,
.maxSize = 10,
},
@ -571,7 +572,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 20,
.maxSize = 25,
},
@ -589,7 +590,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 33,
.maxSize = 40,
},
@ -607,7 +608,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PALE_SPHERE,
.sphereType = SPHERE_PALE,
.minSize = 10,
.maxSize = 40,
},
@ -625,7 +626,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PALE_SPHERE,
.sphereType = SPHERE_PALE,
.minSize = 10,
.maxSize = 40,
},
@ -643,7 +644,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PALE_SPHERE,
.sphereType = SPHERE_PALE,
.minSize = 10,
.maxSize = 40,
},
@ -661,7 +662,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PRISM_SPHERE,
.sphereType = SPHERE_PRISM,
.minSize = 9,
.maxSize = 10,
},
@ -679,7 +680,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 20,
.maxSize = 25,
},
@ -697,7 +698,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PALE_SPHERE,
.sphereType = SPHERE_PALE,
.minSize = 10,
.maxSize = 40,
},
@ -715,7 +716,7 @@ static const GoodData sGoodData[] = {
1, 1, 0,
},
.spherePrice = {
.sphereType = PRISM_SPHERE,
.sphereType = SPHERE_PRISM,
.minSize = 90,
.maxSize = 99,
},
@ -733,7 +734,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PRISM_SPHERE,
.sphereType = SPHERE_PRISM,
.minSize = 28,
.maxSize = 30,
},
@ -751,7 +752,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PRISM_SPHERE,
.sphereType = SPHERE_PRISM,
.minSize = 28,
.maxSize = 30,
},
@ -769,7 +770,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PRISM_SPHERE,
.sphereType = SPHERE_PRISM,
.minSize = 48,
.maxSize = 50,
},
@ -787,7 +788,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 8,
.maxSize = 10,
},
@ -805,7 +806,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 33,
.maxSize = 40,
},
@ -823,7 +824,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 33,
.maxSize = 40,
},
@ -841,7 +842,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PALE_SPHERE,
.sphereType = SPHERE_PALE,
.minSize = 10,
.maxSize = 40,
},
@ -895,7 +896,7 @@ static const GoodData sGoodData[] = {
1, 0, 1,
},
.spherePrice = {
.sphereType = PALE_SPHERE,
.sphereType = SPHERE_PALE,
.minSize = 20,
.maxSize = 70,
},
@ -913,7 +914,7 @@ static const GoodData sGoodData[] = {
1, 0, 1,
},
.spherePrice = {
.sphereType = PALE_SPHERE,
.sphereType = SPHERE_PALE,
.minSize = 20,
.maxSize = 70,
},
@ -931,7 +932,7 @@ static const GoodData sGoodData[] = {
1, 0, 1,
},
.spherePrice = {
.sphereType = PALE_SPHERE,
.sphereType = SPHERE_PALE,
.minSize = 40,
.maxSize = 99,
},
@ -949,7 +950,7 @@ static const GoodData sGoodData[] = {
1, 0, 1,
},
.spherePrice = {
.sphereType = PRISM_SPHERE,
.sphereType = SPHERE_PRISM,
.minSize = 48,
.maxSize = 50,
},
@ -967,7 +968,7 @@ static const GoodData sGoodData[] = {
1, 0, 1,
},
.spherePrice = {
.sphereType = PRISM_SPHERE,
.sphereType = SPHERE_PRISM,
.minSize = 48,
.maxSize = 50,
},
@ -985,7 +986,7 @@ static const GoodData sGoodData[] = {
1, 1, 1,
},
.spherePrice = {
.sphereType = PRISM_SPHERE,
.sphereType = SPHERE_PRISM,
.minSize = 48,
.maxSize = 50,
},
@ -1003,7 +1004,7 @@ static const GoodData sGoodData[] = {
1, 0, 1,
},
.spherePrice = {
.sphereType = PRISM_SPHERE,
.sphereType = SPHERE_PRISM,
.minSize = 48,
.maxSize = 50,
},
@ -1021,7 +1022,7 @@ static const GoodData sGoodData[] = {
1, 0, 1,
},
.spherePrice = {
.sphereType = PRISM_SPHERE,
.sphereType = SPHERE_PRISM,
.minSize = 48,
.maxSize = 50,
},
@ -1039,7 +1040,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 10,
.maxSize = 12,
},
@ -1057,7 +1058,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 25,
.maxSize = 30,
},
@ -1075,7 +1076,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 12,
.maxSize = 14,
},
@ -1093,7 +1094,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 28,
.maxSize = 32,
},
@ -1111,7 +1112,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 10,
.maxSize = 12,
},
@ -1129,7 +1130,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 25,
.maxSize = 30,
},
@ -1147,7 +1148,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 12,
.maxSize = 14,
},
@ -1165,7 +1166,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 28,
.maxSize = 32,
},
@ -1183,7 +1184,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PALE_SPHERE,
.sphereType = SPHERE_PALE,
.minSize = 20,
.maxSize = 50,
},
@ -1201,7 +1202,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PALE_SPHERE,
.sphereType = SPHERE_PALE,
.minSize = 20,
.maxSize = 50,
},
@ -1219,7 +1220,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PALE_SPHERE,
.sphereType = SPHERE_PALE,
.minSize = 20,
.maxSize = 50,
},
@ -1237,7 +1238,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PALE_SPHERE,
.sphereType = SPHERE_PALE,
.minSize = 20,
.maxSize = 50,
},
@ -1255,7 +1256,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 30,
.maxSize = 38,
},
@ -1273,7 +1274,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 65,
.maxSize = 80,
},
@ -1291,7 +1292,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 15,
.maxSize = 18,
},
@ -1309,7 +1310,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 33,
.maxSize = 40,
},
@ -1687,7 +1688,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 25,
.maxSize = 30,
},
@ -1705,7 +1706,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 25,
.maxSize = 30,
},
@ -1723,7 +1724,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 25,
.maxSize = 30,
},
@ -1741,7 +1742,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 25,
.maxSize = 30,
},
@ -1759,7 +1760,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 25,
.maxSize = 30,
},
@ -1777,7 +1778,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 25,
.maxSize = 30,
},
@ -1795,7 +1796,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 25,
.maxSize = 30,
},
@ -1813,7 +1814,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 25,
.maxSize = 30,
},
@ -1831,7 +1832,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 25,
.maxSize = 30,
},
@ -1849,7 +1850,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 25,
.maxSize = 40,
},
@ -1867,7 +1868,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 35,
.maxSize = 40,
},
@ -1885,7 +1886,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 35,
.maxSize = 40,
},
@ -1903,7 +1904,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PALE_SPHERE,
.sphereType = SPHERE_PALE,
.minSize = 70,
.maxSize = 99,
},
@ -1921,7 +1922,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 60,
.maxSize = 70,
},
@ -1939,7 +1940,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 60,
.maxSize = 70,
},
@ -1957,7 +1958,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PALE_SPHERE,
.sphereType = SPHERE_PALE,
.minSize = 40,
.maxSize = 70,
},
@ -1975,7 +1976,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PALE_SPHERE,
.sphereType = SPHERE_PALE,
.minSize = 40,
.maxSize = 70,
},
@ -1993,7 +1994,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 80,
.maxSize = 99,
},
@ -2011,7 +2012,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 15,
.maxSize = 20,
},
@ -2029,7 +2030,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 15,
.maxSize = 20,
},
@ -2047,7 +2048,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 15,
.maxSize = 20,
},
@ -2065,7 +2066,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PALE_SPHERE,
.sphereType = SPHERE_PALE,
.minSize = 15,
.maxSize = 30,
},
@ -2083,7 +2084,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PRISM_SPHERE,
.sphereType = SPHERE_PRISM,
.minSize = 28,
.maxSize = 30,
},
@ -2245,7 +2246,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = RED_SPHERE,
.sphereType = SPHERE_RED,
.minSize = 80,
.maxSize = 99,
},
@ -2263,7 +2264,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 80,
.maxSize = 99,
},
@ -2299,7 +2300,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 33,
.maxSize = 40,
},
@ -2317,7 +2318,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PALE_SPHERE,
.sphereType = SPHERE_PALE,
.minSize = 40,
.maxSize = 70,
},
@ -2335,7 +2336,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = PALE_SPHERE,
.sphereType = SPHERE_PALE,
.minSize = 70,
.maxSize = 99,
},
@ -2425,7 +2426,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = BLUE_SPHERE,
.sphereType = SPHERE_BLUE,
.minSize = 20,
.maxSize = 25,
},
@ -2443,7 +2444,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 8,
.maxSize = 10,
},
@ -2461,7 +2462,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 8,
.maxSize = 10,
},
@ -2479,7 +2480,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 8,
.maxSize = 10,
},
@ -2497,7 +2498,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 8,
.maxSize = 10,
},
@ -2515,7 +2516,7 @@ static const GoodData sGoodData[] = {
0, 0, 0,
},
.spherePrice = {
.sphereType = GREEN_SPHERE,
.sphereType = SPHERE_GREEN,
.minSize = 8,
.maxSize = 10,
},

View File

@ -635,26 +635,26 @@ pokeplatinum_c = files(
'overlay022/ov22_0225AF44.c',
'overlay022/ov22_0225AF8C.c',
'overlay022/ov22_0225B660.c',
'overlay023/mining.c',
'overlay023/underground_spheres.c',
'overlay023/underground_manager.c',
'overlay023/underground_traps.c',
'overlay023/underground_item_list_menu.c',
'overlay023/underground_top_screen.c',
'overlay023/underground_player_status.c',
'overlay023/underground_comm_manager.c',
'overlay023/underground_player.c',
'overlay023/secret_bases.c',
'overlay023/underground_player_talk.c',
'overlay023/underground_menu.c',
'overlay023/underground_pc.c',
'overlay023/underground_vendors.c',
'overlay023/underground_records.c',
'overlay023/underground_text_printer.c',
'overlay023/treasure_prices.c',
'overlay023/trap_prices.c',
'overlay023/decoration_menu.c',
'overlay023/base_decoration.c',
'underground/mining.c',
'underground/spheres.c',
'underground/manager.c',
'underground/traps.c',
'underground/item_list_menu.c',
'underground/top_screen.c',
'underground/player_status.c',
'underground/comm_manager.c',
'underground/player.c',
'underground/secret_bases.c',
'underground/player_talk.c',
'underground/menus.c',
'underground/pc.c',
'underground/vendors.c',
'underground/records.c',
'underground/text_printer.c',
'underground/treasure_prices.c',
'underground/trap_prices.c',
'underground/decoration_menu.c',
'underground/base_decoration.c',
'applications/poketch/unavailable/graphics.c',
'applications/poketch/poketch_system.c',
'applications/poketch/poketch_graphics.c',

View File

@ -27,7 +27,7 @@
#include "overlay006/wild_encounters.h"
#include "overlay008/ov8_02249960.h"
#include "overlay009/ov9_02249960.h"
#include "overlay023/underground_manager.h"
#include "underground/manager.h"
#include "catching_show.h"
#include "comm_player_manager.h"

View File

@ -8,7 +8,7 @@
#include "field/field_system.h"
#include "overlay005/area_data.h"
#include "overlay005/map_prop.h"
#include "overlay023/underground_manager.h"
#include "underground/manager.h"
#include "field_comm_manager.h"
#include "goods.h"

View File

@ -1,62 +0,0 @@
#include "overlay023/trap_prices.h"
#include <nitro.h>
#include <string.h>
#include "generated/traps.h"
#include "overlay023/underground_defs.h"
// TODO: make this error if it doesn't contain an entry for every trap
static const SpherePrice sTrapPrices[] = {
[TRAP_NONE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[TRAP_MOVE_UP] = { .sphereType = BLUE_SPHERE, .minSize = 3, .maxSize = 6 },
[TRAP_MOVE_RIGHT] = { .sphereType = RED_SPHERE, .minSize = 3, .maxSize = 6 },
[TRAP_MOVE_DOWN] = { .sphereType = BLUE_SPHERE, .minSize = 3, .maxSize = 6 },
[TRAP_MOVE_LEFT] = { .sphereType = RED_SPHERE, .minSize = 3, .maxSize = 6 },
[TRAP_HURL_UP] = { .sphereType = BLUE_SPHERE, .minSize = 12, .maxSize = 15 },
[TRAP_HURL_RIGHT] = { .sphereType = RED_SPHERE, .minSize = 12, .maxSize = 15 },
[TRAP_HURL_DOWN] = { .sphereType = BLUE_SPHERE, .minSize = 12, .maxSize = 15 },
[TRAP_HURL_LEFT] = { .sphereType = RED_SPHERE, .minSize = 12, .maxSize = 15 },
[TRAP_WARP_DUMMY] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[TRAP_HI_WARP_DUMMY] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[TRAP_HOLE] = { .sphereType = PRISM_SPHERE, .minSize = 3, .maxSize = 6 },
[TRAP_PIT] = { .sphereType = PRISM_SPHERE, .minSize = 12, .maxSize = 15 },
[TRAP_REVERSE] = { .sphereType = PALE_SPHERE, .minSize = 10, .maxSize = 12 },
[TRAP_CONFUSE] = { .sphereType = PALE_SPHERE, .minSize = 10, .maxSize = 12 },
[TRAP_RUN_DUMMY] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[TRAP_FADE_DUMMY] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[TRAP_SLOW_DUMMY] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[TRAP_SMOKE] = { .sphereType = RED_SPHERE, .minSize = 5, .maxSize = 7 },
[TRAP_BIG_SMOKE] = { .sphereType = RED_SPHERE, .minSize = 12, .maxSize = 16 },
[TRAP_ROCK] = { .sphereType = BLUE_SPHERE, .minSize = 3, .maxSize = 6 },
[TRAP_ROCKFALL] = { .sphereType = BLUE_SPHERE, .minSize = 8, .maxSize = 15 },
[TRAP_FOAM] = { .sphereType = BLUE_SPHERE, .minSize = 5, .maxSize = 7 },
[TRAP_BUBBLE] = { .sphereType = BLUE_SPHERE, .minSize = 12, .maxSize = 16 },
[TRAP_ALERT_1] = { .sphereType = PALE_SPHERE, .minSize = 5, .maxSize = 9 },
[TRAP_ALERT_2] = { .sphereType = PALE_SPHERE, .minSize = 5, .maxSize = 9 },
[TRAP_ALERT_3] = { .sphereType = PALE_SPHERE, .minSize = 5, .maxSize = 9 },
[TRAP_ALERT_4] = { .sphereType = PALE_SPHERE, .minSize = 5, .maxSize = 9 },
[TRAP_LEAF] = { .sphereType = GREEN_SPHERE, .minSize = 15, .maxSize = 19 },
[TRAP_FLOWER] = { .sphereType = GREEN_SPHERE, .minSize = 30, .maxSize = 40 },
[TRAP_EMBER] = { .sphereType = RED_SPHERE, .minSize = 5, .maxSize = 9 },
[TRAP_FIRE] = { .sphereType = RED_SPHERE, .minSize = 20, .maxSize = 30 },
[TRAP_RADAR_DUMMY] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[TRAP_DIGGER_DRILL] = { .sphereType = RANDOM_SPHERE_TYPE, .minSize = 15, .maxSize = 20 }
};
// params need to be const to match
const u8 TrapGetSpherePriceType(const int trapID)
{
return sTrapPrices[trapID].sphereType;
}
const u8 TrapGetSpherePriceMinSize(const int trapID)
{
return sTrapPrices[trapID].minSize;
}
const u8 TrapGetSpherePriceMaxSize(const int trapID)
{
return sTrapPrices[trapID].maxSize;
}

View File

@ -1,86 +0,0 @@
#include "overlay023/treasure_prices.h"
#include <nitro.h>
#include <string.h>
#include "overlay023/mining.h"
#include "overlay023/underground_defs.h"
// TODO: make this error if it doesn't contain an entry for every treasure
static const SpherePrice sTreasurePrices[] = {
[MINING_TREASURE_NONE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_SMALL_PRISM_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_SMALL_PALE_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_SMALL_RED_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_SMALL_BLUE_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_SMALL_GREEN_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_LARGE_PRISM_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_LARGE_PALE_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_LARGE_RED_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_LARGE_BLUE_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_LARGE_GREEN_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_TREASURE_OVAL_STONE] = { .sphereType = PALE_SPHERE, .minSize = 15, .maxSize = 20 },
[MINING_TREASURE_ODD_KEYSTONE] = { .sphereType = PRISM_SPHERE, .minSize = 50, .maxSize = 60 },
[MINING_TREASURE_SUN_STONE] = { .sphereType = RED_SPHERE, .minSize = 25, .maxSize = 35 },
[MINING_TREASURE_STAR_PIECE] = { .sphereType = PALE_SPHERE, .minSize = 35, .maxSize = 45 },
[MINING_TREASURE_MOON_STONE] = { .sphereType = PALE_SPHERE, .minSize = 25, .maxSize = 35 },
[MINING_TREASURE_HARD_STONE] = { .sphereType = RED_SPHERE, .minSize = 25, .maxSize = 35 },
[MINING_TREASURE_THUNDERSTONE] = { .sphereType = PRISM_SPHERE, .minSize = 25, .maxSize = 35 },
[MINING_TREASURE_EVERSTONE] = { .sphereType = PALE_SPHERE, .minSize = 25, .maxSize = 35 },
[MINING_TREASURE_FIRE_STONE] = { .sphereType = RED_SPHERE, .minSize = 25, .maxSize = 35 },
[MINING_TREASURE_WATER_STONE] = { .sphereType = BLUE_SPHERE, .minSize = 25, .maxSize = 35 },
[MINING_TREASURE_LEAF_STONE] = { .sphereType = GREEN_SPHERE, .minSize = 25, .maxSize = 35 },
[MINING_TREASURE_NUGGET_UNUSED] = { .sphereType = BLUE_SPHERE, .minSize = 0, .maxSize = 0 },
[MINING_TREASURE_HELIX_FOSSIL] = { .sphereType = BLUE_SPHERE, .minSize = 30, .maxSize = 50 },
[MINING_TREASURE_DOME_FOSSIL] = { .sphereType = GREEN_SPHERE, .minSize = 30, .maxSize = 50 },
[MINING_TREASURE_CLAW_FOSSIL] = { .sphereType = BLUE_SPHERE, .minSize = 30, .maxSize = 50 },
[MINING_TREASURE_ROOT_FOSSIL] = { .sphereType = GREEN_SPHERE, .minSize = 30, .maxSize = 50 },
[MINING_TREASURE_OLD_AMBER] = { .sphereType = PRISM_SPHERE, .minSize = 30, .maxSize = 50 },
[MINING_TREASURE_RARE_BONE] = { .sphereType = PALE_SPHERE, .minSize = 25, .maxSize = 35 },
[MINING_TREASURE_REVIVE] = { .sphereType = PALE_SPHERE, .minSize = 5, .maxSize = 10 },
[MINING_TREASURE_MAX_REVIVE] = { .sphereType = PALE_SPHERE, .minSize = 40, .maxSize = 50 },
[MINING_TREASURE_RED_SHARD] = { .sphereType = RED_SPHERE, .minSize = 20, .maxSize = 25 },
[MINING_TREASURE_BLUE_SHARD] = { .sphereType = BLUE_SPHERE, .minSize = 20, .maxSize = 25 },
[MINING_TREASURE_YELLOW_SHARD] = { .sphereType = PRISM_SPHERE, .minSize = 20, .maxSize = 25 },
[MINING_TREASURE_GREEN_SHARD] = { .sphereType = GREEN_SPHERE, .minSize = 20, .maxSize = 25 },
[MINING_TREASURE_HEART_SCALE] = { .sphereType = RED_SPHERE, .minSize = 5, .maxSize = 10 },
[MINING_TREASURE_ARMOR_FOSSIL] = { .sphereType = BLUE_SPHERE, .minSize = 30, .maxSize = 50 },
[MINING_TREASURE_SKULL_FOSSIL] = { .sphereType = GREEN_SPHERE, .minSize = 30, .maxSize = 50 },
[MINING_TREASURE_LIGHT_CLAY] = { .sphereType = PALE_SPHERE, .minSize = 40, .maxSize = 50 },
[MINING_TREASURE_IRON_BALL] = { .sphereType = PRISM_SPHERE, .minSize = 40, .maxSize = 50 },
[MINING_TREASURE_ICY_ROCK] = { .sphereType = PALE_SPHERE, .minSize = 35, .maxSize = 40 },
[MINING_TREASURE_SMOOTH_ROCK] = { .sphereType = PRISM_SPHERE, .minSize = 35, .maxSize = 40 },
[MINING_TREASURE_HEAT_ROCK] = { .sphereType = RED_SPHERE, .minSize = 40, .maxSize = 50 },
[MINING_TREASURE_DAMP_ROCK] = { .sphereType = BLUE_SPHERE, .minSize = 40, .maxSize = 50 },
[MINING_TREASURE_FLAME_PLATE] = { .sphereType = RED_SPHERE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_SPLASH_PLATE] = { .sphereType = BLUE_SPHERE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_ZAP_PLATE] = { .sphereType = PRISM_SPHERE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_MEADOW_PLATE] = { .sphereType = GREEN_SPHERE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_ICICLE_PLATE] = { .sphereType = BLUE_SPHERE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_FIST_PLATE] = { .sphereType = PRISM_SPHERE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_TOXIC_PLATE] = { .sphereType = PALE_SPHERE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_EARTH_PLATE] = { .sphereType = GREEN_SPHERE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_SKY_PLATE] = { .sphereType = BLUE_SPHERE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_MIND_PLATE] = { .sphereType = PALE_SPHERE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_INSECT_PLATE] = { .sphereType = GREEN_SPHERE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_STONE_PLATE] = { .sphereType = PRISM_SPHERE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_SPOOKY_PLATE] = { .sphereType = PALE_SPHERE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_DRACO_PLATE] = { .sphereType = RED_SPHERE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_DREAD_PLATE] = { .sphereType = RED_SPHERE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_IRON_PLATE] = { .sphereType = PRISM_SPHERE, .minSize = 70, .maxSize = 80 }
};
u8 Treasure_GetSpherePriceType(int treasureID)
{
return sTreasurePrices[treasureID].sphereType;
}
u8 Treasure_GetSpherePriceMinSize(int treasureID)
{
return sTreasurePrices[treasureID].minSize;
}
u8 Treasure_GetSpherePriceMaxSize(int treasureID)
{
return sTreasurePrices[treasureID].maxSize;
}

View File

@ -1,584 +0,0 @@
#include "overlay023/underground_spheres.h"
#include <nitro.h>
#include <string.h>
#include "generated/game_records.h"
#include "struct_defs/underground.h"
#include "field/field_system.h"
#include "overlay005/ov5_021F575C.h"
#include "overlay023/mining.h"
#include "overlay023/underground_manager.h"
#include "overlay023/underground_menu.h"
#include "overlay023/underground_text_printer.h"
#include "comm_player_manager.h"
#include "communication_system.h"
#include "field_system.h"
#include "game_records.h"
#include "heap.h"
#include "message.h"
#include "sound_playback.h"
#include "string_gf.h"
#include "string_template.h"
#include "sys_task.h"
#include "sys_task_manager.h"
#include "system_flags.h"
#include "terrain_collision_manager.h"
#include "unk_0202854C.h"
#include "vars_flags.h"
#include "res/text/bank/underground_common.h"
typedef struct BuriedSphere {
u16 x;
u16 z;
u8 initialSize;
u8 growth;
u8 type;
} BuriedSphere;
typedef struct SphereRadarTimer {
u8 unused;
u16 timer;
} SphereRadarTimer;
typedef struct BuriedSpheresEnv {
BuriedSphere buriedSpheres[MAX_BURIED_SPHERES];
BuriedSphere *buriedSpheresByCoordinates[MAX_BURIED_SPHERES];
u8 unused[16];
SysTask *sysTask;
SphereRadarTimer *sphereRadarTimer;
FieldSystem *fieldSystem;
u8 retrievedSpheres[MAX_CONNECTED_PLAYERS];
int sparkleTimer;
u8 unused2[2];
u8 disableBuriedSphereSparkles;
} BuriedSpheresEnv;
static BuriedSphere *UndergroundSpheres_Dummy(BuriedSphere *param0);
static Coordinates *UndergroundSpheres_GetCoordinatesOfBuriedSphereAtOrderedIndex(Coordinates *param0, int param1);
static void UndergroundSpheres_RemoveBuriedSphere(BuriedSphere *param0);
static void UndergroundSpheres_AddBuriedSphere(BuriedSphere *param0);
static void UndergroundSpheres_AddBuriedSphereToCoordinatesOrdering(BuriedSphere *param0);
static BuriedSpheresEnv *buriedSpheresEnv = NULL;
static void UndergroundSpheres_ResumeFieldSystem(int unused)
{
CommPlayerMan_ResumeFieldSystem();
}
static void UndergroundSpheres_PrintSphereGrowth(int growth)
{
if (growth > 0) {
UndergroundTextPrinter_SetTwoDigitNumberWithIndex(UndergroundMan_GetCommonTextPrinter(), 0, growth);
UndergroundTextPrinter_PrintText(UndergroundMan_GetCommonTextPrinter(), UndergroundCommon_Text_ItsSizeGrewBiggerBy, TRUE, UndergroundSpheres_ResumeFieldSystem);
} else {
UndergroundSpheres_ResumeFieldSystem(growth);
}
}
void BuriedSpheresEnv_Init(void *dest, FieldSystem *fieldSystem)
{
if (buriedSpheresEnv) {
return;
}
buriedSpheresEnv = dest;
MI_CpuFill8(buriedSpheresEnv, 0, sizeof(BuriedSpheresEnv));
buriedSpheresEnv->fieldSystem = fieldSystem;
Underground *underground = SaveData_GetUnderground(FieldSystem_GetSaveData(fieldSystem));
for (int i = 0; i < MAX_BURIED_SPHERES; i++) {
buriedSpheresEnv->buriedSpheres[i].type = Underground_GetBuriedSphereTypeAtIndex(underground, i);
buriedSpheresEnv->buriedSpheres[i].x = Underground_GetBuriedSphereXCoordAtIndex(underground, i);
buriedSpheresEnv->buriedSpheres[i].z = Underground_GetBuriedSphereZCoordAtIndex(underground, i);
buriedSpheresEnv->buriedSpheres[i].initialSize = Underground_GetBuriedSphereInitialSizeAtIndex(underground, i);
buriedSpheresEnv->buriedSpheres[i].growth = Underground_GetBuriedSphereGrowthAtIndex(underground, i);
if (buriedSpheresEnv->buriedSpheres[i].type != SPHERE_NONE) {
UndergroundSpheres_AddBuriedSphereToCoordinatesOrdering(&buriedSpheresEnv->buriedSpheres[i]);
}
}
}
static void UndergroundSpheres_SaveBuriedSpheres(void)
{
Underground *underground = SaveData_GetUnderground(FieldSystem_GetSaveData(buriedSpheresEnv->fieldSystem));
for (int i = 0; i < MAX_BURIED_SPHERES; i++) {
Underground_SaveBuriedSphere(underground, buriedSpheresEnv->buriedSpheres[i].type, i, buriedSpheresEnv->buriedSpheres[i].x, buriedSpheresEnv->buriedSpheres[i].z, buriedSpheresEnv->buriedSpheres[i].initialSize, buriedSpheresEnv->buriedSpheres[i].growth);
}
}
int BuriedSpheresEnv_Size(void)
{
return sizeof(BuriedSpheresEnv);
}
void UndergroundSpheres_DisableBuriedSphereSparkles(void)
{
buriedSpheresEnv->disableBuriedSphereSparkles = TRUE;
}
void UndergroundSpheres_EnableBuriedSphereSparkles(void)
{
buriedSpheresEnv->disableBuriedSphereSparkles = FALSE;
}
void BuriedSpheresEnv_Free(void)
{
if (buriedSpheresEnv) {
Heap_Free(buriedSpheresEnv);
buriedSpheresEnv = NULL;
}
}
void UndergroundSpheres_AdvanceBuriedSphereSparkleTimer(void)
{
if (buriedSpheresEnv->disableBuriedSphereSparkles) {
return;
}
buriedSpheresEnv->sparkleTimer++;
if (buriedSpheresEnv->sparkleTimer >= MAX_BURIED_SPHERES * 20) {
buriedSpheresEnv->sparkleTimer = 0;
}
if ((buriedSpheresEnv->sparkleTimer % 20) == 10) {
int idx = buriedSpheresEnv->sparkleTimer / 20;
int x = UndergroundSpheres_GetBuriedSphereXCoordAtIndex(idx);
int z = UndergroundSpheres_GetBuriedSphereZCoordAtIndex(idx);
if (x != 0 && z != 0) {
ov5_DisplayBuriedSphereSparkle(buriedSpheresEnv->fieldSystem, x, z);
}
}
}
static Coordinates *UndergroundSpheres_GetCoordinatesOfBuriedSphereAtOrderedIndex(Coordinates *coordinates, int idx)
{
if (buriedSpheresEnv->buriedSpheresByCoordinates[idx] == NULL) {
return NULL;
}
coordinates->x = buriedSpheresEnv->buriedSpheresByCoordinates[idx]->x;
coordinates->z = buriedSpheresEnv->buriedSpheresByCoordinates[idx]->z;
return coordinates;
}
static void UndergroundSpheres_AddBuriedSphereToCoordinatesOrdering(BuriedSphere *sphere)
{
Coordinates coordinates = {
.x = sphere->x,
.z = sphere->z
};
UndergroundMan_InitCoordsOrderingState(MAX_BURIED_SPHERES, UndergroundSpheres_GetCoordinatesOfBuriedSphereAtOrderedIndex);
int index = UndergroundMan_CalcCoordsIndexInsert(&coordinates);
GF_ASSERT(index < MAX_BURIED_SPHERES);
for (int i = MAX_BURIED_SPHERES - 1; i > index; i--) {
buriedSpheresEnv->buriedSpheresByCoordinates[i] = buriedSpheresEnv->buriedSpheresByCoordinates[i - 1];
}
buriedSpheresEnv->buriedSpheresByCoordinates[index] = sphere;
}
static void UndergroundSpheres_RecalculateCoordinatesOrdering(BuriedSphere *unused)
{
MI_CpuClear8(buriedSpheresEnv->buriedSpheresByCoordinates, sizeof(u32) * MAX_BURIED_SPHERES);
for (int i = 0; i < MAX_BURIED_SPHERES; i++) {
if (buriedSpheresEnv->buriedSpheres[i].type != SPHERE_NONE) {
UndergroundSpheres_AddBuriedSphereToCoordinatesOrdering(&buriedSpheresEnv->buriedSpheres[i]);
}
}
}
static BuriedSphere *UndergroundSpheres_FindEmptyBuriedSphereSlot(BuriedSphere *param0)
{
for (int i = 0; i < MAX_BURIED_SPHERES; i++) {
if (param0->type == SPHERE_NONE) {
return param0;
}
param0++;
}
return NULL;
}
static BuriedSphere *UndergroundSpheres_Dummy(BuriedSphere *sphere)
{
return sphere;
}
static BuriedSphere *UndergroundSpheres_GetBuriedSphereAtCoordinates(int x, int z)
{
Coordinates coordinates = {
.x = x,
.z = z
};
UndergroundMan_InitCoordsOrderingState(MAX_BURIED_SPHERES, UndergroundSpheres_GetCoordinatesOfBuriedSphereAtOrderedIndex);
int index = UndergroundMan_CalcCoordsIndexGet(&coordinates);
if (index == -1) {
return NULL;
}
return buriedSpheresEnv->buriedSpheresByCoordinates[index];
}
void UndergroundSpheres_RetrieveBuriedSphere(int unused, int unused2, void *src, void *unused3)
{
u8 *buffer = src;
int netID = CommSys_CurNetId();
int numberToPrint;
if (buffer[0] == netID) {
int x = CommPlayer_GetXInFrontOfPlayer(netID);
int z = CommPlayer_GetZInFrontOfPlayer(netID);
BuriedSphere *sphere = UndergroundSpheres_GetBuriedSphereAtCoordinates(x, z);
if (sphere) {
CommPlayerMan_PauseFieldSystem();
if (UndergroundInventory_TryAddSphere(sphere->type, sphere->initialSize + sphere->growth)) {
buriedSpheresEnv->retrievedSpheres[netID] = sphere->type;
Sound_PlayEffect(SEQ_SE_DP_PIRORIRO2);
numberToPrint = MAX_SPHERE_SIZE;
if (sphere->initialSize + sphere->growth < MAX_SPHERE_SIZE) {
numberToPrint = sphere->initialSize + sphere->growth;
}
UndergroundTextPrinter_SetTwoDigitNumberWithIndex(UndergroundMan_GetCommonTextPrinter(), 1, numberToPrint);
UndergroundTextPrinter_SetUndergroundItemNameWithArticleWithIndex(UndergroundMan_GetCommonTextPrinter(), 2, sphere->type);
numberToPrint = sphere->growth;
if ((numberToPrint + sphere->initialSize) > MAX_SPHERE_SIZE) {
numberToPrint = MAX_SPHERE_SIZE - sphere->initialSize;
}
UndergroundTextPrinter_PrintTextWithCallbackParam(UndergroundMan_GetCommonTextPrinter(), UndergroundCommon_Text_YouObtainedSphere, TRUE, UndergroundSpheres_PrintSphereGrowth, numberToPrint);
UndergroundTextPrinter_SetDummyField(UndergroundMan_GetCommonTextPrinter());
UndergroundSpheres_RemoveBuriedSphere(sphere);
UndergroundSpheres_SaveBuriedSpheres();
} else {
UndergroundTextPrinter_PrintText(UndergroundMan_GetCommonTextPrinter(), UndergroundCommon_Text_NoRoomForSphere, TRUE, UndergroundSpheres_ResumeFieldSystem);
}
}
}
}
void TouchRadarSearch_Init(TouchRadarSearchContext *ctx, int radius)
{
ctx->radius = radius;
ctx->iterator = 0;
}
BOOL TouchRadarSearch_GetNextCoords(TouchRadarSearchContext *ctx, TouchRadarCoordinates *out)
{
int i;
int iterator = ctx->iterator;
int x, z;
for (i = 0; i <= ctx->radius; i++) {
if (iterator - i * 4 > 0) {
iterator -= i * 4;
} else {
if (iterator != 0) {
iterator--;
}
if (iterator < i * 2) {
z = i - iterator;
} else {
z = iterator - i * 3;
}
if (iterator < i) {
x = iterator;
} else if (iterator < i * 3) {
x = i * 3 - (iterator + i);
} else {
x = -i + (iterator - i * 3);
}
out->x = x;
out->z = z;
ctx->iterator++;
return TRUE;
}
}
return FALSE;
}
void UndergroundSpheres_TryBurySphere(int sphereType, int sphereSize, int x, int z)
{
BOOL success = FALSE;
BuriedSphere sphere;
sphere.x = x;
sphere.z = z;
sphere.initialSize = sphereSize;
sphere.type = sphereType;
sphere.growth = 0;
if (UndergroundMan_AreCoordinatesInSecretBase(x, z)) {
UndergroundTextPrinter_PrintText(UndergroundMan_GetCommonTextPrinter(), UndergroundCommon_Text_CantBuryInSecretBase, FALSE, NULL);
return;
}
if (CommPlayer_CheckNPCCollision(x, z)) {
UndergroundTextPrinter_PrintText(UndergroundMan_GetCommonTextPrinter(), UndergroundCommon_Text_CantBePlacedThere, FALSE, NULL);
return;
}
if (TerrainCollisionManager_CheckCollision(buriedSpheresEnv->fieldSystem, x, z)) {
UndergroundTextPrinter_PrintText(UndergroundMan_GetCommonTextPrinter(), UndergroundCommon_Text_CantBuryInWall, FALSE, NULL);
return;
}
BuriedSphere *existingSphere = UndergroundSpheres_GetBuriedSphereAtCoordinates(x, z);
if (existingSphere) {
if (existingSphere->type == sphere.type) {
if (existingSphere->initialSize > sphereSize) {
existingSphere->initialSize = existingSphere->initialSize + (sphereSize / 5) + 1;
} else {
existingSphere->initialSize = sphereSize + (existingSphere->initialSize / 5) + 1;
}
if (existingSphere->initialSize > MAX_SPHERE_SIZE) {
existingSphere->initialSize = MAX_SPHERE_SIZE;
}
success = TRUE;
} else {
UndergroundTextPrinter_PrintText(UndergroundMan_GetCommonTextPrinter(), UndergroundCommon_Text_SomethingAlreadyBuried, FALSE, NULL);
}
} else {
UndergroundSpheres_AddBuriedSphere(&sphere);
success = TRUE;
}
if (success) {
UndergroundTextPrinter_SetUndergroundItemName(UndergroundMan_GetCommonTextPrinter(), 0, sphereType);
UndergroundTextPrinter_SetTwoDigitNumberWithIndex(UndergroundMan_GetCommonTextPrinter(), 1, sphereSize);
UndergroundTextPrinter_PrintText(UndergroundMan_GetCommonTextPrinter(), UndergroundCommon_Text_SphereWasBuried, FALSE, NULL);
UndergroundMenu_RemoveSelectedSphere(sphereType);
Sound_PlayEffect(SEQ_SE_DP_SUTYA);
SystemFlag_SetSphereAcquired(SaveData_GetVarsFlags(buriedSpheresEnv->fieldSystem->saveData));
GameRecords_IncrementRecordValue(SaveData_GetGameRecords(buriedSpheresEnv->fieldSystem->saveData), RECORD_SPHERES_BURIED);
ov5_DisplayBuriedSphereSparkle(buriedSpheresEnv->fieldSystem, x, z);
}
}
static void UndergroundSpheres_RemoveBuriedSphere(BuriedSphere *sphere)
{
int idx = -1, i;
for (i = 0; i < MAX_BURIED_SPHERES; i++) {
if (sphere == &buriedSpheresEnv->buriedSpheres[i]) {
idx = i;
break;
}
}
GF_ASSERT(idx != -1);
for (; i < MAX_BURIED_SPHERES - 1; i++) {
MI_CpuCopy8(&buriedSpheresEnv->buriedSpheres[i + 1], &buriedSpheresEnv->buriedSpheres[i], sizeof(BuriedSphere));
}
buriedSpheresEnv->buriedSpheres[MAX_BURIED_SPHERES - 1].type = SPHERE_NONE;
UndergroundSpheres_RecalculateCoordinatesOrdering(sphere);
}
static void UndergroundSpheres_AddBuriedSphere(BuriedSphere *sphere)
{
BuriedSphere *emptySlot = UndergroundSpheres_FindEmptyBuriedSphereSlot(buriedSpheresEnv->buriedSpheres);
if (emptySlot == NULL) {
emptySlot = UndergroundSpheres_Dummy(buriedSpheresEnv->buriedSpheres);
// bug: emptySlot will still be null and this function will fail a gf_assert
UndergroundSpheres_RemoveBuriedSphere(emptySlot);
emptySlot = UndergroundSpheres_FindEmptyBuriedSphereSlot(buriedSpheresEnv->buriedSpheres);
GF_ASSERT(emptySlot);
}
MI_CpuCopy8(sphere, emptySlot, sizeof(BuriedSphere));
UndergroundSpheres_AddBuriedSphereToCoordinatesOrdering(emptySlot);
UndergroundSpheres_SaveBuriedSpheres();
}
BOOL UndergroundSpheres_IsMiningItemSphere(int miningItemID)
{
if (miningItemID != 0 && miningItemID < MINING_SPHERES_MAX) {
return TRUE;
}
return FALSE;
}
BOOL UndergroundSpheres_IsBuriedSphereAtCoordinates(int x, int z)
{
if (UndergroundSpheres_GetBuriedSphereAtCoordinates(x, z)) {
return TRUE;
}
return FALSE;
}
int UndergroundSpheres_GetBuriedSphereXCoordAtIndex(int idx)
{
if (buriedSpheresEnv && (buriedSpheresEnv->buriedSpheres[idx].type != SPHERE_NONE)) {
return buriedSpheresEnv->buriedSpheres[idx].x;
}
return 0;
}
int UndergroundSpheres_GetBuriedSphereZCoordAtIndex(int idx)
{
if (buriedSpheresEnv && (buriedSpheresEnv->buriedSpheres[idx].type != SPHERE_NONE)) {
return buriedSpheresEnv->buriedSpheres[idx].z;
}
return 0;
}
BOOL UndergroundSpheres_GetQueuedMessage(String *dest)
{
int netID;
StringTemplate *template = NULL;
String *fmtString = NULL;
BOOL isMessageQueued = FALSE;
if (!buriedSpheresEnv) {
return FALSE;
}
for (netID = 0; netID < MAX_CONNECTED_PLAYERS; netID++) {
if (buriedSpheresEnv->retrievedSpheres[netID] != SPHERE_NONE) {
template = StringTemplate_Default(HEAP_ID_FIELD1);
fmtString = String_Init(100, HEAP_ID_FIELD1);
StringTemplate_SetUndergroundItemNameWithArticle(template, 2, buriedSpheresEnv->retrievedSpheres[netID]);
StringTemplate_CapitalizeArgAtIndex(template, 2);
MessageLoader_GetString(UndergroundTextPrinter_GetMessageLoader(UndergroundMan_GetCommonTextPrinter()), UndergroundCommon_Text_ItemWasObtainedExclamationPoint, fmtString);
StringTemplate_Format(template, dest, fmtString);
buriedSpheresEnv->retrievedSpheres[netID] = SPHERE_NONE;
isMessageQueued = TRUE;
break;
}
}
if (fmtString) {
String_Free(fmtString);
}
if (template) {
StringTemplate_Free(template);
}
return isMessageQueued;
}
int UndergroundSpheres_SpawnMiningSpotsNearBuriedSpheres(MATHRandContext16 *rand)
{
Underground *underground = SaveData_GetUnderground(FieldSystem_GetSaveData(buriedSpheresEnv->fieldSystem));
int i;
for (i = 0; i < MAX_BURIED_SPHERES; i++) {
if (Underground_GetBuriedSphereTypeAtIndex(underground, i) != SPHERE_NONE) {
int x = Underground_GetBuriedSphereXCoordAtIndex(underground, i);
int z = Underground_GetBuriedSphereZCoordAtIndex(underground, i);
Mining_SpawnMiningSpotNearBuriedSphere(x, z, rand);
}
}
return i;
}
static void SphereRadar_TimerSysTask(SysTask *sysTask, void *timer)
{
SphereRadarTimer *radarTimer = timer;
radarTimer->timer++;
if (radarTimer->timer > MAX_BURIED_SPHERES) {
Sound_PlayEffect(SEQ_SE_PL_UG_006);
radarTimer->timer = 0;
}
}
void SphereRadar_Start(void)
{
GF_ASSERT(!buriedSpheresEnv->sphereRadarTimer);
GF_ASSERT(!buriedSpheresEnv->sysTask);
SphereRadarTimer *radarTimer = Heap_AllocAtEnd(HEAP_ID_FIELD2, sizeof(SphereRadarTimer));
MI_CpuFill8(radarTimer, 0, sizeof(SphereRadarTimer));
radarTimer->timer = MAX_BURIED_SPHERES;
buriedSpheresEnv->sphereRadarTimer = radarTimer;
buriedSpheresEnv->sysTask = SysTask_Start(SphereRadar_TimerSysTask, radarTimer, 100);
}
void SphereRadar_Exit(void)
{
if (buriedSpheresEnv->sysTask) {
SysTask_Done(buriedSpheresEnv->sysTask);
Heap_Free(buriedSpheresEnv->sphereRadarTimer);
buriedSpheresEnv->sysTask = NULL;
buriedSpheresEnv->sphereRadarTimer = NULL;
}
}
int SphereRadar_GetXCoordOfBuriedSphere(int radarIndex)
{
if (buriedSpheresEnv && buriedSpheresEnv->sphereRadarTimer) {
// bug: only the first 66 buried spheres can show up on the radar
int index = buriedSpheresEnv->sphereRadarTimer->timer / 2;
index = (index + radarIndex) % MAX_BURIED_SPHERES;
return UndergroundSpheres_GetBuriedSphereXCoordAtIndex(index);
}
return 0;
}
int SphereRadar_GetZCoordOfBuriedSphere(int radarIndex)
{
if (buriedSpheresEnv && buriedSpheresEnv->sphereRadarTimer) {
// bug: only the first 66 buried spheres can show up on the radar
int index = buriedSpheresEnv->sphereRadarTimer->timer / 2;
index = (index + radarIndex) % MAX_BURIED_SPHERES;
return UndergroundSpheres_GetBuriedSphereZCoordAtIndex(index);
}
return 0;
}

View File

@ -90,11 +90,11 @@
#include "overlay007/shop_menu.h"
#include "overlay008/ov8_02249960.h"
#include "overlay009/ov9_02249960.h"
#include "overlay023/underground_vendors.h"
#include "overlay090/struct_ov90_021D0D80.h"
#include "overlay098/struct_ov98_02247168.h"
#include "overlay104/struct_ov104_02230BE4.h"
#include "savedata/save_table.h"
#include "underground/vendors.h"
#include "bag.h"
#include "bg_window.h"

View File

@ -1,4 +1,4 @@
#include "overlay023/base_decoration.h"
#include "underground/base_decoration.h"
#include <nitro.h>
#include <string.h>
@ -15,8 +15,8 @@
#include "overlay005/ov5_021EAFA4.h"
#include "overlay005/struct_ov5_021D1BEC_decl.h"
#include "overlay006/struct_ov6_0223E6EC.h"
#include "overlay023/decoration_menu.h"
#include "overlay023/secret_bases.h"
#include "underground/decoration_menu.h"
#include "underground/secret_bases.h"
#include "easy3d.h"
#include "field_task.h"
@ -48,7 +48,7 @@ typedef struct PositionRect {
typedef struct DecorationGood {
PositionRect position;
int propIndex;
int goodID;
enum Good goodID;
int width;
int depth;
} DecorationGood;
@ -75,7 +75,7 @@ typedef struct DecorateCursor {
typedef struct DecorationTouchInput {
int x;
int z;
int y;
BOOL active;
} DecorationTouchInput;
@ -85,7 +85,7 @@ typedef struct BaseDecorationContext {
int printerID;
MovedGood movedGood;
DecorationGood heldGood;
BaseGoodSlot goodSlots[MAX_PLACED_GOODS + MAX_BASE_BOULDERS + 1];
BaseGoodSlot goodSlots[MAX_SECRET_BASE_GOODS];
PropBlinkContext propBlinkCtx;
DecorationTouchInput touchInput;
DecorateCursor *cursor;
@ -155,7 +155,6 @@ enum MoveGoodSubState {
};
static BOOL BaseDecoration_MenuTask(FieldTask *task);
static BOOL BaseDecoration_DecorationTask(FieldTask *task);
static BOOL BaseDecoration_DecorateTask(FieldTask *task);
static BOOL BaseDecoration_PutAwayTask(FieldTask *task);
static BOOL BaseDecoration_SelectGoodToMoveTask(FieldTask *task);
@ -169,10 +168,10 @@ static BOOL BaseDecoration_AreGoodsOverlapping(const PositionRect *good1Position
static BOOL BaseDecoration_AreCoordinatesInsideGood(const PositionRect *goodPosition, int x, int z);
static BOOL BaseDecoration_IsPositionOutOfBounds(const PositionRect *position);
static void BaseDecoration_LoadBaseGoods(FieldSystem *fieldSystem, BaseDecorationContext *ctx, BaseGoodSlot goodSlots[]);
static void BaseDecoration_AddGoodAtIndex(int index, int goodID, int x, int z, BaseGoodSlot goodSlots[]);
static void BaseDecoration_AddGoodAtIndex(int index, enum Good goodID, int x, int z, BaseGoodSlot goodSlots[]);
static void BaseDecoration_LoadGoodMapProp(FieldSystem *fieldSystem, BaseGoodSlot goodSlots[]);
static void BaseDecoration_SaveBaseGoods(FieldSystem *fieldSystem, const BaseGoodSlot goodSlots[]);
static int BaseDecoration_GetGoodMapPropModelID(FieldSystem *fieldSystem, int goodID);
static int BaseDecoration_GetGoodMapPropModelID(FieldSystem *fieldSystem, enum Good goodID);
static void BaseDecoration_SetMovedGood(int index, BaseDecorationContext *ctx);
static void BaseDecoration_UpdateMovedGoodProp(BaseDecorationContext *ctx);
static void BaseDecoration_UpdateState(int newState, BaseDecorationContext *ctx);
@ -202,7 +201,7 @@ static const UnkStruct_ov6_0223E6EC Unk_ov23_02256B88 = {
ov23_022562C8
};
static void BaseDecoration_CreateHeldGood(FieldSystem *fieldSystem, int goodID, BaseDecorationContext *ctx)
static void BaseDecoration_CreateHeldGood(FieldSystem *fieldSystem, enum Good goodID, BaseDecorationContext *ctx)
{
GF_ASSERT(goodID != UG_GOOD_NONE);
@ -237,7 +236,7 @@ static void BaseDecoration_SetHeldGood(int index, BaseDecorationContext *ctx)
ctx->heldGood = *good;
}
static BOOL BaseDecoration_DecorationTask(FieldTask *task)
static BOOL BaseDecoration_DecorationMenuTask(FieldTask *task)
{
FieldSystem *fieldSystem = FieldTask_GetFieldSystem(task);
BaseDecorationContext *ctx = FieldTask_GetEnv(task);
@ -362,7 +361,7 @@ static BOOL BaseDecoration_MenuTask(FieldTask *task)
return FALSE;
}
void BaseDecoration_StartDecorationTask(FieldSystem *fieldSystem, FieldTask *task)
void BaseDecoration_StartDecorationMenuTask(FieldSystem *fieldSystem, FieldTask *task)
{
BaseDecorationContext *ctx = Heap_AllocAtEnd(HEAP_ID_FIELD2, sizeof(BaseDecorationContext));
@ -373,7 +372,7 @@ void BaseDecoration_StartDecorationTask(FieldSystem *fieldSystem, FieldTask *tas
ctx->unk_50C = ov5_021D1B6C(fieldSystem->unk_04->unk_04, &Unk_ov23_02256B88);
ctx->cursor = ov5_021D1C2C(ctx->unk_50C);
FieldTask_InitCall(task, BaseDecoration_DecorationTask, ctx);
FieldTask_InitCall(task, BaseDecoration_DecorationMenuTask, ctx);
}
static BOOL BaseDecoration_DecorateTask(FieldTask *task)
@ -395,7 +394,7 @@ static BOOL BaseDecoration_DecorateTask(FieldTask *task)
return TRUE;
}
int goodID = Underground_GetGoodAtSlotPC(underground, input);
enum Good goodID = Underground_GetGoodAtSlotPC(underground, input);
if (goodID != UG_GOOD_NONE) {
if (!Underground_IsGoodAtSlotPlacedInBase(underground, input)) {
@ -999,7 +998,7 @@ static BOOL BaseDecoration_MoveSelectedGoodTask(FieldTask *task)
static BOOL BaseDecoration_CanPlaceGood(const DecorationGood *good, const BaseGoodSlot goodSlots[])
{
for (int i = 0; i < MAX_PLACED_GOODS + MAX_BASE_BOULDERS + 1; i++) {
for (int i = 0; i < MAX_SECRET_BASE_GOODS; i++) {
if (goodSlots[i].active == TRUE) {
if (BaseDecoration_AreGoodsOverlapping(&goodSlots[i].good.position, &good->position)) {
return FALSE;
@ -1024,7 +1023,7 @@ static BOOL BaseDecoration_CanPlaceGood(const DecorationGood *good, const BaseGo
static BOOL BaseDecoration_FindGoodOccupyingCoordinates(int x, int z, const BaseGoodSlot goodSlots[], int *outIndex)
{
for (int i = 0; i < MAX_PLACED_GOODS + MAX_BASE_BOULDERS + 1; i++) {
for (int i = 0; i < MAX_SECRET_BASE_GOODS; i++) {
if (goodSlots[i].active == TRUE) {
if (BaseDecoration_AreCoordinatesInsideGood(&goodSlots[i].good.position, x, z)) {
*outIndex = i;
@ -1033,7 +1032,7 @@ static BOOL BaseDecoration_FindGoodOccupyingCoordinates(int x, int z, const Base
}
}
*outIndex = MAX_PLACED_GOODS + MAX_BASE_BOULDERS + 1;
*outIndex = MAX_SECRET_BASE_GOODS;
return FALSE;
}
@ -1049,7 +1048,7 @@ static BOOL BaseDecoration_IsPositionOutOfBounds(const PositionRect *position)
static int BaseDecoration_PlaceGood(const DecorationGood *good, BaseGoodSlot goodSlots[])
{
for (int i = 0; i < MAX_PLACED_GOODS + MAX_BASE_BOULDERS + 1; i++) {
for (int i = 0; i < MAX_SECRET_BASE_GOODS; i++) {
if (!goodSlots[i].active) {
goodSlots[i].active = TRUE;
goodSlots[i].good = *good;
@ -1064,7 +1063,7 @@ static int BaseDecoration_PlaceGood(const DecorationGood *good, BaseGoodSlot goo
static void BaseDecoration_SetGoodAtIndex(const DecorationGood *good, int index, BaseGoodSlot goodSlots[])
{
GF_ASSERT(index < MAX_PLACED_GOODS + MAX_BASE_BOULDERS + 1);
GF_ASSERT(index < MAX_SECRET_BASE_GOODS);
GF_ASSERT(!goodSlots[index].active);
goodSlots[index].active = TRUE;
@ -1073,7 +1072,7 @@ static void BaseDecoration_SetGoodAtIndex(const DecorationGood *good, int index,
static void BaseDecoration_RemoveGood(int index, BaseGoodSlot goodSlots[])
{
GF_ASSERT(index < MAX_PLACED_GOODS + MAX_BASE_BOULDERS + 1);
GF_ASSERT(index < MAX_SECRET_BASE_GOODS);
GF_ASSERT(index != 0);
GF_ASSERT(goodSlots[index].active);
@ -1105,8 +1104,8 @@ static void BaseDecoration_LoadBaseGoods(FieldSystem *fieldSystem, BaseDecoratio
ctx->unremovableBoulderCount = SecretBase_GetUnremovableBoulderCount(secretBase);
ctx->maxPlacedGoods = SecretBase_GetPlacedGoodsLimit(secretBase);
for (int i = 0; i < MAX_PLACED_GOODS + MAX_BASE_BOULDERS + 1; i++) {
int goodID = SecretBase_GetGoodIDAtIndex(secretBase, i);
for (int i = 0; i < MAX_SECRET_BASE_GOODS; i++) {
enum Good goodID = SecretBase_GetGoodIDAtIndex(secretBase, i);
if (goodID != UG_GOOD_NONE) {
if (goodID == UG_GOOD_BIG_BOULDER) {
@ -1123,7 +1122,7 @@ static void BaseDecoration_LoadBaseGoods(FieldSystem *fieldSystem, BaseDecoratio
}
}
static void BaseDecoration_AddGoodAtIndex(int index, int goodID, int x, int z, BaseGoodSlot goodSlots[])
static void BaseDecoration_AddGoodAtIndex(int index, enum Good goodID, int x, int z, BaseGoodSlot goodSlots[])
{
DecorationGood good;
@ -1146,7 +1145,7 @@ static void BaseDecoration_LoadGoodMapProp(FieldSystem *fieldSystem, BaseGoodSlo
{
MapPropManager_Init(fieldSystem->mapPropManager);
for (int i = 0; i < MAX_PLACED_GOODS + MAX_BASE_BOULDERS + 1; i++) {
for (int i = 0; i < MAX_SECRET_BASE_GOODS; i++) {
if (!goodSlots[i].active) {
continue;
}
@ -1168,11 +1167,11 @@ static void BaseDecoration_LoadGoodMapProp(FieldSystem *fieldSystem, BaseGoodSlo
static void BaseDecoration_SaveBaseGoods(FieldSystem *fieldSystem, const BaseGoodSlot goodSlots[])
{
int goodID;
enum Good goodID;
int x, z;
SecretBase *secretBase = SaveData_GetSecretBase(fieldSystem->saveData);
for (int i = 0; i < MAX_PLACED_GOODS + MAX_BASE_BOULDERS + 1; i++) {
for (int i = 0; i < MAX_SECRET_BASE_GOODS; i++) {
if (goodSlots[i].active == TRUE) {
goodID = goodSlots[i].good.goodID;
x = goodSlots[i].good.position.minX;
@ -1187,7 +1186,7 @@ static void BaseDecoration_SaveBaseGoods(FieldSystem *fieldSystem, const BaseGoo
}
}
static int BaseDecoration_GetGoodMapPropModelID(FieldSystem *fieldSystem, int goodID)
static int BaseDecoration_GetGoodMapPropModelID(FieldSystem *fieldSystem, enum Good goodID)
{
GF_ASSERT(goodID != UG_GOOD_NONE);
return AreaDataManager_GetMapPropModelID(fieldSystem->areaDataManager, goodID);
@ -1266,7 +1265,7 @@ static void BaseDecoration_StoreTouchCoordinates(int touchX, int touchY, Decorat
}
if (touchY != (u16)TOUCHSCREEN_INPUT_NONE) {
touchInput->z = touchY;
touchInput->y = touchY;
}
}
@ -1278,7 +1277,7 @@ static void BaseDecoration_UpdatePropPositionFromTouchInput(FieldSystem *fieldSy
BaseDecoration_StoreTouchCoordinates(gSystem.touchX, gSystem.touchY, touchInput);
propPosition = ov5_GetPositionFromTouchCoordinates(touchInput->x, touchInput->z, v6);
propPosition = ov5_GetPositionFromTouchCoordinates(touchInput->x, touchInput->y, v6);
int x = propPosition.x / MAP_OBJECT_TILE_SIZE;
int z = propPosition.z / MAP_OBJECT_TILE_SIZE;
@ -1313,7 +1312,7 @@ static void BaseDecoration_UpdateCursorPositionFromTouchInput(FieldSystem *field
BaseDecoration_StoreTouchCoordinates(gSystem.touchX, gSystem.touchY, touchInput);
modelPosition = ov5_GetPositionFromTouchCoordinates(touchInput->x, touchInput->z, v4);
modelPosition = ov5_GetPositionFromTouchCoordinates(touchInput->x, touchInput->y, v4);
int x = modelPosition.x / MAP_OBJECT_TILE_SIZE;
int z = modelPosition.z / MAP_OBJECT_TILE_SIZE;

View File

@ -1,4 +1,4 @@
#include "overlay023/underground_comm_manager.h"
#include "underground/comm_manager.h"
#include <nitro.h>
#include <string.h>
@ -9,11 +9,11 @@
#include "field/field_system.h"
#include "functypes/funcptr_020598EC.h"
#include "overlay023/mining.h"
#include "overlay023/secret_bases.h"
#include "overlay023/underground_manager.h"
#include "overlay023/underground_player.h"
#include "overlay023/underground_traps.h"
#include "underground/manager.h"
#include "underground/mining.h"
#include "underground/player.h"
#include "underground/secret_bases.h"
#include "underground/traps.h"
#include "comm_player_manager.h"
#include "communication_information.h"
@ -253,7 +253,7 @@ static void CommManUnderground_SendInitialDataTask(void)
CommInfo_SendPlayerInfo();
CommPlayer_SendPos(FALSE);
UndergroundTraps_SendPlacedTraps();
Traps_SendPlacedTraps();
SecretBases_SendBaseInfo();
if (!SystemFlag_CheckHasSeenUndergroundRoarkIntro(SaveData_GetVarsFlags(fieldCommMan->fieldSystem->saveData))) {
@ -328,8 +328,8 @@ static void CommManUnderground_ConnectTaskClient(void)
UndergroundMan_ForceEndCurrentSysTask();
CommPlayer_CopyPersonal(0);
UndergroundTraps_EndCurrentTrapEffectServer(0, 0, NULL, NULL);
UndergroundTraps_ForceEndCurrentTrapEffectClient(0, TRUE);
Traps_EndCurrentTrapEffectServer(0, 0, NULL, NULL);
Traps_ForceEndCurrentTrapEffectClient(0, TRUE);
CommInfo_InitPlayer(0);
CommPlayer_Destroy(0, FALSE, FALSE);
@ -386,7 +386,7 @@ static void CommManUnderground_MainTaskServer(void)
CommSys_SendMessage(43);
UndergroundTraps_ForceEndCurrentTrapEffectClient(CommSys_CurNetId(), TRUE);
Traps_ForceEndCurrentTrapEffectClient(CommSys_CurNetId(), TRUE);
UndergroundMan_ForceEndCurrentSysTask();
sub_02036824();
@ -447,7 +447,7 @@ static void CommManUnderground_WaitForFlagDataReceiptTaskClient(void)
FieldCommunicationManager *fieldCommMan = FieldCommMan_Get();
if (UndergroundPlayer_HaveLinksReceivedHeldFlagData()) {
UndergroundTraps_SendPlacedTraps();
Traps_SendPlacedTraps();
CommManUnderground_SetFieldCommManTask(CommManUnderground_WaitForTrapDataReceiptTaskClient, 0);
} else {
CommManUnderground_MainTaskClient();
@ -462,9 +462,9 @@ static void CommManUnderground_WaitForFlagDataReceiptTaskClient(void)
static void CommManUnderground_WaitForTrapDataReceiptTaskClient(void)
{
if (UndergroundTraps_HaveLinksReceivedPlacedTraps()) {
if (Traps_HaveLinksReceivedPlacedTraps()) {
CommManUnderground_DebugPrintDummy("\u0090\u0065\u008B\u0040\u00E3\u00A9\u0083\u0066\u0081\u005B\u0083\u005E\u0093\u00CD\u0082\u00A2\u0082\u00BD\u0082\u00E7\u0082\u00B5\u0082\u00A2"); // 親機罠データ届いたらしい
UndergroundTraps_ClearLinksReceivedPlacedTraps();
Traps_ClearLinksReceivedPlacedTraps();
SecretBases_SendBaseInfo();
CommManUnderground_SetFieldCommManTask(CommManUnderground_WaitForBaseDataReceiptTaskClient, 0);
return;
@ -538,7 +538,7 @@ static void CommManUnderground_CloseSecretBaseTask(void)
UndergroundMan_ResetResources(fieldCommMan->fieldSystem);
CommInfo_SendPlayerInfo();
CommPlayer_SendPos(FALSE);
UndergroundTraps_SendPlacedTraps();
Traps_SendPlacedTraps();
SecretBases_SendBaseInfo();
CommManUnderground_SetFieldCommManTask(CommManUnderground_ClosedBaseTask, 0);
}
@ -546,13 +546,13 @@ static void CommManUnderground_CloseSecretBaseTask(void)
static void CommManUnderground_RestartClient(void)
{
UndergroundTraps_ForceEndCurrentTrapEffectClient(CommSys_CurNetId(), TRUE);
Traps_ForceEndCurrentTrapEffectClient(CommSys_CurNetId(), TRUE);
SecretBases_RemovePlayerFromBase(CommSys_CurNetId(), TRUE);
Mining_ClearMessageQueue();
CommPlayerMan_Stop();
UndergroundMan_ForceEndCurrentSysTask();
sub_020367F0();
ov23_0224AC4C();
UndergroundPlayer_ResetHeldFlagInfo();
CommManUnderground_SetFieldCommManTask(CommManUnderground_RestartTaskClient, 0);
}
@ -595,7 +595,7 @@ static void CommManUnderground_BaseTransitionEndTaskClient(void)
CommPlayerMan_Stop();
UndergroundMan_ForceEndCurrentSysTask();
sub_020367F0();
ov23_0224AC4C();
UndergroundPlayer_ResetHeldFlagInfo();
CommManUnderground_SetFieldCommManTask(CommManUnderground_RestartTaskClient, 0);
} else {
CommManUnderground_SetFieldCommManTask(CommManUnderground_MainTaskClient, 0);

View File

@ -1,4 +1,4 @@
#include "overlay023/decoration_menu.h"
#include "underground/decoration_menu.h"
#include <nitro.h>
#include <string.h>
@ -8,9 +8,9 @@
#include "struct_defs/underground.h"
#include "field/field_system.h"
#include "overlay023/underground_item_list_menu.h"
#include "overlay023/underground_manager.h"
#include "overlay023/underground_text_printer.h"
#include "underground/item_list_menu.h"
#include "underground/manager.h"
#include "underground/text_printer.h"
#include "bg_window.h"
#include "heap.h"
@ -381,7 +381,7 @@ static void DecorationGoodsMenu_InitMenu(DecorationGoodsMenu *menu)
int i;
int option;
for (i = 0; i < goodsCount; i++) {
int goodID = Underground_GetGoodAtSlotPC(underground, i);
enum Good goodID = Underground_GetGoodAtSlotPC(underground, i);
BOOL isPlaced = Underground_IsGoodAtSlotPlacedInBase(underground, i);
option = (i << 1) + (u8)(!isPlaced ? 1 : 0);

View File

@ -1,4 +1,4 @@
#include "overlay023/underground_item_list_menu.h"
#include "underground/item_list_menu.h"
#include <nitro.h>
#include <string.h>

View File

@ -1,4 +1,4 @@
#include "overlay023/underground_manager.h"
#include "underground/manager.h"
#include <nitro.h>
#include <string.h>
@ -14,16 +14,16 @@
#include "field/field_system.h"
#include "overlay005/land_data.h"
#include "overlay005/ov5_021EAFA4.h"
#include "overlay023/mining.h"
#include "overlay023/secret_bases.h"
#include "overlay023/underground_menu.h"
#include "overlay023/underground_pc.h"
#include "overlay023/underground_player.h"
#include "overlay023/underground_records.h"
#include "overlay023/underground_spheres.h"
#include "overlay023/underground_text_printer.h"
#include "overlay023/underground_traps.h"
#include "overlay023/underground_vendors.h"
#include "underground/menus.h"
#include "underground/mining.h"
#include "underground/pc.h"
#include "underground/player.h"
#include "underground/records.h"
#include "underground/secret_bases.h"
#include "underground/spheres.h"
#include "underground/text_printer.h"
#include "underground/traps.h"
#include "underground/vendors.h"
#include "comm_player_manager.h"
#include "communication_information.h"
@ -52,10 +52,6 @@
#include "res/graphics/trap_effects/trap_effects.naix.h"
#include "res/text/bank/underground_common.h"
#define TOUCH_RADAR_RADIUS 6
#define MAX_TOUCH_RADAR_BLIPS 8
#define MAX_STORED_MENU_POSITIONS 20
#define COORDS_TO_EVENT_POS(x, z) (x & 0xF) * 16 + (z & 0xF)
@ -77,16 +73,16 @@ typedef struct UndergroundManager {
u8 padding[4];
SysTask *sysTask;
Coordinates2D touchCoordinates;
Coordinates touchedTileCoordinates;
Coordinates touchedTileCoords;
StoredListMenuPos storedPositions[MAX_STORED_MENU_POSITIONS];
u16 storedPositionKey;
u8 linksTalkedTo[MAX_CONNECTED_PLAYERS];
u8 unk_CA[MAX_CONNECTED_PLAYERS];
u8 initialized[MAX_CONNECTED_PLAYERS];
u8 talkedToVendorMessagesQueued[MAX_CONNECTED_PLAYERS];
String *leftUndergroundMessages[MAX_CONNECTED_PLAYERS];
u8 touchRadarTrapResults[MAX_TOUCH_RADAR_BLIPS];
u8 touchRadarMiningSpotResults[MAX_TOUCH_RADAR_BLIPS];
u8 touchRadarBuriedSphereResults[MAX_TOUCH_RADAR_BLIPS];
u8 touchRadarTrapResults[MAX_TOUCH_RADAR_RESULTS_OF_TYPE];
u8 touchRadarMiningSpotResults[MAX_TOUCH_RADAR_RESULTS_OF_TYPE];
u8 touchRadarBuriedSphereResults[MAX_TOUCH_RADAR_RESULTS_OF_TYPE];
CoordinatesGetter coordinatesGetter;
UndergroundTextPrinter *commonTextPrinter;
UndergroundTextPrinter *captureFlagTextPrinter;
@ -128,9 +124,9 @@ enum Radar {
RADAR_TRAP,
};
static void UndergroundMan_DisconnectCallback(int param0);
static void UndergroundMan_ClearPrinterIDsTask(SysTask *param0, void *param1);
static int ov23_022433D0(void);
static void UndergroundMan_DisconnectCallback(int netID);
static void UndergroundMan_ClearPrinterIDsTask(SysTask *unused0, void *unused1);
static int UndergroundMan_CountInitializedPlayers(void);
static UndergroundManager *sUndergroundMan = NULL;
@ -143,8 +139,8 @@ static void UndergroundMan_Init(UndergroundManager *dest, FieldSystem *fieldSyst
sUndergroundMan->fieldSystem = fieldSystem;
sUndergroundMan->touchCooldown = 0;
sUndergroundMan->touchedTileCoordinates.x = 0;
sUndergroundMan->touchedTileCoordinates.z = 0;
sUndergroundMan->touchedTileCoords.x = 0;
sUndergroundMan->touchedTileCoords.z = 0;
sUndergroundMan->resourcesPaused = 0;
sUndergroundMan->activeRadar = RADAR_NORMAL;
sUndergroundMan->commonTextPrinter = UndergroundTextPrinter_New(TEXT_BANK_UNDERGROUND_COMMON, HEAP_ID_UNDERGROUND, fieldSystem->bgConfig, renderDelay, 500);
@ -159,7 +155,7 @@ static void UndergroundMan_Init(UndergroundManager *dest, FieldSystem *fieldSyst
for (int netID = 0; netID < MAX_CONNECTED_PLAYERS; netID++) {
sUndergroundMan->linksTalkedTo[netID] = NETID_NONE;
sUndergroundMan->talkedToVendorMessagesQueued[netID] = 0xFF;
sUndergroundMan->talkedToVendorMessagesQueued[netID] = -1;
sUndergroundMan->leftUndergroundMessages[netID] = NULL;
}
@ -288,9 +284,9 @@ static BOOL UndergroundMan_GetQueuedPlayerMessage(String *dest)
}
}
if (sUndergroundMan->talkedToVendorMessagesQueued[netID] != 0xFF) {
if (sUndergroundMan->talkedToVendorMessagesQueued[netID] != (u8)-1) {
TrainerInfo *trainerInfo = CommInfo_TrainerInfo(netID);
sUndergroundMan->talkedToVendorMessagesQueued[netID] = 0xFF;
sUndergroundMan->talkedToVendorMessagesQueued[netID] = -1;
if (UndergroundMan_FormatCommonStringWithTrainerName(trainerInfo, 0, UndergroundCommon_Text_PlayerTalkedWithSomeone, dest)) {
return TRUE;
@ -325,11 +321,11 @@ BOOL UndergroundMan_AreCoordinatesOccupied(int x, int z)
return TRUE;
}
if (UndergroundTraps_IsTrapAtCoordinates(x, z)) {
if (Traps_IsTrapAtCoordinates(x, z)) {
return TRUE;
}
if (UndergroundPC_GetPCAtCoordinates(&coordinates, DIR_NONE) != PC_NONE) {
if (UndergroundPC_GetPCOwnerNetIDAtCoordinates(&coordinates, DIR_NONE) != NETID_NONE) {
return TRUE;
}
@ -363,17 +359,17 @@ BOOL UndergroundMan_CheckForTouchInput(void)
pos = ov5_GetPositionFromTouchCoordinates(gSystem.touchX, gSystem.touchY, sUndergroundMan->fieldSystem->unk_8C);
int x, z;
LandData_ObjectPosToTilePos(pos.x, pos.z, &x, &z);
Coordinates coordinates = {
Coordinates touchedTileCoords = {
.x = x,
.z = z
};
sUndergroundMan->touchCoordinates.x = gSystem.touchX;
sUndergroundMan->touchCoordinates.y = gSystem.touchY;
sUndergroundMan->touchedTileCoordinates.x = x;
sUndergroundMan->touchedTileCoordinates.z = z;
sUndergroundMan->touchedTileCoords.x = x;
sUndergroundMan->touchedTileCoords.z = z;
CommSys_SendData(48, &coordinates, sizeof(Coordinates));
CommSys_SendData(48, &touchedTileCoords, sizeof(Coordinates));
return TRUE;
}
@ -383,25 +379,25 @@ BOOL UndergroundMan_CheckForTouchInput(void)
return FALSE;
}
static int UndergroundMan_TouchRadarSearch(u8 *out, TouchRadarItemCheckFunc isItemAtCoords, Coordinates *touchCoords)
static int UndergroundMan_TouchRadarSearch(u8 *out, TouchRadarItemCheckFunc isItemAtCoords, Coordinates *touchedTileCoords)
{
int index = 1;
int minX = touchCoords->x - TOUCH_RADAR_RADIUS;
int minZ = touchCoords->z - TOUCH_RADAR_RADIUS;
int minX = touchedTileCoords->x - TOUCH_RADAR_RADIUS;
int minZ = touchedTileCoords->z - TOUCH_RADAR_RADIUS;
TouchRadarSearchContext ctx;
TouchRadarSearch_Init(&ctx, TOUCH_RADAR_RADIUS);
TouchRadarCoordinates radarCoords;
while (TouchRadarSearch_GetNextCoords(&ctx, &radarCoords)) {
int x = touchCoords->x + radarCoords.x;
int z = touchCoords->z + radarCoords.z;
int x = touchedTileCoords->x + radarCoords.x;
int z = touchedTileCoords->z + radarCoords.z;
if (isItemAtCoords(x, z)) {
out[index] = (x - minX) + (z - minZ) * 16;
out[index] = x - minX + (z - minZ) * 16;
if (index == MAX_TOUCH_RADAR_BLIPS) {
if (index == MAX_TOUCH_RADAR_RESULTS_OF_TYPE) {
index++;
break;
}
@ -413,23 +409,23 @@ static int UndergroundMan_TouchRadarSearch(u8 *out, TouchRadarItemCheckFunc isIt
return index;
}
static void UndergroundMan_StartTouchRadar(int netID, Coordinates *touchCoords)
static void UndergroundMan_StartTouchRadar(int netID, Coordinates *touchedTileCoords)
{
u8 buffer[MAX_TOUCH_RADAR_BLIPS + 1];
u8 buffer[MAX_TOUCH_RADAR_RESULTS_OF_TYPE + 1];
int size = 1;
buffer[0] = netID;
size = UndergroundMan_TouchRadarSearch(buffer, UndergroundTraps_IsTrapAtCoordinates, touchCoords);
size = UndergroundMan_TouchRadarSearch(buffer, Traps_IsTrapAtCoordinates, touchedTileCoords);
CommSys_SendDataServer(49, buffer, size);
size = UndergroundMan_TouchRadarSearch(buffer, Mining_IsMiningSpotAtCoordinates, touchCoords);
size = UndergroundMan_TouchRadarSearch(buffer, Mining_IsMiningSpotAtCoordinates, touchedTileCoords);
CommSys_SendDataServer(50, buffer, size);
}
void UndergroundMan_ProcessTouchInput(int netID, int unused1, void *data, void *unused3)
{
Coordinates *coordinates = data;
Coordinates *touchedTileCoords = data;
if (!CommPlayerMan_IsMovementEnabled(netID)) {
return;
@ -440,7 +436,7 @@ void UndergroundMan_ProcessTouchInput(int netID, int unused1, void *data, void *
}
CommPlayerMan_SetMovementEnabled(netID, FALSE);
UndergroundMan_StartTouchRadar(netID, coordinates);
UndergroundMan_StartTouchRadar(netID, touchedTileCoords);
}
void UndergroundMan_ProcessTouchRadarTrapResults(int unused0, int size, void *data, void *unused3)
@ -458,7 +454,7 @@ void UndergroundMan_ProcessTouchRadarTrapResults(int unused0, int size, void *da
void UndergroundMan_ProcessTouchRadarMiningSpotResults(int unused0, int size, void *data, void *unused3)
{
u8 *buffer = data;
u8 sphereResults[MAX_TOUCH_RADAR_BLIPS + 1];
u8 sphereResults[MAX_TOUCH_RADAR_RESULTS_OF_TYPE + 1];
if (CommSys_CurNetId() != buffer[0]) {
return;
@ -467,11 +463,11 @@ void UndergroundMan_ProcessTouchRadarMiningSpotResults(int unused0, int size, vo
MI_CpuCopy8(&buffer[1], sUndergroundMan->touchRadarMiningSpotResults, size - 1);
sUndergroundMan->touchRadarMiningSpotResultCount = size - 1;
sUndergroundMan->touchRadarBuriedSphereResultCount = UndergroundMan_TouchRadarSearch(sphereResults, UndergroundSpheres_IsBuriedSphereAtCoordinates, &sUndergroundMan->touchedTileCoordinates);
sUndergroundMan->touchRadarBuriedSphereResultCount = UndergroundMan_TouchRadarSearch(sphereResults, Spheres_IsBuriedSphereAtCoordinates, &sUndergroundMan->touchedTileCoords);
sUndergroundMan->touchRadarBuriedSphereResultCount -= 1;
MI_CpuCopy8(&sphereResults[1], sUndergroundMan->touchRadarBuriedSphereResults, sUndergroundMan->touchRadarBuriedSphereResultCount);
UndergroundTraps_StartTouchRadarTask(sUndergroundMan->fieldSystem, sUndergroundMan->touchedTileCoordinates.x, sUndergroundMan->touchedTileCoordinates.z, sUndergroundMan->touchCoordinates.x, sUndergroundMan->touchCoordinates.y, sUndergroundMan->touchRadarTrapResults, sUndergroundMan->touchRadarTrapResultCount, sUndergroundMan->touchRadarMiningSpotResults, sUndergroundMan->touchRadarMiningSpotResultCount, sUndergroundMan->touchRadarBuriedSphereResults, sUndergroundMan->touchRadarBuriedSphereResultCount);
TouchRadar_StartTask(sUndergroundMan->fieldSystem, sUndergroundMan->touchedTileCoords.x, sUndergroundMan->touchedTileCoords.z, sUndergroundMan->touchCoordinates.x, sUndergroundMan->touchCoordinates.y, sUndergroundMan->touchRadarTrapResults, sUndergroundMan->touchRadarTrapResultCount, sUndergroundMan->touchRadarMiningSpotResults, sUndergroundMan->touchRadarMiningSpotResultCount, sUndergroundMan->touchRadarBuriedSphereResults, sUndergroundMan->touchRadarBuriedSphereResultCount);
}
static int UndergroundMan_GetOrderedCoordinatesValue(Coordinates *coordinates)
@ -576,7 +572,7 @@ void UndergroundMan_ProcessInteract(u8 flags)
int x = CommPlayer_GetXInFrontOfPlayer(CommSys_CurNetId());
int z = CommPlayer_GetZInFrontOfPlayer(CommSys_CurNetId());
if (UndergroundSpheres_IsBuriedSphereAtCoordinates(x, z)) {
if (Spheres_IsBuriedSphereAtCoordinates(x, z)) {
flags |= FLAG_BURIED_SPHERE_IN_FRONT;
}
@ -632,8 +628,8 @@ void UndergroundMan_ProcessInteractEvent(int netID, int unused1, void *data, voi
} else if (UndergroundPlayer_TalkHeldFlagCheck(netID, linkNetID, FALSE)) {
return;
} else if (UndergroundPlayer_IsAffectedByTrap(linkNetID)) {
if (!UndergroundTraps_HasPlayerTriggeredTool(linkNetID)) {
UndergroundTraps_HelpLink(netID, linkNetID);
if (!Traps_HasPlayerTriggeredTool(linkNetID)) {
Traps_HelpLink(netID, linkNetID);
} else {
talkEvent.result = TALK_RESULT_FAIL;
talkEvent.talkTargetNetID = linkNetID;
@ -668,7 +664,7 @@ void UndergroundMan_ProcessInteractEvent(int netID, int unused1, void *data, voi
return;
}
if (UndergroundTraps_TryDisengageTrap(netID, &coordinates, event->flags)) {
if (Traps_TryDisengageTrap(netID, &coordinates, event->flags)) {
CommPlayerMan_SetMovementEnabled(netID, FALSE);
return;
}
@ -726,7 +722,7 @@ void UndergroundMan_Process(void)
}
}
sub_02037B58(ov23_022433D0() + 2);
sub_02037B58(UndergroundMan_CountInitializedPlayers() + 2);
}
sUndergroundMan->dummyCounter++;
@ -737,12 +733,12 @@ void UndergroundMan_Process(void)
}
}
UndergroundSpheres_AdvanceBuriedSphereSparkleTimer();
UndergroundTraps_SendTrapRadarResults();
Spheres_AdvanceBuriedSphereSparkleTimer();
Traps_SendTrapRadarResults();
Mining_SendRadarResults();
if (!sUndergroundMan->resourcesPaused) {
UndergroundTraps_Dummy2(sUndergroundMan->fieldSystem->bgConfig);
Traps_Dummy2(sUndergroundMan->fieldSystem->bgConfig);
}
}
@ -763,8 +759,8 @@ void UndergroundMan_InitAllResources(FieldSystem *fieldSystem)
resource = Heap_Alloc(HEAP_ID_COMMUNICATION, SecretBasesEnv_Size());
SecretBasesEnv_Init(resource, fieldSystem);
resource = Heap_Alloc(HEAP_ID_COMMUNICATION, BuriedSpheresEnv_Size());
BuriedSpheresEnv_Init(resource, fieldSystem);
resource = Heap_Alloc(HEAP_ID_COMMUNICATION, SpheresEnv_Size());
SpheresEnv_Init(resource, fieldSystem);
resource = Heap_Alloc(HEAP_ID_COMMUNICATION, MiningEnv_Size());
MiningEnv_Init(resource, fieldSystem);
@ -780,9 +776,9 @@ void UndergroundMan_PauseResources(void)
{
if (sUndergroundMan) {
UndergroundRecords_ForceExitTrainerCase();
UndergroundSpheres_DisableBuriedSphereSparkles();
Spheres_DisableBuriedSphereSparkles();
SecretBases_DisableBaseEntranceGraphics();
UndergroundTraps_DisableTrapGraphics();
Traps_DisableTrapGraphics();
CommPlayerMan_Disable();
Mining_Dummy();
UndergroundMan_RemovePrinters();
@ -796,9 +792,9 @@ void UndergroundMan_UnpauseResources(void)
if (sUndergroundMan) {
CommPlayerMan_Restart();
UndergroundRecords_Dummy();
UndergroundSpheres_EnableBuriedSphereSparkles();
Spheres_EnableBuriedSphereSparkles();
SecretBases_EnableBaseEntranceGraphics();
UndergroundTraps_EnableTrapGraphics();
Traps_EnableTrapGraphics();
Mining_Dummy2();
sUndergroundMan->resourcesPaused = FALSE;
@ -813,7 +809,7 @@ void UndergroundMan_FreeAllResources(void)
SecretBasesEnv_Free();
TrapsEnv_Free();
CommPlayerMan_Delete(TRUE);
BuriedSpheresEnv_Free();
SpheresEnv_Free();
MiningEnv_Free();
UndergroundMenuContext_Free();
RecordsEnv_Free();
@ -824,7 +820,7 @@ void UndergroundMan_FreeAllResources(void)
void UndergroundMan_ResetResources(FieldSystem *fieldSystem)
{
if (sUndergroundMan != NULL) {
UndergroundTraps_Reinit(fieldSystem);
Traps_Reinit(fieldSystem);
CommPlayerMan_Reinit();
SecretBases_ResetAllBaseInfo();
}
@ -840,10 +836,10 @@ BOOL UndergroundMan_GetQueuedMessage(String *dest)
if (UndergroundMan_GetQueuedPlayerMessage(dest)) {
sUndergroundMan->messageRetrieved = TRUE;
return TRUE;
} else if (UndergroundTraps_GetQueuedMessage(dest)) {
} else if (Traps_GetQueuedMessage(dest)) {
sUndergroundMan->messageRetrieved = TRUE;
return TRUE;
} else if (UndergroundTraps_GetQueuedMessage2(dest)) {
} else if (Traps_GetQueuedMessage2(dest)) {
sUndergroundMan->messageRetrieved = TRUE;
return TRUE;
} else if (SecretBases_GetQueuedMessage(dest)) {
@ -852,7 +848,7 @@ BOOL UndergroundMan_GetQueuedMessage(String *dest)
} else if (Mining_GetQueuedMessage(dest)) {
sUndergroundMan->messageRetrieved = TRUE;
return TRUE;
} else if (UndergroundSpheres_GetQueuedMessage(dest)) {
} else if (Spheres_GetQueuedMessage(dest)) {
sUndergroundMan->messageRetrieved = TRUE;
return TRUE;
}
@ -1220,17 +1216,17 @@ int CommPacketSizeOf_UndergroundPlayerState(void)
return sizeof(UndergroundPlayerState);
}
void ov23_022433BC(int netID, int unused1, void *unused2, void *unused3)
void UndergroundMan_ProcessAllDataSentMessage(int netID, int unused1, void *unused2, void *unused3)
{
sUndergroundMan->unk_CA[netID] = TRUE;
sUndergroundMan->initialized[netID] = TRUE;
}
static int ov23_022433D0(void)
static int UndergroundMan_CountInitializedPlayers(void)
{
int count = 0;
for (int netID = 0; netID < MAX_CONNECTED_PLAYERS; netID++) {
if (sUndergroundMan->unk_CA[netID]) {
if (sUndergroundMan->initialized[netID]) {
count++;
}
}
@ -1240,6 +1236,6 @@ static int ov23_022433D0(void)
static void UndergroundMan_DisconnectCallback(int netID)
{
sUndergroundMan->unk_CA[netID] = FALSE;
sUndergroundMan->initialized[netID] = FALSE;
SecretBases_ClearBaseEntranceData(netID);
}

View File

@ -1,4 +1,4 @@
#include "overlay023/underground_menu.h"
#include "underground/menus.h"
#include <nitro.h>
#include <string.h>
@ -10,16 +10,16 @@
#include "field/field_system.h"
#include "overlay005/sprite_resource_manager.h"
#include "overlay023/mining.h"
#include "overlay023/secret_bases.h"
#include "overlay023/underground_item_list_menu.h"
#include "overlay023/underground_manager.h"
#include "overlay023/underground_player.h"
#include "overlay023/underground_records.h"
#include "overlay023/underground_spheres.h"
#include "overlay023/underground_text_printer.h"
#include "overlay023/underground_traps.h"
#include "overlay023/underground_vendors.h"
#include "underground/item_list_menu.h"
#include "underground/manager.h"
#include "underground/mining.h"
#include "underground/player.h"
#include "underground/records.h"
#include "underground/secret_bases.h"
#include "underground/spheres.h"
#include "underground/text_printer.h"
#include "underground/traps.h"
#include "underground/vendors.h"
#include "bag.h"
#include "bg_window.h"
@ -58,19 +58,19 @@
#include "res/text/bank/underground_items.h"
#include "res/text/bank/underground_traps.h"
enum UndergroundSelectedMenuTypes {
enum UndergroundSelectedMenuType {
UNDERGROUND_MENU_SELECTED_SPHERE_TRAP = 1,
UNDERGROUND_MENU_SELECTED_GOOD,
UNDERGROUND_MENU_SELECTED_TREASURE,
};
enum UndergroundSelectedMenuOptions {
enum UndergroundSelectedMenuOption {
UNDERGROUND_MENU_OPTION_BURY = 1,
UNDERGROUND_MENU_OPTION_TRASH,
UNDERGROUND_MENU_OPTION_PUT_IN_BAG,
};
enum UndergroundMenuStates {
enum UndergroundMenuState {
UNDERGROUND_MENU_STATE_INIT = 0,
UNDERGROUND_MENU_STATE_START,
UNDERGROUND_MENU_STATE_CLOSE,
@ -93,19 +93,19 @@ enum UndergroundMenuStates {
UNDERGROUND_MENU_STATE_GOOD_SELECTED,
};
enum MenuIconAnimStates {
enum MenuIconAnimState {
ICON_ANIM_NONE = 0,
ICON_ANIM_SWELL,
ICON_ANIM_WIGGLE,
ICON_ANIM_COUNT,
};
enum MenuIconPalettes {
enum MenuIconPalette {
ICON_GRAYSCALE = 0,
ICON_COLORED,
};
enum UndergroundMenuSpriteTemplates {
enum UndergroundMenuSpriteTemplate {
UNDERGROUND_MENU_CURSOR_TEMPLATE = 0,
UNDERGROUND_MENU_ICON_TEMPLATE,
};
@ -134,10 +134,10 @@ typedef struct ItemSelectedOption {
static void UndergroundMenu_FreeSprites(UndergroundMenu *menu);
static void UndergroundMenu_AnimateSprites(UndergroundMenu *menu);
static void UndergroundMenu_SetStartMenuCursorPos(Sprite *param0, u32 param1);
static void UndergroundMenu_SetIconAnimationAndPalette(Sprite *param0, u16 param1, u16 param2);
static void UndergroundMenu_ChangeActiveMenuIcon(UndergroundMenu *menu, u16 param1, u16 param2);
static void UndergroundMenu_TryTransitionIconAnimationToWiggle(Sprite *param0);
static void UndergroundMenu_SetStartMenuCursorPos(Sprite *sprite, u32 pos);
static void UndergroundMenu_SetIconAnimationAndPalette(Sprite *sprite, u16 anim, u16 palette);
static void UndergroundMenu_ChangeActiveMenuIcon(UndergroundMenu *menu, u16 oldIndex, u16 index);
static void UndergroundMenu_TryTransitionIconAnimationToWiggle(Sprite *sprite);
static void UndergroundMenu_Main(SysTask *sysTask, void *data);
static BOOL UndergroundMenu_HandleStartMenu(SysTask *sysTask, void *data);
static void UndergroundMenu_InitTrapsMenu(UndergroundMenu *menu, MoveItemCallback moveItemCallback);
@ -154,24 +154,24 @@ static void UndergroundMenu_GoUpCallback(UndergroundMenu *menu);
static void UndergroundMenu_OpenTrainerRecords(UndergroundMenu *menu);
static BOOL UndergroundMenu_HandleTrapSelectedMenu(SysTask *sysTask, void *data);
static BOOL UndergroundMenu_HandleGoodSelectedMenu(SysTask *sysTask, void *data);
static void UndergroundMenu_MainHoldingFlag(SysTask *sysTask, void *param1);
static void UndergroundMenu_MainHoldingFlag(SysTask *sysTask, void *data);
static void UndergroundMenu_InitGoodsMenu(UndergroundMenu *menu, MoveItemCallback moveItemCallback);
static BOOL UndergroundMenu_HandleGoodsMenu(SysTask *sysTask, void *data);
static BOOL UndergroundMenu_HandleGiftMenu(SysTask *sysTask, void *param1);
static BOOL UndergroundMenu_HandleGiftMenu(SysTask *sysTask, void *data);
static void UndergroundMenu_ConfirmReturnToSurface(SysTask *sysTask, void *data);
static void UndergroundMenu_CheckForReturnYesNo(SysTask *sysTask, void *data);
static void UndergroundMenu_Free(SysTask *sysTask, UndergroundMenu *menu, BOOL leaveFieldSystemPaused);
static UndergroundMenuContext *ctx = NULL;
static const WindowTemplate sWindowTemplate = {
static const WindowTemplate sYesNoWindowTemplate = {
.bgLayer = BG_LAYER_MAIN_3,
.tilemapLeft = 25,
.tilemapTop = 13,
.width = 6,
.height = 4,
.width = YES_NO_MENU_TILE_W,
.height = YES_NO_MENU_TILE_H,
.palette = 13,
.baseTile = 543
.baseTile = BASE_TILE_YES_NO_MENU
};
static const struct {
@ -327,7 +327,7 @@ static void UndergroundMenu_TryTransitionIconAnimationToWiggle(Sprite *sprite)
return;
}
if (Sprite_IsAnimated(sprite) == FALSE) {
if (!Sprite_IsAnimated(sprite)) {
UndergroundMenu_SetIconAnimationAndPalette(sprite, ICON_ANIM_WIGGLE, ICON_COLORED);
}
}
@ -386,7 +386,7 @@ int UndergroundMenu_GetGoodAtSlotBag(int slot, void *menu)
return Underground_GetGoodAtSlotBag(underground, slot);
}
void UndergroundMenu_RemoveSelectedGoodBag(int goodID)
void UndergroundMenu_RemoveSelectedGoodBag(enum Good goodID)
{
GF_ASSERT(ctx->selectedID == goodID);
Underground_RemoveGoodAtSlotBag(ctx->underground, ctx->selectedSlot);
@ -440,7 +440,7 @@ int UndergroundMenu_GetTreasureAtSlot(int slot, void *menu)
return Underground_GetTreasureAtSlot(underground, slot);
}
BOOL UndergroundInventory_TryAddSphere(int sphereType, int sphereSize)
BOOL UndergroundInventory_TryAddSphere(enum SphereType sphereType, int sphereSize)
{
GF_ASSERT(sphereType < MINING_SPHERES_MAX);
@ -461,12 +461,12 @@ BOOL UndergroundInventory_TryAddTreasure(int treasureID)
return Underground_TryAddTreasure(ctx->underground, treasureID);
}
BOOL UndergroundInventory_TryAddTrap(int trapID)
BOOL UndergroundInventory_TryAddTrap(enum Trap trapID)
{
return Underground_TryAddTrap(ctx->underground, trapID);
}
BOOL UndergroundInventory_TryAddGoodBag(int goodID)
BOOL UndergroundInventory_TryAddGoodBag(enum Good goodID)
{
return Underground_TryAddGoodBag(ctx->underground, goodID);
}
@ -518,8 +518,8 @@ static void UndergroundMenu_InitStartMenu(UndergroundMenu *menu)
UndergroundMenu_MakeList(optionList);
menu->menuOptions = StringList_New(NELEMS(sUndergroundMenuOptions), HEAP_ID_FIELD1);
Window_Add(menu->fieldSystem->bgConfig, &menu->primaryWindow, BG_LAYER_MAIN_3, 20, 1, 11, NELEMS(sUndergroundMenuOptions) * 3, 13, (1024 - (18 + 12) - 9 - 11 * 22));
Window_DrawStandardFrame(&menu->primaryWindow, TRUE, 1024 - (18 + 12) - 9, 11);
Window_Add(menu->fieldSystem->bgConfig, &menu->primaryWindow, BG_LAYER_MAIN_3, 20, 1, 11, NELEMS(sUndergroundMenuOptions) * 3, 13, BASE_TILE_STANDARD_WINDOW_FRAME - 11 * 22);
Window_DrawStandardFrame(&menu->primaryWindow, TRUE, BASE_TILE_STANDARD_WINDOW_FRAME, 11);
MessageLoader *loader = UndergroundTextPrinter_GetMessageLoader(UndergroundMan_GetCommonTextPrinter());
@ -600,7 +600,7 @@ static void UndergroundMenu_Main(SysTask *sysTask, void *data)
UndergroundMenu_CheckForReturnYesNo(sysTask, data);
break;
case UNDERGROUND_MENU_STATE_CLOSE_AFTER_TEXT:
if (UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCommonTextPrinter()) == FALSE) {
if (!UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCommonTextPrinter())) {
if (JOY_NEW(PAD_BUTTON_A)) {
UndergroundTextPrinter_EraseMessageBoxWindow(UndergroundMan_GetCommonTextPrinter());
UndergroundMenu_Free(sysTask, menu, FALSE);
@ -610,7 +610,7 @@ static void UndergroundMenu_Main(SysTask *sysTask, void *data)
}
break;
case UNDERGROUND_MENU_STATE_CHANGE_STATE_AFTER_TEXT:
if (UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCommonTextPrinter()) == FALSE) {
if (!UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCommonTextPrinter())) {
if (JOY_NEW(PAD_BUTTON_A)) {
OpenMenuFn openNextMenu = (OpenMenuFn)menu->openMenuFn;
@ -759,8 +759,8 @@ static void UndergroundMenu_InitItemSelectedMenu(UndergroundMenu *menu, int menu
menu->itemSelectedOptions = StringList_New(optionCount, HEAP_ID_FIELD1);
Window_Add(menu->fieldSystem->bgConfig, &menu->secondaryWindow, BG_LAYER_MAIN_3, tilemapLeft, tilemapTop, width, optionCount * 2, 13, (1024 - (18 + 12) - 9 - 11 * 22));
Window_DrawStandardFrame(&menu->secondaryWindow, TRUE, 1024 - (18 + 12) - 9, 11);
Window_Add(menu->fieldSystem->bgConfig, &menu->secondaryWindow, BG_LAYER_MAIN_3, tilemapLeft, tilemapTop, width, optionCount * 2, 13, BASE_TILE_STANDARD_WINDOW_FRAME - 11 * 22);
Window_DrawStandardFrame(&menu->secondaryWindow, TRUE, BASE_TILE_STANDARD_WINDOW_FRAME, 11);
MessageLoader *loader = UndergroundTextPrinter_GetMessageLoader(UndergroundMan_GetCommonTextPrinter());
@ -807,7 +807,7 @@ static void UndergroundMenu_ReturnToStartMenu(UndergroundMenu *menu)
UndergroundTextPrinter_EraseMessageBoxWindow(UndergroundMan_GetItemNameTextPrinter());
}
void UndergroundMenu_RemoveSelectedTrap(int trapID)
void UndergroundMenu_RemoveSelectedTrap(enum Trap trapID)
{
if (ctx->selectedID == trapID) {
Underground_RemoveTrapAtSlot(ctx->underground, ctx->selectedSlot);
@ -819,7 +819,7 @@ void UndergroundMenu_PrintTrapDescription(ListMenu *listMenu, u32 index, u8 onIn
UndergroundMenu *menu = (UndergroundMenu *)ListMenu_GetAttribute(listMenu, LIST_MENU_PARENT);
GetItemFunc getTrap = menu->getItem;
int bankEntry;
int trapID = getTrap(index, menu);
enum Trap trapID = getTrap(index, menu);
if (index == LIST_CANCEL) {
bankEntry = UndergroundTraps_Text_CloseDescription;
@ -864,8 +864,8 @@ static void UndergroundMenu_InitTrapsMenu(UndergroundMenu *menu, MoveItemCallbac
menu->menuOptions = StringList_New(trapCount + 1, HEAP_ID_FIELD1);
Window_Add(menu->fieldSystem->bgConfig, &menu->primaryWindow, BG_LAYER_MAIN_3, 19, 3, 12, (6 * 2), 13, ((1024 - (18 + 12) - 9 - 11 * 22) - 12 * (6 * 2)));
Window_DrawStandardFrame(&menu->primaryWindow, TRUE, 1024 - (18 + 12) - 9, 11);
Window_Add(menu->fieldSystem->bgConfig, &menu->primaryWindow, BG_LAYER_MAIN_3, 19, 3, 12, 6 * 2, 13, (BASE_TILE_STANDARD_WINDOW_FRAME - 11 * 22) - 12 * (6 * 2));
Window_DrawStandardFrame(&menu->primaryWindow, TRUE, BASE_TILE_STANDARD_WINDOW_FRAME, 11);
MessageLoader *loader = UndergroundTextPrinter_GetMessageLoader(UndergroundMan_GetItemNameTextPrinter());
@ -988,7 +988,7 @@ static BOOL UndergroundMenu_HandleTrapSelectedMenu(SysTask *sysTask, void *data)
return TRUE;
}
void UndergroundMenu_RemoveSelectedSphere(int sphereType)
void UndergroundMenu_RemoveSelectedSphere(enum SphereType sphereType)
{
GF_ASSERT(ctx->selectedID == sphereType);
Underground_RemoveSphereAtSlot(ctx->underground, ctx->selectedSlot);
@ -999,7 +999,7 @@ static void UndergroundMenu_PrintSphereDescription(ListMenu *listMenu, u32 index
UndergroundMenu *menu = (UndergroundMenu *)ListMenu_GetAttribute(listMenu, LIST_MENU_PARENT);
GetItemFunc getSphereType = menu->getItem;
int bankEntry;
int sphereType = getSphereType(index, menu);
enum SphereType sphereType = getSphereType(index, menu);
if (index == LIST_CANCEL) {
bankEntry = UndergroundItems_Text_CloseDescription;
@ -1046,8 +1046,8 @@ static void UndergroundMenu_InitSpheresMenu(UndergroundMenu *menu, MoveItemCallb
menu->menuOptions = StringList_New(sphereCount + 1, HEAP_ID_FIELD1);
Window_Add(menu->fieldSystem->bgConfig, &menu->primaryWindow, BG_LAYER_MAIN_3, 19, 3, 12, (6 * 2), 13, ((1024 - (18 + 12) - 9 - 11 * 22) - 12 * (6 * 2)));
Window_DrawStandardFrame(&menu->primaryWindow, TRUE, 1024 - (18 + 12) - 9, 11);
Window_Add(menu->fieldSystem->bgConfig, &menu->primaryWindow, BG_LAYER_MAIN_3, 19, 3, 12, (6 * 2), 13, (BASE_TILE_STANDARD_WINDOW_FRAME - 11 * 22) - 12 * (6 * 2));
Window_DrawStandardFrame(&menu->primaryWindow, TRUE, BASE_TILE_STANDARD_WINDOW_FRAME, 11);
MessageLoader *loader = UndergroundTextPrinter_GetMessageLoader(UndergroundMan_GetItemNameTextPrinter());
@ -1148,7 +1148,7 @@ static BOOL UndergroundMenu_HandleSphereSelectedMenu(SysTask *sysTask, void *dat
int z = CommPlayer_GetZInFrontOfPlayer(netId);
UndergroundTextPrinter_EraseMessageBoxWindow(UndergroundMan_GetItemNameTextPrinter());
UndergroundSpheres_TryBurySphere(ctx->selectedID, UndergroundMenu_GetSphereSizeAtSlot(ctx->selectedSlot, menu), x, z);
Spheres_TryBurySphere(ctx->selectedID, UndergroundMenu_GetSphereSizeAtSlot(ctx->selectedSlot, menu), x, z);
} else if (input == UNDERGROUND_MENU_OPTION_TRASH) {
Sound_PlayEffect(SEQ_SE_CONFIRM);
UndergroundMenu_RemoveSelectedSphere(ctx->selectedID);
@ -1214,8 +1214,8 @@ static void UndergroundMenu_InitTreasuresMenu(UndergroundMenu *menu, MoveItemCal
menu->menuOptions = StringList_New(treasureCount + 1, HEAP_ID_FIELD1);
Window_Add(menu->fieldSystem->bgConfig, &menu->primaryWindow, BG_LAYER_MAIN_3, 19, 3, 12, (6 * 2), 13, ((1024 - (18 + 12) - 9 - 11 * 22) - 12 * (6 * 2)));
Window_DrawStandardFrame(&menu->primaryWindow, TRUE, 1024 - (18 + 12) - 9, 11);
Window_Add(menu->fieldSystem->bgConfig, &menu->primaryWindow, BG_LAYER_MAIN_3, 19, 3, 12, (6 * 2), 13, (BASE_TILE_STANDARD_WINDOW_FRAME - 11 * 22) - 12 * (6 * 2));
Window_DrawStandardFrame(&menu->primaryWindow, TRUE, BASE_TILE_STANDARD_WINDOW_FRAME, 11);
MessageLoader *loader = UndergroundTextPrinter_GetMessageLoader(UndergroundMan_GetItemNameTextPrinter());
@ -1369,8 +1369,8 @@ static void UndergroundMenu_ConfirmReturnToSurface(SysTask *sysTask, void *data)
{
UndergroundMenu *menu = data;
if (UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCommonTextPrinter()) == FALSE) {
menu->yesNoMenu = Menu_MakeYesNoChoice(menu->fieldSystem->bgConfig, &sWindowTemplate, 1024 - (18 + 12) - 9, 11, HEAP_ID_FIELD1);
if (!UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCommonTextPrinter())) {
menu->yesNoMenu = Menu_MakeYesNoChoice(menu->fieldSystem->bgConfig, &sYesNoWindowTemplate, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
menu->state = UNDERGROUND_MENU_STATE_WAIT_FOR_CONFIRM;
}
}
@ -1428,8 +1428,8 @@ void UndergroundMenu_StartHoldingFlag(ExitCallback exitCallback, FieldSystem *fi
static void UndergroundMenu_ConfirmThrowAwayFlag(UndergroundMenu *menu)
{
if (UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCaptureFlagTextPrinter()) == FALSE) {
menu->yesNoMenu = Menu_MakeYesNoChoice(menu->fieldSystem->bgConfig, &sWindowTemplate, 1024 - (18 + 12) - 9, 11, HEAP_ID_FIELD1);
if (!UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCaptureFlagTextPrinter())) {
menu->yesNoMenu = Menu_MakeYesNoChoice(menu->fieldSystem->bgConfig, &sYesNoWindowTemplate, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
menu->state = UNDERGROUND_MENU_STATE_START;
}
}
@ -1509,7 +1509,7 @@ static void UndergroundMenu_MainHoldingFlag(SysTask *sysTask, void *data)
CommSys_SendDataFixedSize(84, &flagEventType);
return;
case UNDERGROUND_MENU_STATE_UNUSED:
if (UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCaptureFlagTextPrinter()) == FALSE) {
if (!UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCaptureFlagTextPrinter())) {
if (JOY_NEW(PAD_BUTTON_A)) {
menu->state = UNDERGROUND_MENU_STATE_CLOSE;
}
@ -1523,7 +1523,7 @@ void UndergroundMenu_PrintGoodDescription(ListMenu *listMenu, u32 index, u8 onIn
UndergroundMenu *menu = (UndergroundMenu *)ListMenu_GetAttribute(listMenu, LIST_MENU_PARENT);
GetItemFunc getGood = menu->getItem;
int bankEntry;
int goodID = getGood(index, menu);
enum Good goodID = getGood(index, menu);
if (index == LIST_CANCEL) {
bankEntry = UndergroundGoods_Text_CloseDescription;
@ -1600,8 +1600,8 @@ static void UndergroundMenu_InitGoodsMenu(UndergroundMenu *menu, MoveItemCallbac
menu->menuOptions = StringList_New(goodsCount + 1, HEAP_ID_FIELD1);
Window_Add(menu->fieldSystem->bgConfig, &menu->primaryWindow, BG_LAYER_MAIN_3, 19, 3, 12, (6 * 2), 13, ((1024 - (18 + 12) - 9 - 11 * 22) - 12 * (6 * 2)));
Window_DrawStandardFrame(&menu->primaryWindow, TRUE, 1024 - (18 + 12) - 9, 11);
Window_Add(menu->fieldSystem->bgConfig, &menu->primaryWindow, BG_LAYER_MAIN_3, 19, 3, 12, (6 * 2), 13, (BASE_TILE_STANDARD_WINDOW_FRAME - 11 * 22) - 12 * (6 * 2));
Window_DrawStandardFrame(&menu->primaryWindow, TRUE, BASE_TILE_STANDARD_WINDOW_FRAME, 11);
MessageLoader *loader = UndergroundTextPrinter_GetMessageLoader(UndergroundMan_GetItemNameTextPrinter());

View File

@ -1,4 +1,4 @@
#include "overlay023/mining.h"
#include "underground/mining.h"
#include <nitro.h>
#include <string.h>
@ -15,14 +15,14 @@
#include "field/field_system.h"
#include "field/field_system_sub2_t.h"
#include "overlay005/hblank_system.h"
#include "overlay023/secret_bases.h"
#include "overlay023/underground_manager.h"
#include "overlay023/underground_menu.h"
#include "overlay023/underground_player.h"
#include "overlay023/underground_spheres.h"
#include "overlay023/underground_text_printer.h"
#include "overlay023/underground_top_screen.h"
#include "overlay023/underground_traps.h"
#include "underground/manager.h"
#include "underground/menus.h"
#include "underground/player.h"
#include "underground/secret_bases.h"
#include "underground/spheres.h"
#include "underground/text_printer.h"
#include "underground/top_screen.h"
#include "underground/traps.h"
#include "bg_window.h"
#include "brightness_controller.h"
@ -247,8 +247,8 @@ typedef struct MiningEnv {
MATHRandContext32 rand;
SpriteList *spriteList;
G2dRenderer g2DRenderer;
SpriteResourceCollection *spriteResourceCollection[4];
SpriteResource *spriteResources[8];
SpriteResourceCollection *spriteResourceCollection[MAX_SPRITE_RESOURCE_GEN4];
SpriteResource *spriteResources[MAX_SPRITE_RESOURCE_GEN4 * 2];
u8 padding[36];
SpriteResourcesHeader resourceData[2];
Sprite *sprites[MINING_SPRITE_COUNT];
@ -690,10 +690,10 @@ static const WindowTemplate sYesNoWindowTemplate = {
.bgLayer = BG_LAYER_MAIN_3,
.tilemapLeft = 25,
.tilemapTop = 13,
.width = 6,
.height = 4,
.width = YES_NO_MENU_TILE_W,
.height = YES_NO_MENU_TILE_H,
.palette = 13,
.baseTile = BASE_TILE_MESSAGE_WINDOW - 6 * 4
.baseTile = BASE_TILE_YES_NO_MENU
};
static void Mining_InitGameState(void)
@ -757,7 +757,7 @@ void MiningEnv_Init(void *dest, FieldSystem *fieldSystem)
}
// this may have been intended to return the actual amount of buried spheres instead of the maximum possible amount
int maxBuriedSpheres = UndergroundSpheres_SpawnMiningSpotsNearBuriedSpheres(&rand);
int maxBuriedSpheres = Spheres_SpawnMiningSpotsNearBuriedSpheres(&rand);
int spawnIterations = 25 - (maxBuriedSpheres / 10) - 1;
for (int i = 0; i < spawnIterations; i++) {
@ -767,7 +767,7 @@ void MiningEnv_Init(void *dest, FieldSystem *fieldSystem)
Underground_FlagSpawnedNewBuriedObjects(underground);
} else {
Mining_LoadSavedMiningSpots();
UndergroundTraps_LoadSpawnedTraps();
Traps_LoadSpawnedTraps();
}
}
@ -913,7 +913,7 @@ static void Mining_SpawnMiningSpotsAndTraps(MATHRandContext16 *rand, int unused)
z = MATH_Rand16(rand, 20) + centerZ - 10;
if (!TerrainCollisionManager_CheckCollision(sMiningEnv->fieldSystem, x, z)) {
int trapID = UndergroundTraps_SpawnRandomTrap(x, z, rand, sMiningEnv->spawnedTrapIndex);
enum Trap trapID = Traps_SpawnRandomTrap(x, z, rand, sMiningEnv->spawnedTrapIndex);
if (trapID != TRAP_NONE) {
sMiningEnv->spawnedTrapIndex++;
@ -1433,11 +1433,11 @@ static void Mining_FreeGameResources(MiningGameContext *ctx)
Bg_FreeTilemapBuffer(sMiningEnv->bgConfig, BG_LAYER_MAIN_2);
Bg_FreeTilemapBuffer(sMiningEnv->bgConfig, BG_LAYER_MAIN_3);
SpriteTransfer_ResetCharTransfer(sMiningEnv->spriteResources[SPRITE_RESOURCE_CHAR]);
SpriteTransfer_ResetCharTransfer(sMiningEnv->spriteResources[SPRITE_RESOURCE_CHAR + 4]);
SpriteTransfer_ResetCharTransfer(sMiningEnv->spriteResources[SPRITE_RESOURCE_CHAR + MAX_SPRITE_RESOURCE_GEN4]);
SpriteTransfer_ResetPlttTransfer(sMiningEnv->spriteResources[SPRITE_RESOURCE_PLTT]);
SpriteTransfer_ResetPlttTransfer(sMiningEnv->spriteResources[SPRITE_RESOURCE_PLTT + 4]);
SpriteTransfer_ResetPlttTransfer(sMiningEnv->spriteResources[SPRITE_RESOURCE_PLTT + MAX_SPRITE_RESOURCE_GEN4]);
for (int resourceType = SPRITE_RESOURCE_CHAR; resourceType < SPRITE_RESOURCE_ANIM + 1; resourceType++) {
for (int resourceType = SPRITE_RESOURCE_CHAR; resourceType < MAX_SPRITE_RESOURCE_GEN4; resourceType++) {
SpriteResourceCollection_Delete(sMiningEnv->spriteResourceCollection[resourceType]);
}
@ -1471,7 +1471,7 @@ static void Mining_GameTask(SysTask *sysTask, void *data)
switch (ctx->state) {
case MINING_STATE_INIT:
SecretBases_SetEntranceGraphicsEnabled(FALSE);
UndergroundSpheres_DisableBuriedSphereSparkles();
Spheres_DisableBuriedSphereSparkles();
CommPlayerMan_Disable();
SecretBases_DisableBaseEntranceGraphics();
ctx->state++;
@ -1656,7 +1656,7 @@ static void Mining_GameTask(SysTask *sysTask, void *data)
CommPlayerMan_Restart();
SecretBases_EnableBaseEntranceGraphics();
UndergroundSpheres_EnableBuriedSphereSparkles();
Spheres_EnableBuriedSphereSparkles();
CommSys_SendDataFixedSize(67, &ctx->dugUpAllItems);
CommPlayerMan_ResumeFieldSystem();
@ -2519,7 +2519,7 @@ static int Mining_GenerateSizeOfMinedSphere(int itemID)
int sphereSize = 0;
int id = itemID;
if (UndergroundSpheres_IsMiningItemSphere(id)) {
if (Spheres_IsMiningItemSphere(id)) {
if (id == MINING_LARGE_PRISM_SPHERE || id == MINING_LARGE_PALE_SPHERE || id == MINING_SMALL_PRISM_SPHERE || id == MINING_SMALL_PALE_SPHERE) {
sphereSize = MATH_Rand32(&sMiningEnv->rand, 1) + 1;
} else {
@ -2547,7 +2547,7 @@ static void Mining_AddItem(int itemID, int sphereSize)
UndergroundRecord *unused = SaveData_GetUndergroundRecord(FieldSystem_GetSaveData(sMiningEnv->fieldSystem));
Underground *underground = SaveData_GetUnderground(FieldSystem_GetSaveData(sMiningEnv->fieldSystem));
if (UndergroundSpheres_IsMiningItemSphere(id)) {
if (Spheres_IsMiningItemSphere(id)) {
UndergroundInventory_TryAddSphere(id, sphereSize);
} else {
UndergroundInventory_TryAddTreasure(id);
@ -2559,7 +2559,7 @@ static BOOL Mining_IsRoomInBag(int itemID)
{
Underground *underground = SaveData_GetUnderground(FieldSystem_GetSaveData(sMiningEnv->fieldSystem));
if (UndergroundSpheres_IsMiningItemSphere(itemID)) {
if (Spheres_IsMiningItemSphere(itemID)) {
return Underground_GetSphereCount(underground) != MAX_SPHERE_SLOTS;
} else {
return Underground_GetTreasureCount(underground) != MAX_TREASURE_SLOTS;
@ -2609,7 +2609,7 @@ static BOOL Mining_PrintNextDugUpItem(MiningGameContext *ctx)
UndergroundTextPrinter_SetUndergroundItemNameWithArticle(UndergroundMan_GetCommonTextPrinter(), sMiningEnv->buriedObjects[i].itemID);
int bankEntry;
if (UndergroundSpheres_IsMiningItemSphere(sMiningEnv->buriedObjects[i].itemID)) {
if (Spheres_IsMiningItemSphere(sMiningEnv->buriedObjects[i].itemID)) {
bankEntry = UndergroundCommon_Text_YouObtainedSphere;
UndergroundTextPrinter_SetTwoDigitNumberWithIndex(UndergroundMan_GetCommonTextPrinter(), 1, ctx->sizeOfCurrentSphere);
} else {
@ -2636,7 +2636,7 @@ static BOOL Mining_ProcessNextDugUpItem(MiningGameContext *ctx)
int itemID = sMiningEnv->buriedObjects[i].itemID;
if (UndergroundSpheres_IsMiningItemSphere(itemID)) {
if (Spheres_IsMiningItemSphere(itemID)) {
UndergroundRecord_AddNumSpheresDug(undergroundRecord, 1);
} else {
FieldSystem_SaveTVEpisodeSegment_UndergroundTreasuresCorner(sMiningEnv->fieldSystem, itemID, 1);
@ -2805,7 +2805,7 @@ static void Mining_InitSpriteResources(void)
SetSubScreenViewRect(&sMiningEnv->g2DRenderer, 0, (HW_LCD_HEIGHT << FX32_SHIFT) * 2);
for (int resourceType = SPRITE_RESOURCE_CHAR; resourceType < SPRITE_RESOURCE_ANIM + 1; resourceType++) {
for (int resourceType = SPRITE_RESOURCE_CHAR; resourceType < MAX_SPRITE_RESOURCE_GEN4; resourceType++) {
sMiningEnv->spriteResourceCollection[resourceType] = SpriteResourceCollection_New(2, resourceType, HEAP_ID_MINING);
}

View File

@ -1,4 +1,4 @@
#include "overlay023/underground_pc.h"
#include "underground/pc.h"
#include <nitro.h>
#include <string.h>
@ -9,18 +9,18 @@
#include "struct_defs/underground.h"
#include "field/field_system.h"
#include "overlay023/base_decoration.h"
#include "overlay023/mining.h"
#include "overlay023/secret_bases.h"
#include "overlay023/underground_item_list_menu.h"
#include "overlay023/underground_manager.h"
#include "overlay023/underground_menu.h"
#include "overlay023/underground_player.h"
#include "overlay023/underground_records.h"
#include "overlay023/underground_spheres.h"
#include "overlay023/underground_text_printer.h"
#include "overlay023/underground_traps.h"
#include "overlay023/underground_vendors.h"
#include "underground/base_decoration.h"
#include "underground/item_list_menu.h"
#include "underground/manager.h"
#include "underground/menus.h"
#include "underground/mining.h"
#include "underground/player.h"
#include "underground/records.h"
#include "underground/secret_bases.h"
#include "underground/spheres.h"
#include "underground/text_printer.h"
#include "underground/traps.h"
#include "underground/vendors.h"
#include "bg_window.h"
#include "brightness_controller.h"
@ -134,17 +134,17 @@ static void UndergroundPC_StartTakeFlagPromptTask(FieldSystem *fieldSystem, PCIn
static void UndergroundPC_OpenPCMenu(FieldSystem *fieldSystem);
static void UndergroundPC_UpdateCursorPos(UndergroundMenu *menu);
static const WindowTemplate sWindowTemplate = {
static const WindowTemplate sYesNoWindowTemplate = {
.bgLayer = BG_LAYER_MAIN_3,
.tilemapLeft = 25,
.tilemapTop = 13,
.width = 6,
.height = 4,
.width = YES_NO_MENU_TILE_W,
.height = YES_NO_MENU_TILE_H,
.palette = 13,
.baseTile = 543,
.baseTile = BASE_TILE_YES_NO_MENU
};
int UndergroundPC_GetPCAtCoordinates(Coordinates *coordinates, int dir)
int UndergroundPC_GetPCOwnerNetIDAtCoordinates(Coordinates *coordinates, int dir)
{
int netID;
int x = coordinates->x;
@ -152,7 +152,7 @@ int UndergroundPC_GetPCAtCoordinates(Coordinates *coordinates, int dir)
int modifier = 0;
if (dir != DIR_NONE && dir != DIR_NORTH) {
return PC_NONE;
return NETID_NONE;
}
if (z == PC_COORDINATE_Z) {
@ -160,7 +160,7 @@ int UndergroundPC_GetPCAtCoordinates(Coordinates *coordinates, int dir)
} else if (z == PC_COORDINATE_Z + SECRET_BASE_DEPTH) {
modifier = MAX_CONNECTED_PLAYERS; // bug: would lead to out of bounds array access
} else {
return PC_NONE;
return NETID_NONE;
}
if (x == PC_COORDINATE_X || x == PC_COORDINATE_X + 1) {
@ -175,18 +175,18 @@ int UndergroundPC_GetPCAtCoordinates(Coordinates *coordinates, int dir)
x -= SECRET_BASE_WIDTH;
}
return PC_NONE;
return NETID_NONE;
}
BOOL UndergroundPC_TryUsePC(int netID, Coordinates *coordinates)
{
int pcNetID = UndergroundPC_GetPCAtCoordinates(coordinates, CommPlayer_DirServer(netID));
int pcNetID = UndergroundPC_GetPCOwnerNetIDAtCoordinates(coordinates, CommPlayer_DirServer(netID));
if (CommPlayer_Dir(pcNetID) == DIR_NONE) {
pcNetID = PC_NONE;
pcNetID = NETID_NONE;
}
if (pcNetID != PC_NONE) {
if (pcNetID != NETID_NONE) {
CommPlayerMan_SetMovementEnabled(netID, FALSE);
PCInteraction pcInteraction;
@ -252,7 +252,7 @@ int CommPacketSizeOf_PCInteraction(void)
static BOOL UndergroundPC_TryDepositGood(int slot, UndergroundMenu *menu)
{
Underground *underground = SaveData_GetUnderground(FieldSystem_GetSaveData(menu->fieldSystem));
int goodID = Underground_GetGoodAtSlotBag(underground, slot);
enum Good goodID = Underground_GetGoodAtSlotBag(underground, slot);
if (Underground_TryAddGoodPC(underground, goodID)) {
Underground_RemoveGoodAtSlotBag(underground, slot);
@ -270,7 +270,7 @@ static int UndergroundPC_TryWithdrawGood(int slot, UndergroundMenu *menu)
return -1;
}
int goodID = Underground_GetGoodAtSlotPC(underground, slot);
enum Good goodID = Underground_GetGoodAtSlotPC(underground, slot);
if (UndergroundInventory_TryAddGoodBag(goodID)) {
Underground_RemoveGoodAtSlotPC(underground, slot);
@ -518,7 +518,7 @@ static BOOL UndergroundPC_HandleStoreGoodsMenu(SysTask *sysTask, void *data)
break;
default:
UndergroundTextPrinter_EraseMessageBoxWindow(UndergroundMan_GetItemNameTextPrinter());
u32 goodID = UndergroundMenu_GetGoodAtSlotBag(input, menu);
enum Good goodID = UndergroundMenu_GetGoodAtSlotBag(input, menu);
if (UndergroundPC_TryDepositGood(input, menu)) {
UndergroundTextPrinter_SetUndergroundGoodsName(UndergroundMan_GetMiscTextPrinter(), goodID);
@ -560,7 +560,7 @@ static BOOL UndergroundPC_HandleWithdrawGoodsMenu(SysTask *sysTask, void *data)
break;
default:
UndergroundTextPrinter_EraseMessageBoxWindow(UndergroundMan_GetItemNameTextPrinter());
u32 goodID = UndergroundMenu_GetGoodAtSlotPC(input, menu);
enum Good goodID = UndergroundMenu_GetGoodAtSlotPC(input, menu);
int withdrawResult = UndergroundPC_TryWithdrawGood(input, menu);
if (withdrawResult == 1) {
@ -600,8 +600,8 @@ static void UndergroundPC_MoveCamera(BOOL isDecorating, FieldSystem *fieldSystem
VecFx32 delta;
delta.y = 0;
delta.x = 15 * FX32_ONE * 16 - Player_GetXPos(fieldSystem->playerAvatar) * FX32_ONE * 16;
delta.z = 17 * FX32_ONE * 16 - Player_GetZPos(fieldSystem->playerAvatar) * FX32_ONE * 16;
delta.x = 15 * MAP_OBJECT_TILE_SIZE - Player_GetXPos(fieldSystem->playerAvatar) * MAP_OBJECT_TILE_SIZE;
delta.z = 17 * MAP_OBJECT_TILE_SIZE - Player_GetZPos(fieldSystem->playerAvatar) * MAP_OBJECT_TILE_SIZE;
if (!isDecorating) {
delta.x = -delta.x;
@ -631,7 +631,7 @@ static BOOL UndergroundPC_DecorateTask(FieldTask *task)
}
break;
case DECORATE_STATE_START:
BaseDecoration_StartDecorationTask(fieldSystem, task);
BaseDecoration_StartDecorationMenuTask(fieldSystem, task);
ctx->state = DECORATE_STATE_MAIN;
break;
case DECORATE_STATE_MAIN:
@ -867,7 +867,7 @@ static void UndergroundPC_TakeFlagPromptTask(SysTask *sysTask, void *data)
switch (ctx->state) {
case TAKE_FLAG_PROMPT_STATE_INIT:
if (!UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCommonTextPrinter())) {
ctx->menu = Menu_MakeYesNoChoice(ctx->fieldSystem->bgConfig, &sWindowTemplate, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
ctx->menu = Menu_MakeYesNoChoice(ctx->fieldSystem->bgConfig, &sYesNoWindowTemplate, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
ctx->state = TAKE_FLAG_PROMPT_STATE_MAIN;
}
break;

View File

@ -1,5 +1,6 @@
#include "overlay023/underground_player.h"
#include "underground/player.h"
#include <limits.h>
#include <nitro.h>
#include <string.h>
@ -13,12 +14,12 @@
#include "overlay005/ov5_021F5284.h"
#include "overlay005/ov5_021F5428.h"
#include "overlay005/ov5_021F55CC.h"
#include "overlay023/secret_bases.h"
#include "overlay023/underground_manager.h"
#include "overlay023/underground_menu.h"
#include "overlay023/underground_player_status.h"
#include "overlay023/underground_player_talk.h"
#include "overlay023/underground_text_printer.h"
#include "underground/manager.h"
#include "underground/menus.h"
#include "underground/player_status.h"
#include "underground/player_talk.h"
#include "underground/secret_bases.h"
#include "underground/text_printer.h"
#include "comm_player_manager.h"
#include "communication_information.h"
@ -371,7 +372,7 @@ BOOL UndergroundPlayer_BuriedObjectHeldFlagCheck(int netID)
return TRUE;
}
static void UndergroundPlayer_HandleCurrentPlayerLosingFlag(FlagEvent *param0, BOOL takerIsNotFlagOwner, UndergroundRecord *unused)
static void UndergroundPlayer_HandleCurrentPlayerLosingFlag(FlagEvent *event, BOOL takerIsNotFlagOwner, UndergroundRecord *unused)
{
CommPlayerManager *commPlayerMan = CommPlayerMan_Get();
@ -380,7 +381,7 @@ static void UndergroundPlayer_HandleCurrentPlayerLosingFlag(FlagEvent *param0, B
sub_02057FC4(FALSE);
CommPlayerMan_PauseFieldSystemWithContextBit(PAUSE_BIT_LOST_FLAG);
UndergroundTextPrinter_SetPlayerNameIndex0(UndergroundMan_GetCaptureFlagTextPrinter(), CommInfo_TrainerInfo(param0->netID));
UndergroundTextPrinter_SetPlayerNameIndex0(UndergroundMan_GetCaptureFlagTextPrinter(), CommInfo_TrainerInfo(event->netID));
if (takerIsNotFlagOwner) {
commPlayerMan->emote[CommSys_CurNetId()] = EMOTE_NONE;
@ -482,7 +483,7 @@ void UndergroundPlayer_ProcessFlagEvent(int unused0, int unused1, void *data, vo
if (commPlayerMan->heldFlagOwnerInfo[event->netID]) {
FieldSystem_SaveTVEpisodeSegment_CaptureTheFlagDigest_TakeFlag(commPlayerMan->fieldSystem, commPlayerMan->heldFlagOwnerInfo[event->netID]);
if (commPlayerMan->flagsRegisteredInCurrentSession != 0xffff) {
if (commPlayerMan->flagsRegisteredInCurrentSession != USHRT_MAX) {
commPlayerMan->flagsRegisteredInCurrentSession++;
}
}
@ -519,7 +520,7 @@ void UndergroundPlayer_ClearHeldFlagInfo(void)
}
}
u8 *ov23_0224AAA0(int unused0, void *unused1, int unused2)
u8 *UndergroundPlayer_GetHeldFlagInfoBuffer(int unused0, void *unused1, int unused2)
{
CommPlayerManager *commPlayerMan = CommPlayerMan_Get();
return (u8 *)&commPlayerMan->heldFlagInfo[MAX_CONNECTED_PLAYERS];
@ -624,7 +625,7 @@ BOOL UndergroundPlayer_HaveLinksReceivedHeldFlagData(void)
return commPlayerMan->linksReceivedHeldFlagData;
}
void ov23_0224AC4C(void)
void UndergroundPlayer_ResetHeldFlagInfo(void)
{
TrainerInfo *flagOwnerInfo = NULL;
int netID; // needs to be declared here to match

View File

@ -1,4 +1,4 @@
#include "overlay023/underground_player_status.h"
#include "underground/player_status.h"
#include "communication_system.h"

View File

@ -1,4 +1,4 @@
#include "overlay023/underground_player_talk.h"
#include "underground/player_talk.h"
#include <nitro.h>
#include <string.h>
@ -7,10 +7,10 @@
#include "generated/trainer_score_events.h"
#include "field/field_system.h"
#include "overlay023/underground_manager.h"
#include "overlay023/underground_menu.h"
#include "overlay023/underground_records.h"
#include "overlay023/underground_text_printer.h"
#include "underground/manager.h"
#include "underground/menus.h"
#include "underground/records.h"
#include "underground/text_printer.h"
#include "bg_window.h"
#include "comm_player_manager.h"
@ -248,10 +248,10 @@ static const WindowTemplate sYesNoWindowTemplate = {
.bgLayer = BG_LAYER_MAIN_3,
.tilemapLeft = 25,
.tilemapTop = 13,
.width = 6,
.height = 4,
.width = YES_NO_MENU_TILE_W,
.height = YES_NO_MENU_TILE_H,
.palette = 13,
.baseTile = 543,
.baseTile = BASE_TILE_YES_NO_MENU
};
static void UndergroundTalkResponse_RequestLinkTalkStateUpdate(ResponseMenu *menu, int newState)
@ -535,7 +535,7 @@ static void UndergroundTalk_RemoveGiftedGood(TalkMenu *menu)
Sound_PlayEffect(SEQ_SE_DP_PIRORIRO2);
}
static void UndergroundTalk_PrintGiftConfirmPrompt(TalkMenu *unused, int goodID)
static void UndergroundTalk_PrintGiftConfirmPrompt(TalkMenu *unused, enum Good goodID)
{
UndergroundTextPrinter_SetUndergroundGoodsName(UndergroundMan_GetCommonTextPrinter(), goodID);
UndergroundTextPrinter_PrintText(UndergroundMan_GetCommonTextPrinter(), UndergroundCommon_Text_YouWantToGiveMeGiftPrompt, FALSE, NULL);

View File

@ -1,4 +1,4 @@
#include "overlay023/underground_records.h"
#include "underground/records.h"
#include <nitro.h>
#include <string.h>
@ -9,8 +9,8 @@
#include "struct_defs/underground.h"
#include "struct_defs/underground_record.h"
#include "overlay023/underground_manager.h"
#include "overlay023/underground_text_printer.h"
#include "underground/manager.h"
#include "underground/text_printer.h"
#include "bg_window.h"
#include "comm_player_manager.h"

View File

@ -1,4 +1,4 @@
#include "overlay023/secret_bases.h"
#include "underground/secret_bases.h"
#include <nitro.h>
#include <string.h>
@ -19,16 +19,16 @@
#include "overlay005/map_prop.h"
#include "overlay005/ov5_021F55CC.h"
#include "overlay005/ov5_021F5894.h"
#include "overlay023/underground_comm_manager.h"
#include "overlay023/underground_manager.h"
#include "overlay023/underground_menu.h"
#include "overlay023/underground_player.h"
#include "overlay023/underground_player_talk.h"
#include "overlay023/underground_records.h"
#include "overlay023/underground_spheres.h"
#include "overlay023/underground_text_printer.h"
#include "overlay023/underground_top_screen.h"
#include "overlay023/underground_traps.h"
#include "underground/comm_manager.h"
#include "underground/manager.h"
#include "underground/menus.h"
#include "underground/player.h"
#include "underground/player_talk.h"
#include "underground/records.h"
#include "underground/spheres.h"
#include "underground/text_printer.h"
#include "underground/top_screen.h"
#include "underground/traps.h"
#include "bg_window.h"
#include "comm_player_manager.h"
@ -308,24 +308,24 @@ static void ov23_0224DC24(void);
static SecretBasesEnv *secretBasesEnv = NULL;
static const WindowTemplate Unk_ov23_02256864 = {
static const WindowTemplate sYesNoWindowTemplate = {
.bgLayer = BG_LAYER_MAIN_3,
.tilemapLeft = 25,
.tilemapTop = 13,
.width = 6,
.height = 4,
.width = YES_NO_MENU_TILE_W,
.height = YES_NO_MENU_TILE_H,
.palette = 13,
.baseTile = 543,
.baseTile = BASE_TILE_YES_NO_MENU
};
static const WindowTemplate Unk_ov23_0225686C = {
static const WindowTemplate sLeaveOpenOrCloseWindowTemplate = {
.bgLayer = BG_LAYER_MAIN_3,
.tilemapLeft = 16,
.tilemapTop = 13,
.width = 15,
.height = 4,
.palette = 13,
.baseTile = 505,
.baseTile = BASE_TILE_MESSAGE_WINDOW - 15 * 4 - 2 // ?
};
// clang-format off
@ -431,7 +431,7 @@ void SecretBasesEnv_Init(void *dest, FieldSystem *fieldSystem)
secretBasesEnv->visitedBaseOwnerNetIDs[netID] = NETID_NONE;
secretBasesEnv->obtainedFlagOwnerNetIDs[netID] = NETID_NONE;
secretBasesEnv->flagStealVictimNetIDs[netID] = NETID_NONE;
secretBasesEnv->tookBackFlagMessageQueued[netID] = 0xff;
secretBasesEnv->tookBackFlagMessageQueued[netID] = -1;
secretBasesEnv->baseReturnXCoords[netID] = DEFAULT_BASE_RETURN_X;
secretBasesEnv->baseReturnZCoords[netID] = DEFAULT_BASE_RETURN_Z;
@ -472,10 +472,10 @@ void SecretBases_LoadCurrentPlayerBase(FieldSystem *fieldSystem)
static void SecretBases_AddGoodCollisionToBaseCollision(int x, int z, const u8 *goodCollision, u32 *baseCollision)
{
for (int i = 0; i < 3; i++) {
for (int i = 0; i < MAX_GOOD_DEPTH; i++) {
if (z + i < SECRET_BASE_DEPTH) {
for (int j = 0; j < 3; j++) {
if (goodCollision[i * 3 + j]) {
for (int j = 0; j < MAX_GOOD_WIDTH; j++) {
if (goodCollision[i * MAX_GOOD_WIDTH + j]) {
if (x + j < SECRET_BASE_WIDTH) {
baseCollision[i + z] &= ~(0x1 << (x + j));
}
@ -501,10 +501,10 @@ static void SecretBases_CalculateBaseCollision(SecretBase *secretBase, u32 *base
};
// clang-format on
MI_CpuFill8(baseCollision, 0xFF, 32 * sizeof(u32));
MI_CpuFill8(baseCollision, 0xFF, SECRET_BASE_DEPTH * sizeof(u32));
for (int i = 0; i < MAX_PLACED_GOODS + MAX_BASE_BOULDERS + 1; i++) {
int goodID = SecretBase_GetGoodIDAtIndex(secretBase, i);
for (int i = 0; i < MAX_SECRET_BASE_GOODS; i++) {
enum Good goodID = SecretBase_GetGoodIDAtIndex(secretBase, i);
if (goodID == UG_GOOD_NONE) {
continue;
@ -931,7 +931,7 @@ static void SecretBases_ExitBasePromptTask(SysTask *sysTask, void *data)
break;
case EXIT_PROMPT_STATE_OPEN_CONFIRM_MENU:
if (!UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCommonTextPrinter())) {
ctx->menu = Menu_MakeYesNoChoice(fieldSystem->bgConfig, &Unk_ov23_02256864, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
ctx->menu = Menu_MakeYesNoChoice(fieldSystem->bgConfig, &sYesNoWindowTemplate, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
ctx->state = EXIT_PROMPT_STATE_CONFIRM;
}
break;
@ -948,7 +948,7 @@ static void SecretBases_ExitBasePromptTask(SysTask *sysTask, void *data)
break;
case EXIT_PROMPT_STATE_OPEN_CONFIRM_MENU_DOOR_CLOSED:
if (!UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCommonTextPrinter())) {
ctx->menu = Menu_MakeYesNoChoice(fieldSystem->bgConfig, &Unk_ov23_02256864, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
ctx->menu = Menu_MakeYesNoChoice(fieldSystem->bgConfig, &sYesNoWindowTemplate, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
ctx->state = EXIT_PROMPT_STATE_CONFIRM_DOOR_CLOSED;
}
break;
@ -966,7 +966,7 @@ static void SecretBases_ExitBasePromptTask(SysTask *sysTask, void *data)
break;
case EXIT_PROMPT_STATE_OPEN_COMMS_CONFIRM_MENU:
if (!UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCommonTextPrinter())) {
ctx->menu = Menu_MakeYesNoChoice(fieldSystem->bgConfig, &Unk_ov23_02256864, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
ctx->menu = Menu_MakeYesNoChoice(fieldSystem->bgConfig, &sYesNoWindowTemplate, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
ctx->state = EXIT_PROMPT_STATE_CONFIRM_COMMS;
}
break;
@ -1130,7 +1130,7 @@ static void SecretBases_EnterBasePromptTask(SysTask *sysTask, void *data)
break;
case ENTER_PROMPT_STATE_OPEN_CONFIRM_MENU_OTHER_BASE:
if (!UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCommonTextPrinter())) {
ctx->menu = Menu_MakeYesNoChoice(fieldSystem->bgConfig, &Unk_ov23_02256864, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
ctx->menu = Menu_MakeYesNoChoice(fieldSystem->bgConfig, &sYesNoWindowTemplate, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
ctx->state = ENTER_PROMPT_STATE_CONFIRM_OTHER_BASE;
}
break;
@ -1152,7 +1152,7 @@ static void SecretBases_EnterBasePromptTask(SysTask *sysTask, void *data)
break;
case ENTER_PROMPT_STATE_OPEN_CONFIRM_MENU_OWN_BASE:
if (!UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCommonTextPrinter())) {
ctx->menu = Menu_MakeYesNoChoice(fieldSystem->bgConfig, &Unk_ov23_02256864, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
ctx->menu = Menu_MakeYesNoChoice(fieldSystem->bgConfig, &sYesNoWindowTemplate, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
ctx->state = ENTER_PROMPT_STATE_CONFIRM_OWN_BASE;
}
break;
@ -1176,7 +1176,7 @@ static void SecretBases_EnterBasePromptTask(SysTask *sysTask, void *data)
break;
case ENTER_PROMPT_STATE_OPEN_CLOSE_DOOR_MENU:
if (!UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCommonTextPrinter())) {
ctx->menu = SecretBases_MakeLeaveOpenOrCloseMenu(fieldSystem->bgConfig, &Unk_ov23_0225686C, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
ctx->menu = SecretBases_MakeLeaveOpenOrCloseMenu(fieldSystem->bgConfig, &sLeaveOpenOrCloseWindowTemplate, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
ctx->state = ENTER_PROMPT_STATE_CLOSE_DOOR_MENU;
}
break;
@ -1277,7 +1277,7 @@ void SecretBases_ProcessBaseExitEvent(int unused0, int unused1, void *data, void
UndergroundRecords_ForceExitTrainerCase();
UndergroundTalk_ExitConversation();
UndergroundMan_ForceEndCurrentSysTask();
UndergroundTraps_ForceEndCurrentTrapEffectClient(CommSys_CurNetId(), FALSE);
Traps_ForceEndCurrentTrapEffectClient(CommSys_CurNetId(), FALSE);
CommSys_SendMessage(43);
secretBasesEnv->currentPlayerInBase = FALSE;
@ -1286,7 +1286,7 @@ void SecretBases_ProcessBaseExitEvent(int unused0, int unused1, void *data, void
SecretBases_StartMoveToFromSecretBaseTask(secretBasesEnv->fieldSystem, event->x, event->z, event->dir, event->netID, event->forceExit);
secretBasesEnv->currentOccupiedBaseInfo = NULL;
} else {
UndergroundTraps_StopLinkSpin(event->netID);
Traps_StopLinkSpin(event->netID);
UndergroundPlayer_MoveToFromSecretBaseClient(event->netID, event->x, event->z, event->dir);
}
}
@ -1541,9 +1541,9 @@ static void SecretBases_DrawBaseEntrancesTask(SysTask *unused, void *unused1)
}
VecFx32 position;
position.x = entranceX * (FX32_ONE * 16) + (FX32_ONE * 8);
position.x = entranceX * MAP_OBJECT_TILE_SIZE + MAP_OBJECT_TILE_SIZE / 2;
position.y = 0;
position.z = entranceZ * (FX32_ONE * 16) + (FX32_ONE * 8);
position.z = entranceZ * MAP_OBJECT_TILE_SIZE + MAP_OBJECT_TILE_SIZE / 2;
secretBasesEnv->baseEntrancePropIdxs[netID] = MapPropManager_LoadOne(secretBasesEnv->fieldSystem->mapPropManager, secretBasesEnv->fieldSystem->areaDataManager, MAP_PROP_MODEL_SECRET_BASE_ENTRANCE_NORTH + dir, &position, NULL, secretBasesEnv->fieldSystem->mapPropAnimMan);
}
@ -1626,7 +1626,7 @@ static BOOL SecretBases_MoveToFromSecretBaseTask(FieldTask *task)
ctx->initialConnectedCount = CommSys_ConnectedCount();
CommSys_DisableSendMovementData();
UndergroundSpheres_DisableBuriedSphereSparkles();
Spheres_DisableBuriedSphereSparkles();
if (CommManUnderground_TryEnterBaseTransitionState()) {
ctx->state = MOVE_STATE_FADE_OUT;
@ -1831,7 +1831,7 @@ static void SecretBases_DiggerDrillTask(SysTask *sysTask, void *data)
ctx->state = DRILL_STATE_PRINT_PROMPT;
} break;
case DRILL_STATE_PRINT_PROMPT:
if (UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCommonTextPrinter()) == FALSE) {
if (!UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCommonTextPrinter())) {
int bankEntry;
if (SecretBases_CountPlayersInBase(CommSys_CurNetId(), FALSE) != 0) {
@ -1857,7 +1857,7 @@ static void SecretBases_DiggerDrillTask(SysTask *sysTask, void *data)
break;
case DRILL_STATE_OPEN_CONFIRM_MENU:
if (!UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetCommonTextPrinter())) {
ctx->menu = Menu_MakeYesNoChoice(fieldSystem->bgConfig, &Unk_ov23_02256864, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
ctx->menu = Menu_MakeYesNoChoice(fieldSystem->bgConfig, &sYesNoWindowTemplate, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
ctx->state = 6;
}
break;
@ -2098,9 +2098,9 @@ BOOL SecretBases_GetQueuedMessage(String *dest)
}
}
if (secretBasesEnv->tookBackFlagMessageQueued[netID] != 0xff) {
if (secretBasesEnv->tookBackFlagMessageQueued[netID] != (u8)-1) {
TrainerInfo *trainerInfo = CommInfo_TrainerInfo(netID);
secretBasesEnv->tookBackFlagMessageQueued[netID] = 0xff;
secretBasesEnv->tookBackFlagMessageQueued[netID] = -1;
if (UndergroundMan_FormatCommonStringWithTrainerName(trainerInfo, 0, UndergroundCommon_Text_PlayerTookBackFlag, dest)) {
return TRUE;
@ -2255,7 +2255,7 @@ void SecretBases_EraseBaseDecorationMessageBox(void)
UndergroundTextPrinter_EraseMessageBoxWindow(UndergroundMan_GetBaseDecorationTextPrinter());
}
void SecretBases_SetGoodNameForPrinter(int goodID)
void SecretBases_SetGoodNameForPrinter(enum Good goodID)
{
UndergroundTextPrinter_SetGoodNameWithIndex(UndergroundMan_GetBaseDecorationTextPrinter(), 0, goodID);
}
@ -2265,12 +2265,12 @@ void SecretBases_SetTwoDigitNumberWithIndexForPrinter(int num, int index)
UndergroundTextPrinter_SetTwoDigitNumberWithIndex(UndergroundMan_GetBaseDecorationTextPrinter(), index, num);
}
static int SecretBases_GetGoodWithCollisionAtCoordinates(SecretBase *secretBase, int xWithinBase, int zWithinBase)
static enum Good SecretBases_GetGoodWithCollisionAtCoordinates(SecretBase *secretBase, int xWithinBase, int zWithinBase)
{
const u8 *collision;
for (int i = 0; i < MAX_PLACED_GOODS + MAX_BASE_BOULDERS + 1; i++) {
int goodID = SecretBase_GetGoodIDAtIndex(secretBase, i);
for (int i = 0; i < MAX_SECRET_BASE_GOODS; i++) {
enum Good goodID = SecretBase_GetGoodIDAtIndex(secretBase, i);
if (goodID == UG_GOOD_NONE) {
continue;
@ -2290,15 +2290,15 @@ static int SecretBases_GetGoodWithCollisionAtCoordinates(SecretBase *secretBase,
xOffset = xWithinBase - xOffset;
zOffset = zWithinBase - zOffset;
if (xOffset < 0 || xOffset > 2) {
if (xOffset < 0 || MAX_GOOD_WIDTH - 1 < xOffset) {
continue;
}
if (zOffset < 0 || zOffset > 2) {
if (zOffset < 0 || MAX_GOOD_DEPTH - 1 < zOffset) {
continue;
}
if (collision[zOffset * 3 + xOffset]) {
if (collision[zOffset * MAX_GOOD_WIDTH + xOffset]) {
return goodID;
}
}
@ -2317,7 +2317,7 @@ BOOL SecretBases_CheckForInteractableGood(int netID, Coordinates *coordinates)
int baseOwnerNetID = SecretBases_GetOwnerNetIDFromCoordinates(x, z);
SecretBase *secretBase = (SecretBase *)secretBasesEnv->baseInfo[baseOwnerNetID].secretBase;
int goodID = SecretBases_GetGoodWithCollisionAtCoordinates(secretBase, x % SECRET_BASE_WIDTH, z % SECRET_BASE_DEPTH);
enum Good goodID = SecretBases_GetGoodWithCollisionAtCoordinates(secretBase, x % SECRET_BASE_WIDTH, z % SECRET_BASE_DEPTH);
event.bankEntry = Good_GetInteractMessageID(goodID);
@ -2460,10 +2460,10 @@ int CommPacketSizeOf_FlagRankUpEvent(void)
return sizeof(FlagRankUpEvent);
}
static int SecretBases_GetPlacedGoodAtCoordinates(SecretBase *secretBase, int xWithinBase, int zWithinBase)
static enum Good SecretBases_GetPlacedGoodAtCoordinates(SecretBase *secretBase, int xWithinBase, int zWithinBase)
{
for (int i = 0; i < MAX_PLACED_GOODS + MAX_BASE_BOULDERS + 1; i++) {
int goodID = SecretBase_GetGoodIDAtIndex(secretBase, i);
for (int i = 0; i < MAX_SECRET_BASE_GOODS; i++) {
enum Good goodID = SecretBase_GetGoodIDAtIndex(secretBase, i);
if (goodID == UG_GOOD_NONE) {
continue;
@ -2490,7 +2490,7 @@ static int SecretBases_GetPlacedGoodAtCoordinates(SecretBase *secretBase, int xW
return UG_GOOD_NONE;
}
static int SecretBases_GetTrapIDFromGoodID(int goodID)
static enum Trap SecretBases_GetTrapIDFromGoodID(enum Good goodID)
{
switch (goodID) {
case UG_GOOD_HOLE_TOOL:
@ -2545,11 +2545,11 @@ BOOL SecretBases_CheckPlayerTriggeredTool(int netID)
SecretBase *secretBase = (SecretBase *)secretBasesEnv->baseInfo[baseOwnerNetID].secretBase;
u8 goodID = SecretBases_GetPlacedGoodAtCoordinates(secretBase, x % SECRET_BASE_WIDTH, z % SECRET_BASE_DEPTH);
int trapID = SecretBases_GetTrapIDFromGoodID(goodID);
enum Trap trapID = SecretBases_GetTrapIDFromGoodID(goodID);
if (trapID != TRAP_NONE) {
secretBasesEnv->playerAffectedByTool[netID] = TRUE;
UndergroundTraps_HandleTriggeredTool(netID, NETID_NONE, trapID, x, z, dir);
Traps_HandleTriggeredTool(netID, NETID_NONE, trapID, x, z, dir);
return TRUE;
}
@ -2645,7 +2645,7 @@ BOOL SecretBases_RemovePlayerFromBase(int netID, BOOL forceExit)
UndergroundRecords_ForceExitTrainerCase();
UndergroundTalk_ExitConversation();
UndergroundMan_ForceEndCurrentSysTask();
UndergroundTraps_ForceEndCurrentTrapEffectClient(CommSys_CurNetId(), FALSE);
Traps_ForceEndCurrentTrapEffectClient(CommSys_CurNetId(), FALSE);
x = secretBasesEnv->currentBaseReturnXCoord;
z = secretBasesEnv->currentBaseReturnZCoord;

583
src/underground/spheres.c Normal file
View File

@ -0,0 +1,583 @@
#include "underground/spheres.h"
#include <nitro.h>
#include <string.h>
#include "generated/game_records.h"
#include "generated/sphere_types.h"
#include "struct_defs/underground.h"
#include "field/field_system.h"
#include "overlay005/ov5_021F575C.h"
#include "underground/manager.h"
#include "underground/menus.h"
#include "underground/mining.h"
#include "underground/text_printer.h"
#include "comm_player_manager.h"
#include "communication_system.h"
#include "field_system.h"
#include "game_records.h"
#include "heap.h"
#include "message.h"
#include "sound_playback.h"
#include "string_gf.h"
#include "string_template.h"
#include "sys_task.h"
#include "sys_task_manager.h"
#include "system_flags.h"
#include "terrain_collision_manager.h"
#include "unk_0202854C.h"
#include "vars_flags.h"
#include "res/text/bank/underground_common.h"
typedef struct BuriedSphere {
u16 x;
u16 z;
u8 initialSize;
u8 growth;
u8 type;
} BuriedSphere;
typedef struct SphereRadarContext {
u8 unused;
u16 timer;
} SphereRadarContext;
typedef struct SpheresEnv {
BuriedSphere buriedSpheres[MAX_BURIED_SPHERES];
BuriedSphere *buriedSpheresByCoordinates[MAX_BURIED_SPHERES];
u8 padding[16];
SysTask *sphereRadarTask;
SphereRadarContext *sphereRadarContext;
FieldSystem *fieldSystem;
u8 retrievedSpheres[MAX_CONNECTED_PLAYERS];
int sparkleTimer;
u8 padding2[2];
u8 disableBuriedSphereSparkles;
} SpheresEnv;
static void Spheres_RemoveBuriedSphere(BuriedSphere *sphere);
static void Spheres_AddBuriedSphere(BuriedSphere *sphere);
static void Spheres_AddBuriedSphereToCoordinatesOrdering(BuriedSphere *sphere);
static SpheresEnv *spheresEnv = NULL;
static void Spheres_ResumeFieldSystem(int unused)
{
CommPlayerMan_ResumeFieldSystem();
}
static void Spheres_PrintSphereGrowth(int growth)
{
if (growth > 0) {
UndergroundTextPrinter_SetTwoDigitNumberWithIndex(UndergroundMan_GetCommonTextPrinter(), 0, growth);
UndergroundTextPrinter_PrintText(UndergroundMan_GetCommonTextPrinter(), UndergroundCommon_Text_ItsSizeGrewBiggerBy, TRUE, Spheres_ResumeFieldSystem);
} else {
Spheres_ResumeFieldSystem(growth);
}
}
void SpheresEnv_Init(void *dest, FieldSystem *fieldSystem)
{
if (spheresEnv) {
return;
}
spheresEnv = dest;
MI_CpuFill8(spheresEnv, 0, sizeof(SpheresEnv));
spheresEnv->fieldSystem = fieldSystem;
Underground *underground = SaveData_GetUnderground(FieldSystem_GetSaveData(fieldSystem));
for (int i = 0; i < MAX_BURIED_SPHERES; i++) {
spheresEnv->buriedSpheres[i].type = Underground_GetBuriedSphereTypeAtIndex(underground, i);
spheresEnv->buriedSpheres[i].x = Underground_GetBuriedSphereXCoordAtIndex(underground, i);
spheresEnv->buriedSpheres[i].z = Underground_GetBuriedSphereZCoordAtIndex(underground, i);
spheresEnv->buriedSpheres[i].initialSize = Underground_GetBuriedSphereInitialSizeAtIndex(underground, i);
spheresEnv->buriedSpheres[i].growth = Underground_GetBuriedSphereGrowthAtIndex(underground, i);
if (spheresEnv->buriedSpheres[i].type != SPHERE_NONE) {
Spheres_AddBuriedSphereToCoordinatesOrdering(&spheresEnv->buriedSpheres[i]);
}
}
}
static void Spheres_SaveBuriedSpheres(void)
{
Underground *underground = SaveData_GetUnderground(FieldSystem_GetSaveData(spheresEnv->fieldSystem));
for (int i = 0; i < MAX_BURIED_SPHERES; i++) {
Underground_SaveBuriedSphere(underground, spheresEnv->buriedSpheres[i].type, i, spheresEnv->buriedSpheres[i].x, spheresEnv->buriedSpheres[i].z, spheresEnv->buriedSpheres[i].initialSize, spheresEnv->buriedSpheres[i].growth);
}
}
int SpheresEnv_Size(void)
{
return sizeof(SpheresEnv);
}
void Spheres_DisableBuriedSphereSparkles(void)
{
spheresEnv->disableBuriedSphereSparkles = TRUE;
}
void Spheres_EnableBuriedSphereSparkles(void)
{
spheresEnv->disableBuriedSphereSparkles = FALSE;
}
void SpheresEnv_Free(void)
{
if (spheresEnv) {
Heap_Free(spheresEnv);
spheresEnv = NULL;
}
}
void Spheres_AdvanceBuriedSphereSparkleTimer(void)
{
if (spheresEnv->disableBuriedSphereSparkles) {
return;
}
spheresEnv->sparkleTimer++;
if (spheresEnv->sparkleTimer >= MAX_BURIED_SPHERES * 20) {
spheresEnv->sparkleTimer = 0;
}
if ((spheresEnv->sparkleTimer % 20) == 10) {
int index = spheresEnv->sparkleTimer / 20;
int x = Spheres_GetBuriedSphereXCoordAtIndex(index);
int z = Spheres_GetBuriedSphereZCoordAtIndex(index);
if (x != 0 && z != 0) {
ov5_DisplayBuriedSphereSparkle(spheresEnv->fieldSystem, x, z);
}
}
}
static Coordinates *Spheres_GetCoordinatesOfBuriedSphereAtOrderedIndex(Coordinates *coordinates, int index)
{
if (spheresEnv->buriedSpheresByCoordinates[index] == NULL) {
return NULL;
}
coordinates->x = spheresEnv->buriedSpheresByCoordinates[index]->x;
coordinates->z = spheresEnv->buriedSpheresByCoordinates[index]->z;
return coordinates;
}
static void Spheres_AddBuriedSphereToCoordinatesOrdering(BuriedSphere *sphere)
{
Coordinates coordinates = {
.x = sphere->x,
.z = sphere->z
};
UndergroundMan_InitCoordsOrderingState(MAX_BURIED_SPHERES, Spheres_GetCoordinatesOfBuriedSphereAtOrderedIndex);
int index = UndergroundMan_CalcCoordsIndexInsert(&coordinates);
GF_ASSERT(index < MAX_BURIED_SPHERES);
for (int i = MAX_BURIED_SPHERES - 1; i > index; i--) {
spheresEnv->buriedSpheresByCoordinates[i] = spheresEnv->buriedSpheresByCoordinates[i - 1];
}
spheresEnv->buriedSpheresByCoordinates[index] = sphere;
}
static void Spheres_RecalculateCoordinatesOrdering(BuriedSphere *unused)
{
MI_CpuClear8(spheresEnv->buriedSpheresByCoordinates, sizeof(u32) * MAX_BURIED_SPHERES);
for (int i = 0; i < MAX_BURIED_SPHERES; i++) {
if (spheresEnv->buriedSpheres[i].type != SPHERE_NONE) {
Spheres_AddBuriedSphereToCoordinatesOrdering(&spheresEnv->buriedSpheres[i]);
}
}
}
static BuriedSphere *Spheres_FindEmptyBuriedSphereSlot(BuriedSphere *spherePtr)
{
for (int i = 0; i < MAX_BURIED_SPHERES; i++) {
if (spherePtr->type == SPHERE_NONE) {
return spherePtr;
}
spherePtr++;
}
return NULL;
}
static BuriedSphere *Spheres_Dummy(BuriedSphere *sphere)
{
return sphere;
}
static BuriedSphere *Spheres_GetBuriedSphereAtCoordinates(int x, int z)
{
Coordinates coordinates = {
.x = x,
.z = z
};
UndergroundMan_InitCoordsOrderingState(MAX_BURIED_SPHERES, Spheres_GetCoordinatesOfBuriedSphereAtOrderedIndex);
int index = UndergroundMan_CalcCoordsIndexGet(&coordinates);
if (index == -1) {
return NULL;
}
return spheresEnv->buriedSpheresByCoordinates[index];
}
void Spheres_ProcessRetrieveBuriedSphereRequest(int unused, int unused2, void *data, void *unused3)
{
u8 *netID = data;
int curNetID = CommSys_CurNetId();
int numberToPrint;
if (*netID == curNetID) {
int x = CommPlayer_GetXInFrontOfPlayer(curNetID);
int z = CommPlayer_GetZInFrontOfPlayer(curNetID);
BuriedSphere *sphere = Spheres_GetBuriedSphereAtCoordinates(x, z);
if (sphere) {
CommPlayerMan_PauseFieldSystem();
if (UndergroundInventory_TryAddSphere(sphere->type, sphere->initialSize + sphere->growth)) {
spheresEnv->retrievedSpheres[curNetID] = sphere->type;
Sound_PlayEffect(SEQ_SE_DP_PIRORIRO2);
numberToPrint = MAX_SPHERE_SIZE;
if (sphere->initialSize + sphere->growth < MAX_SPHERE_SIZE) {
numberToPrint = sphere->initialSize + sphere->growth;
}
UndergroundTextPrinter_SetTwoDigitNumberWithIndex(UndergroundMan_GetCommonTextPrinter(), 1, numberToPrint);
UndergroundTextPrinter_SetUndergroundItemNameWithArticleWithIndex(UndergroundMan_GetCommonTextPrinter(), 2, sphere->type);
numberToPrint = sphere->growth;
if ((numberToPrint + sphere->initialSize) > MAX_SPHERE_SIZE) {
numberToPrint = MAX_SPHERE_SIZE - sphere->initialSize;
}
UndergroundTextPrinter_PrintTextWithCallbackParam(UndergroundMan_GetCommonTextPrinter(), UndergroundCommon_Text_YouObtainedSphere, TRUE, Spheres_PrintSphereGrowth, numberToPrint);
UndergroundTextPrinter_SetDummyField(UndergroundMan_GetCommonTextPrinter());
Spheres_RemoveBuriedSphere(sphere);
Spheres_SaveBuriedSpheres();
} else {
UndergroundTextPrinter_PrintText(UndergroundMan_GetCommonTextPrinter(), UndergroundCommon_Text_NoRoomForSphere, TRUE, Spheres_ResumeFieldSystem);
}
}
}
}
void TouchRadarSearch_Init(TouchRadarSearchContext *ctx, int radius)
{
ctx->radius = radius;
ctx->iterator = 0;
}
BOOL TouchRadarSearch_GetNextCoords(TouchRadarSearchContext *ctx, TouchRadarCoordinates *out)
{
int i;
int iterator = ctx->iterator;
int x, z;
for (i = 0; i <= ctx->radius; i++) {
if (iterator - i * 4 > 0) {
iterator -= i * 4;
} else {
if (iterator != 0) {
iterator--;
}
if (iterator < i * 2) {
z = i - iterator;
} else {
z = iterator - i * 3;
}
if (iterator < i) {
x = iterator;
} else if (iterator < i * 3) {
x = i * 3 - (iterator + i);
} else {
x = -i + (iterator - i * 3);
}
out->x = x;
out->z = z;
ctx->iterator++;
return TRUE;
}
}
return FALSE;
}
void Spheres_TryBurySphere(enum SphereType sphereType, int sphereSize, int x, int z)
{
BOOL success = FALSE;
BuriedSphere sphere;
sphere.x = x;
sphere.z = z;
sphere.initialSize = sphereSize;
sphere.type = sphereType;
sphere.growth = 0;
if (UndergroundMan_AreCoordinatesInSecretBase(x, z)) {
UndergroundTextPrinter_PrintText(UndergroundMan_GetCommonTextPrinter(), UndergroundCommon_Text_CantBuryInSecretBase, FALSE, NULL);
return;
}
if (CommPlayer_CheckNPCCollision(x, z)) {
UndergroundTextPrinter_PrintText(UndergroundMan_GetCommonTextPrinter(), UndergroundCommon_Text_CantBePlacedThere, FALSE, NULL);
return;
}
if (TerrainCollisionManager_CheckCollision(spheresEnv->fieldSystem, x, z)) {
UndergroundTextPrinter_PrintText(UndergroundMan_GetCommonTextPrinter(), UndergroundCommon_Text_CantBuryInWall, FALSE, NULL);
return;
}
BuriedSphere *existingSphere = Spheres_GetBuriedSphereAtCoordinates(x, z);
if (existingSphere) {
if (existingSphere->type == sphere.type) {
if (existingSphere->initialSize > sphereSize) {
existingSphere->initialSize = existingSphere->initialSize + (sphereSize / 5) + 1;
} else {
existingSphere->initialSize = sphereSize + (existingSphere->initialSize / 5) + 1;
}
if (existingSphere->initialSize > MAX_SPHERE_SIZE) {
existingSphere->initialSize = MAX_SPHERE_SIZE;
}
success = TRUE;
} else {
UndergroundTextPrinter_PrintText(UndergroundMan_GetCommonTextPrinter(), UndergroundCommon_Text_SomethingAlreadyBuried, FALSE, NULL);
}
} else {
Spheres_AddBuriedSphere(&sphere);
success = TRUE;
}
if (success) {
UndergroundTextPrinter_SetUndergroundItemName(UndergroundMan_GetCommonTextPrinter(), 0, sphereType);
UndergroundTextPrinter_SetTwoDigitNumberWithIndex(UndergroundMan_GetCommonTextPrinter(), 1, sphereSize);
UndergroundTextPrinter_PrintText(UndergroundMan_GetCommonTextPrinter(), UndergroundCommon_Text_SphereWasBuried, FALSE, NULL);
UndergroundMenu_RemoveSelectedSphere(sphereType);
Sound_PlayEffect(SEQ_SE_DP_SUTYA);
SystemFlag_SetSphereAcquired(SaveData_GetVarsFlags(spheresEnv->fieldSystem->saveData));
GameRecords_IncrementRecordValue(SaveData_GetGameRecords(spheresEnv->fieldSystem->saveData), RECORD_SPHERES_BURIED);
ov5_DisplayBuriedSphereSparkle(spheresEnv->fieldSystem, x, z);
}
}
static void Spheres_RemoveBuriedSphere(BuriedSphere *sphere)
{
int index = -1, i;
for (i = 0; i < MAX_BURIED_SPHERES; i++) {
if (sphere == &spheresEnv->buriedSpheres[i]) {
index = i;
break;
}
}
GF_ASSERT(index != -1);
for (; i < MAX_BURIED_SPHERES - 1; i++) {
MI_CpuCopy8(&spheresEnv->buriedSpheres[i + 1], &spheresEnv->buriedSpheres[i], sizeof(BuriedSphere));
}
spheresEnv->buriedSpheres[MAX_BURIED_SPHERES - 1].type = SPHERE_NONE;
Spheres_RecalculateCoordinatesOrdering(sphere);
}
static void Spheres_AddBuriedSphere(BuriedSphere *sphere)
{
BuriedSphere *emptySlot = Spheres_FindEmptyBuriedSphereSlot(spheresEnv->buriedSpheres);
if (emptySlot == NULL) {
emptySlot = Spheres_Dummy(spheresEnv->buriedSpheres);
// bug: emptySlot will still be null and this function will fail a gf_assert
Spheres_RemoveBuriedSphere(emptySlot);
emptySlot = Spheres_FindEmptyBuriedSphereSlot(spheresEnv->buriedSpheres);
GF_ASSERT(emptySlot);
}
MI_CpuCopy8(sphere, emptySlot, sizeof(BuriedSphere));
Spheres_AddBuriedSphereToCoordinatesOrdering(emptySlot);
Spheres_SaveBuriedSpheres();
}
BOOL Spheres_IsMiningItemSphere(int miningItemID)
{
if (miningItemID != 0 && miningItemID < MINING_SPHERES_MAX) {
return TRUE;
}
return FALSE;
}
BOOL Spheres_IsBuriedSphereAtCoordinates(int x, int z)
{
if (Spheres_GetBuriedSphereAtCoordinates(x, z)) {
return TRUE;
}
return FALSE;
}
int Spheres_GetBuriedSphereXCoordAtIndex(int index)
{
if (spheresEnv && (spheresEnv->buriedSpheres[index].type != SPHERE_NONE)) {
return spheresEnv->buriedSpheres[index].x;
}
return 0;
}
int Spheres_GetBuriedSphereZCoordAtIndex(int index)
{
if (spheresEnv && (spheresEnv->buriedSpheres[index].type != SPHERE_NONE)) {
return spheresEnv->buriedSpheres[index].z;
}
return 0;
}
BOOL Spheres_GetQueuedMessage(String *dest)
{
int netID;
StringTemplate *template = NULL;
String *fmtString = NULL;
BOOL isMessageQueued = FALSE;
if (!spheresEnv) {
return FALSE;
}
for (netID = 0; netID < MAX_CONNECTED_PLAYERS; netID++) {
if (spheresEnv->retrievedSpheres[netID] != SPHERE_NONE) {
template = StringTemplate_Default(HEAP_ID_FIELD1);
fmtString = String_Init(100, HEAP_ID_FIELD1);
StringTemplate_SetUndergroundItemNameWithArticle(template, 2, spheresEnv->retrievedSpheres[netID]);
StringTemplate_CapitalizeArgAtIndex(template, 2);
MessageLoader_GetString(UndergroundTextPrinter_GetMessageLoader(UndergroundMan_GetCommonTextPrinter()), UndergroundCommon_Text_ItemWasObtainedExclamationPoint, fmtString);
StringTemplate_Format(template, dest, fmtString);
spheresEnv->retrievedSpheres[netID] = SPHERE_NONE;
isMessageQueued = TRUE;
break;
}
}
if (fmtString) {
String_Free(fmtString);
}
if (template) {
StringTemplate_Free(template);
}
return isMessageQueued;
}
int Spheres_SpawnMiningSpotsNearBuriedSpheres(MATHRandContext16 *rand)
{
Underground *underground = SaveData_GetUnderground(FieldSystem_GetSaveData(spheresEnv->fieldSystem));
int i;
for (i = 0; i < MAX_BURIED_SPHERES; i++) {
if (Underground_GetBuriedSphereTypeAtIndex(underground, i) != SPHERE_NONE) {
int x = Underground_GetBuriedSphereXCoordAtIndex(underground, i);
int z = Underground_GetBuriedSphereZCoordAtIndex(underground, i);
Mining_SpawnMiningSpotNearBuriedSphere(x, z, rand);
}
}
return i;
}
static void SphereRadar_TimerTask(SysTask *sysTask, void *data)
{
SphereRadarContext *ctx = data;
ctx->timer++;
if (ctx->timer > MAX_BURIED_SPHERES) {
Sound_PlayEffect(SEQ_SE_PL_UG_006);
ctx->timer = 0;
}
}
void SphereRadar_Start(void)
{
GF_ASSERT(!spheresEnv->sphereRadarContext);
GF_ASSERT(!spheresEnv->sphereRadarTask);
SphereRadarContext *ctx = Heap_AllocAtEnd(HEAP_ID_FIELD2, sizeof(SphereRadarContext));
MI_CpuFill8(ctx, 0, sizeof(SphereRadarContext));
ctx->timer = MAX_BURIED_SPHERES;
spheresEnv->sphereRadarContext = ctx;
spheresEnv->sphereRadarTask = SysTask_Start(SphereRadar_TimerTask, ctx, 100);
}
void SphereRadar_Exit(void)
{
if (spheresEnv->sphereRadarTask) {
SysTask_Done(spheresEnv->sphereRadarTask);
Heap_Free(spheresEnv->sphereRadarContext);
spheresEnv->sphereRadarTask = NULL;
spheresEnv->sphereRadarContext = NULL;
}
}
int SphereRadar_GetXCoordOfBuriedSphere(int radarIndex)
{
if (spheresEnv && spheresEnv->sphereRadarContext) {
// bug: only the first 66 buried spheres can show up on the radar
int index = spheresEnv->sphereRadarContext->timer / 2;
index = (index + radarIndex) % MAX_BURIED_SPHERES;
return Spheres_GetBuriedSphereXCoordAtIndex(index);
}
return 0;
}
int SphereRadar_GetZCoordOfBuriedSphere(int radarIndex)
{
if (spheresEnv && spheresEnv->sphereRadarContext) {
// bug: only the first 66 buried spheres can show up on the radar
int index = spheresEnv->sphereRadarContext->timer / 2;
index = (index + radarIndex) % MAX_BURIED_SPHERES;
return Spheres_GetBuriedSphereZCoordAtIndex(index);
}
return 0;
}

View File

@ -1,4 +1,4 @@
#include "overlay023/underground_text_printer.h"
#include "underground/text_printer.h"
#include <nitro.h>
#include <string.h>
@ -15,9 +15,9 @@
#include "trainer_info.h"
enum EraseMessageBoxType {
CLEAR_MESSAGE_BOX,
CLEAR_MESSAGE_BOX = 0,
CLEAR_WINDOW,
CLEAR_WINDOW_SCHEDULE
CLEAR_WINDOW_SCHEDULE,
};
static void UndergroundTextPrinter_EraseMessageBox(UndergroundTextPrinter *textPrinter, enum EraseMessageBoxType type);
@ -112,17 +112,17 @@ MessageLoader *UndergroundTextPrinter_GetMessageLoader(UndergroundTextPrinter *t
return textPrinter->msgLoader;
}
static void UndergroundTextPrinter_SysTaskEraseMessageBoxOnAPress(SysTask *sysTask, void *printer)
static void UndergroundTextPrinter_EraseMessageBoxOnAPressTask(SysTask *sysTask, void *data)
{
UndergroundTextPrinter *textPrinter = printer;
UndergroundTextPrinter *textPrinter = data;
if (textPrinter->printerID < MAX_TEXT_PRINTERS) {
if (Text_IsPrinterActive(textPrinter->printerID) != FALSE) {
if (Text_IsPrinterActive(textPrinter->printerID)) {
return;
}
}
if (gSystem.pressedKeys & PAD_BUTTON_A) {
if (JOY_NEW(PAD_BUTTON_A)) {
UndergroundTextPrinter_EraseMessageBoxWindow(textPrinter);
}
}
@ -153,7 +153,7 @@ static int UndergroundTextPrinter_AddPrinter(UndergroundTextPrinter *textPrinter
Window_DrawMessageBoxWithScrollCursor(&textPrinter->window, TRUE, textPrinter->messageBoxTile, 10);
if (sysTaskManaged) {
textPrinter->sysTask = SysTask_Start(UndergroundTextPrinter_SysTaskEraseMessageBoxOnAPress, textPrinter, 100);
textPrinter->sysTask = SysTask_Start(UndergroundTextPrinter_EraseMessageBoxOnAPressTask, textPrinter, 100);
}
textPrinter->messageBoxActive = TRUE;
@ -276,21 +276,21 @@ void UndergroundTextPrinter_SetUndergroundAnswer(UndergroundTextPrinter *textPri
textPrinter->formattingNeeded = TRUE;
}
void UndergroundTextPrinter_SetUndergroundAnswerWithIndex(UndergroundTextPrinter *textPrinter, int idx, int answer)
void UndergroundTextPrinter_SetUndergroundAnswerWithIndex(UndergroundTextPrinter *textPrinter, int index, int answer)
{
StringTemplate_SetUndergroundAnswer(textPrinter->template, idx, answer);
StringTemplate_SetUndergroundAnswer(textPrinter->template, index, answer);
textPrinter->formattingNeeded = TRUE;
}
void UndergroundTextPrinter_SetUndergroundGoodsName(UndergroundTextPrinter *textPrinter, int goods)
void UndergroundTextPrinter_SetUndergroundGoodsName(UndergroundTextPrinter *textPrinter, enum Good goodID)
{
StringTemplate_SetUndergroundGoodsName(textPrinter->template, 2, goods);
StringTemplate_SetUndergroundGoodsName(textPrinter->template, 2, goodID);
textPrinter->formattingNeeded = TRUE;
}
void UndergroundTextPrinter_SetSingleDigitNumber(UndergroundTextPrinter *textPrinter, int idx, int num)
void UndergroundTextPrinter_SetSingleDigitNumber(UndergroundTextPrinter *textPrinter, int index, int num)
{
StringTemplate_SetNumber(textPrinter->template, idx, num, 1, PADDING_MODE_NONE, CHARSET_MODE_EN);
StringTemplate_SetNumber(textPrinter->template, index, num, 1, PADDING_MODE_NONE, CHARSET_MODE_EN);
textPrinter->formattingNeeded = TRUE;
}
@ -300,9 +300,9 @@ void UndergroundTextPrinter_SetTwoDigitNumber(UndergroundTextPrinter *textPrinte
textPrinter->formattingNeeded = TRUE;
}
void UndergroundTextPrinter_SetTwoDigitNumberWithIndex(UndergroundTextPrinter *textPrinter, int idx, int num)
void UndergroundTextPrinter_SetTwoDigitNumberWithIndex(UndergroundTextPrinter *textPrinter, int index, int num)
{
StringTemplate_SetNumber(textPrinter->template, idx, num, 2, PADDING_MODE_NONE, CHARSET_MODE_EN);
StringTemplate_SetNumber(textPrinter->template, index, num, 2, PADDING_MODE_NONE, CHARSET_MODE_EN);
textPrinter->formattingNeeded = TRUE;
}
@ -312,39 +312,39 @@ void UndergroundTextPrinter_SetNumber(UndergroundTextPrinter *textPrinter, int n
textPrinter->formattingNeeded = TRUE;
}
void UndergroundTextPrinter_SetUndergroundItemName(UndergroundTextPrinter *textPrinter, int idx, int item)
void UndergroundTextPrinter_SetUndergroundItemName(UndergroundTextPrinter *textPrinter, int index, int itemID)
{
StringTemplate_SetUndergroundItemName(textPrinter->template, idx, item);
StringTemplate_SetUndergroundItemName(textPrinter->template, index, itemID);
textPrinter->formattingNeeded = TRUE;
}
void UndergroundTextPrinter_SetUndergroundTrapNameWithIndex(UndergroundTextPrinter *textPrinter, int idx, int trap)
void UndergroundTextPrinter_SetUndergroundTrapNameWithIndex(UndergroundTextPrinter *textPrinter, int index, enum Trap trapID)
{
StringTemplate_SetUndergroundTrapName(textPrinter->template, idx, trap);
StringTemplate_SetUndergroundTrapName(textPrinter->template, index, trapID);
textPrinter->formattingNeeded = TRUE;
}
void UndergroundTextPrinter_SetGoodNameWithIndex(UndergroundTextPrinter *textPrinter, int idx, int goodID)
void UndergroundTextPrinter_SetGoodNameWithIndex(UndergroundTextPrinter *textPrinter, int index, enum Good goodID)
{
StringTemplate_SetUndergroundGoodsName(textPrinter->template, idx, goodID);
StringTemplate_SetUndergroundGoodsName(textPrinter->template, index, goodID);
textPrinter->formattingNeeded = TRUE;
}
void UndergroundTextPrinter_SetUndergroundItemNameWithArticleWithIndex(UndergroundTextPrinter *textPrinter, int idx, int item)
void UndergroundTextPrinter_SetUndergroundItemNameWithArticleWithIndex(UndergroundTextPrinter *textPrinter, int index, int itemID)
{
StringTemplate_SetUndergroundItemNameWithArticle(textPrinter->template, idx, item);
StringTemplate_SetUndergroundItemNameWithArticle(textPrinter->template, index, itemID);
textPrinter->formattingNeeded = TRUE;
}
void UndergroundTextPrinter_SetUndergroundTrapNameWithArticle(UndergroundTextPrinter *textPrinter, int idx, int trap)
void UndergroundTextPrinter_SetUndergroundTrapNameWithArticle(UndergroundTextPrinter *textPrinter, int index, enum Trap trapID)
{
StringTemplate_SetUndergroundTrapNameWithArticle(textPrinter->template, idx, trap);
StringTemplate_SetUndergroundTrapNameWithArticle(textPrinter->template, index, trapID);
textPrinter->formattingNeeded = TRUE;
}
void UndergroundTextPrinter_CapitalizeArgAtIndex(UndergroundTextPrinter *textPrinter, int idx)
void UndergroundTextPrinter_CapitalizeArgAtIndex(UndergroundTextPrinter *textPrinter, int index)
{
StringTemplate_CapitalizeArgAtIndex(textPrinter->template, idx);
StringTemplate_CapitalizeArgAtIndex(textPrinter->template, index);
}
void UndergroundTextPrinter_RemovePrinter(UndergroundTextPrinter *textPrinter)

View File

@ -1,4 +1,4 @@
#include "overlay023/underground_top_screen.h"
#include "underground/top_screen.h"
#include <nitro.h>
#include <string.h>
@ -8,8 +8,8 @@
#include "struct_decls/struct_0205E884_decl.h"
#include "field/field_system.h"
#include "overlay023/struct_underground_top_screen_context_decl.h"
#include "overlay023/underground_manager.h"
#include "underground/manager.h"
#include "underground/struct_underground_top_screen_context_decl.h"
#include "bg_window.h"
#include "comm_player_manager.h"
@ -100,8 +100,8 @@ struct UndergroundTopScreenContext_t {
BgConfig *bgConfig;
SpriteList *spriteList;
G2dRenderer g2dRenderer;
SpriteResourceCollection *spriteResourceCollection[4];
SpriteResource *spriteResources[4];
SpriteResourceCollection *spriteResourceCollection[MAX_SPRITE_RESOURCE_GEN4];
SpriteResource *spriteResources[MAX_SPRITE_RESOURCE_GEN4];
SpriteResourcesHeader resourceData;
Sprite *playerMarkerSprites[MAX_CONNECTED_PLAYERS];
Sprite *otherMarkerSprites[MAX_RADAR_BLIPS + 1];
@ -232,7 +232,7 @@ static void UndergroundTopScreen_Task(SysTask *sysTask, void *data)
SpriteTransfer_ResetCharTransfer(ctx->spriteResources[SPRITE_RESOURCE_CHAR]);
SpriteTransfer_ResetPlttTransfer(ctx->spriteResources[SPRITE_RESOURCE_PLTT]);
for (int resourceType = SPRITE_RESOURCE_CHAR; resourceType < SPRITE_RESOURCE_ANIM + 1; resourceType++) {
for (int resourceType = SPRITE_RESOURCE_CHAR; resourceType < MAX_SPRITE_RESOURCE_GEN4; resourceType++) {
SpriteResourceCollection_Delete(ctx->spriteResourceCollection[resourceType]);
}
@ -474,7 +474,7 @@ static void UndergroundMap_InitSpriteResources(UndergroundTopScreenContext *ctx)
{
ctx->spriteList = SpriteList_InitRendering(MAX_CONNECTED_PLAYERS + MAX_RADAR_BLIPS + 1, &ctx->g2dRenderer, HEAP_ID_FIELD1);
for (int resourceType = SPRITE_RESOURCE_CHAR; resourceType < SPRITE_RESOURCE_ANIM + 1; resourceType++) {
for (int resourceType = SPRITE_RESOURCE_CHAR; resourceType < MAX_SPRITE_RESOURCE_GEN4; resourceType++) {
ctx->spriteResourceCollection[resourceType] = SpriteResourceCollection_New(1, resourceType, HEAP_ID_FIELD1);
}

View File

@ -0,0 +1,63 @@
#include "underground/trap_prices.h"
#include <nitro.h>
#include <string.h>
#include "generated/sphere_types.h"
#include "generated/traps.h"
#include "underground/defs.h"
// TODO: make this error if it doesn't contain an entry for every trap
static const SpherePrice sTrapPrices[] = {
[TRAP_NONE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[TRAP_MOVE_UP] = { .sphereType = SPHERE_BLUE, .minSize = 3, .maxSize = 6 },
[TRAP_MOVE_RIGHT] = { .sphereType = SPHERE_RED, .minSize = 3, .maxSize = 6 },
[TRAP_MOVE_DOWN] = { .sphereType = SPHERE_BLUE, .minSize = 3, .maxSize = 6 },
[TRAP_MOVE_LEFT] = { .sphereType = SPHERE_RED, .minSize = 3, .maxSize = 6 },
[TRAP_HURL_UP] = { .sphereType = SPHERE_BLUE, .minSize = 12, .maxSize = 15 },
[TRAP_HURL_RIGHT] = { .sphereType = SPHERE_RED, .minSize = 12, .maxSize = 15 },
[TRAP_HURL_DOWN] = { .sphereType = SPHERE_BLUE, .minSize = 12, .maxSize = 15 },
[TRAP_HURL_LEFT] = { .sphereType = SPHERE_RED, .minSize = 12, .maxSize = 15 },
[TRAP_WARP_DUMMY] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[TRAP_HI_WARP_DUMMY] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[TRAP_HOLE] = { .sphereType = SPHERE_PRISM, .minSize = 3, .maxSize = 6 },
[TRAP_PIT] = { .sphereType = SPHERE_PRISM, .minSize = 12, .maxSize = 15 },
[TRAP_REVERSE] = { .sphereType = SPHERE_PALE, .minSize = 10, .maxSize = 12 },
[TRAP_CONFUSE] = { .sphereType = SPHERE_PALE, .minSize = 10, .maxSize = 12 },
[TRAP_RUN_DUMMY] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[TRAP_FADE_DUMMY] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[TRAP_SLOW_DUMMY] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[TRAP_SMOKE] = { .sphereType = SPHERE_RED, .minSize = 5, .maxSize = 7 },
[TRAP_BIG_SMOKE] = { .sphereType = SPHERE_RED, .minSize = 12, .maxSize = 16 },
[TRAP_ROCK] = { .sphereType = SPHERE_BLUE, .minSize = 3, .maxSize = 6 },
[TRAP_ROCKFALL] = { .sphereType = SPHERE_BLUE, .minSize = 8, .maxSize = 15 },
[TRAP_FOAM] = { .sphereType = SPHERE_BLUE, .minSize = 5, .maxSize = 7 },
[TRAP_BUBBLE] = { .sphereType = SPHERE_BLUE, .minSize = 12, .maxSize = 16 },
[TRAP_ALERT_1] = { .sphereType = SPHERE_PALE, .minSize = 5, .maxSize = 9 },
[TRAP_ALERT_2] = { .sphereType = SPHERE_PALE, .minSize = 5, .maxSize = 9 },
[TRAP_ALERT_3] = { .sphereType = SPHERE_PALE, .minSize = 5, .maxSize = 9 },
[TRAP_ALERT_4] = { .sphereType = SPHERE_PALE, .minSize = 5, .maxSize = 9 },
[TRAP_LEAF] = { .sphereType = SPHERE_GREEN, .minSize = 15, .maxSize = 19 },
[TRAP_FLOWER] = { .sphereType = SPHERE_GREEN, .minSize = 30, .maxSize = 40 },
[TRAP_EMBER] = { .sphereType = SPHERE_RED, .minSize = 5, .maxSize = 9 },
[TRAP_FIRE] = { .sphereType = SPHERE_RED, .minSize = 20, .maxSize = 30 },
[TRAP_RADAR_DUMMY] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[TRAP_DIGGER_DRILL] = { .sphereType = RANDOM_SPHERE_TYPE, .minSize = 15, .maxSize = 20 }
};
// params need to be const to match
const u8 Trap_GetSpherePriceType(const enum Trap trapID)
{
return sTrapPrices[trapID].sphereType;
}
const u8 Trap_GetSpherePriceMinSize(const enum Trap trapID)
{
return sTrapPrices[trapID].minSize;
}
const u8 Trap_GetSpherePriceMaxSize(const enum Trap trapID)
{
return sTrapPrices[trapID].maxSize;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,88 @@
#include "underground/treasure_prices.h"
#include <nitro.h>
#include <string.h>
#include "generated/sphere_types.h"
#include "underground/defs.h"
#include "underground/mining.h"
// TODO: make this error if it doesn't contain an entry for every treasure
static const SpherePrice sTreasurePrices[] = {
[MINING_TREASURE_NONE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_SMALL_PRISM_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_SMALL_PALE_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_SMALL_RED_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_SMALL_BLUE_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_SMALL_GREEN_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_LARGE_PRISM_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_LARGE_PALE_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_LARGE_RED_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_LARGE_BLUE_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_LARGE_GREEN_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_TREASURE_OVAL_STONE] = { .sphereType = SPHERE_PALE, .minSize = 15, .maxSize = 20 },
[MINING_TREASURE_ODD_KEYSTONE] = { .sphereType = SPHERE_PRISM, .minSize = 50, .maxSize = 60 },
[MINING_TREASURE_SUN_STONE] = { .sphereType = SPHERE_RED, .minSize = 25, .maxSize = 35 },
[MINING_TREASURE_STAR_PIECE] = { .sphereType = SPHERE_PALE, .minSize = 35, .maxSize = 45 },
[MINING_TREASURE_MOON_STONE] = { .sphereType = SPHERE_PALE, .minSize = 25, .maxSize = 35 },
[MINING_TREASURE_HARD_STONE] = { .sphereType = SPHERE_RED, .minSize = 25, .maxSize = 35 },
[MINING_TREASURE_THUNDERSTONE] = { .sphereType = SPHERE_PRISM, .minSize = 25, .maxSize = 35 },
[MINING_TREASURE_EVERSTONE] = { .sphereType = SPHERE_PALE, .minSize = 25, .maxSize = 35 },
[MINING_TREASURE_FIRE_STONE] = { .sphereType = SPHERE_RED, .minSize = 25, .maxSize = 35 },
[MINING_TREASURE_WATER_STONE] = { .sphereType = SPHERE_BLUE, .minSize = 25, .maxSize = 35 },
[MINING_TREASURE_LEAF_STONE] = { .sphereType = SPHERE_GREEN, .minSize = 25, .maxSize = 35 },
[MINING_TREASURE_NUGGET_UNUSED] = { .sphereType = SPHERE_BLUE, .minSize = 0, .maxSize = 0 },
[MINING_TREASURE_HELIX_FOSSIL] = { .sphereType = SPHERE_BLUE, .minSize = 30, .maxSize = 50 },
[MINING_TREASURE_DOME_FOSSIL] = { .sphereType = SPHERE_GREEN, .minSize = 30, .maxSize = 50 },
[MINING_TREASURE_CLAW_FOSSIL] = { .sphereType = SPHERE_BLUE, .minSize = 30, .maxSize = 50 },
[MINING_TREASURE_ROOT_FOSSIL] = { .sphereType = SPHERE_GREEN, .minSize = 30, .maxSize = 50 },
[MINING_TREASURE_OLD_AMBER] = { .sphereType = SPHERE_PRISM, .minSize = 30, .maxSize = 50 },
[MINING_TREASURE_RARE_BONE] = { .sphereType = SPHERE_PALE, .minSize = 25, .maxSize = 35 },
[MINING_TREASURE_REVIVE] = { .sphereType = SPHERE_PALE, .minSize = 5, .maxSize = 10 },
[MINING_TREASURE_MAX_REVIVE] = { .sphereType = SPHERE_PALE, .minSize = 40, .maxSize = 50 },
[MINING_TREASURE_RED_SHARD] = { .sphereType = SPHERE_RED, .minSize = 20, .maxSize = 25 },
[MINING_TREASURE_BLUE_SHARD] = { .sphereType = SPHERE_BLUE, .minSize = 20, .maxSize = 25 },
[MINING_TREASURE_YELLOW_SHARD] = { .sphereType = SPHERE_PRISM, .minSize = 20, .maxSize = 25 },
[MINING_TREASURE_GREEN_SHARD] = { .sphereType = SPHERE_GREEN, .minSize = 20, .maxSize = 25 },
[MINING_TREASURE_HEART_SCALE] = { .sphereType = SPHERE_RED, .minSize = 5, .maxSize = 10 },
[MINING_TREASURE_ARMOR_FOSSIL] = { .sphereType = SPHERE_BLUE, .minSize = 30, .maxSize = 50 },
[MINING_TREASURE_SKULL_FOSSIL] = { .sphereType = SPHERE_GREEN, .minSize = 30, .maxSize = 50 },
[MINING_TREASURE_LIGHT_CLAY] = { .sphereType = SPHERE_PALE, .minSize = 40, .maxSize = 50 },
[MINING_TREASURE_IRON_BALL] = { .sphereType = SPHERE_PRISM, .minSize = 40, .maxSize = 50 },
[MINING_TREASURE_ICY_ROCK] = { .sphereType = SPHERE_PALE, .minSize = 35, .maxSize = 40 },
[MINING_TREASURE_SMOOTH_ROCK] = { .sphereType = SPHERE_PRISM, .minSize = 35, .maxSize = 40 },
[MINING_TREASURE_HEAT_ROCK] = { .sphereType = SPHERE_RED, .minSize = 40, .maxSize = 50 },
[MINING_TREASURE_DAMP_ROCK] = { .sphereType = SPHERE_BLUE, .minSize = 40, .maxSize = 50 },
[MINING_TREASURE_FLAME_PLATE] = { .sphereType = SPHERE_RED, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_SPLASH_PLATE] = { .sphereType = SPHERE_BLUE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_ZAP_PLATE] = { .sphereType = SPHERE_PRISM, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_MEADOW_PLATE] = { .sphereType = SPHERE_GREEN, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_ICICLE_PLATE] = { .sphereType = SPHERE_BLUE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_FIST_PLATE] = { .sphereType = SPHERE_PRISM, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_TOXIC_PLATE] = { .sphereType = SPHERE_PALE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_EARTH_PLATE] = { .sphereType = SPHERE_GREEN, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_SKY_PLATE] = { .sphereType = SPHERE_BLUE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_MIND_PLATE] = { .sphereType = SPHERE_PALE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_INSECT_PLATE] = { .sphereType = SPHERE_GREEN, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_STONE_PLATE] = { .sphereType = SPHERE_PRISM, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_SPOOKY_PLATE] = { .sphereType = SPHERE_PALE, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_DRACO_PLATE] = { .sphereType = SPHERE_RED, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_DREAD_PLATE] = { .sphereType = SPHERE_RED, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_IRON_PLATE] = { .sphereType = SPHERE_PRISM, .minSize = 70, .maxSize = 80 }
};
u8 Treasure_GetSpherePriceType(int treasureID)
{
return sTreasurePrices[treasureID].sphereType;
}
u8 Treasure_GetSpherePriceMinSize(int treasureID)
{
return sTreasurePrices[treasureID].minSize;
}
u8 Treasure_GetSpherePriceMaxSize(int treasureID)
{
return sTreasurePrices[treasureID].maxSize;
}

View File

@ -1,22 +1,23 @@
#include "overlay023/underground_vendors.h"
#include "underground/vendors.h"
#include <nitro.h>
#include <string.h>
#include "constants/field_base_tiles.h"
#include "generated/goods.h"
#include "generated/sphere_types.h"
#include "generated/traps.h"
#include "struct_decls/struct_02061AB4_decl.h"
#include "struct_defs/underground.h"
#include "field/field_system.h"
#include "overlay023/trap_prices.h"
#include "overlay023/treasure_prices.h"
#include "overlay023/underground_item_list_menu.h"
#include "overlay023/underground_manager.h"
#include "overlay023/underground_menu.h"
#include "overlay023/underground_text_printer.h"
#include "underground/item_list_menu.h"
#include "underground/manager.h"
#include "underground/menus.h"
#include "underground/text_printer.h"
#include "underground/trap_prices.h"
#include "underground/treasure_prices.h"
#include "bg_window.h"
#include "comm_player_manager.h"
@ -112,14 +113,14 @@ UndergroundVendor sUndergroundVendors[] = {
{ .vendorType = VENDOR_TYPE_TREASURES, .x = 40, .z = 72 }
};
static const WindowTemplate sWindowTemplate = {
static const WindowTemplate sYesNoWindowTemplate = {
.bgLayer = BG_LAYER_MAIN_3,
.tilemapLeft = 25,
.tilemapTop = 13,
.width = 6,
.height = 4,
.width = YES_NO_MENU_TILE_W,
.height = YES_NO_MENU_TILE_H,
.palette = 13,
.baseTile = BASE_TILE_MESSAGE_WINDOW - 6 * 4
.baseTile = BASE_TILE_YES_NO_MENU
};
static void UndergroundVendors_InitTrapsVendorInventory(UndergroundMenu *menu, int vendorIndex)
@ -129,7 +130,7 @@ static void UndergroundVendors_InitTrapsVendorInventory(UndergroundMenu *menu, i
MATHRandContext16 rand;
MATH_InitRand16(&rand, Underground_GetRandomSeed(underground) + vendorIndex);
int trapID;
int trapID; // doesn't match if declared as enum Trap
for (int i = 0; i < SHOP_INVENTORY_SIZE; i++) {
if (i == 0) {
@ -148,9 +149,10 @@ static void UndergroundVendors_InitTrapsVendorInventory(UndergroundMenu *menu, i
i--;
continue;
}
int maxSize; // needs to be declared before below variable to match
int minSize = TrapGetSpherePriceMinSize(trapID);
maxSize = TrapGetSpherePriceMaxSize(trapID);
int minSize = Trap_GetSpherePriceMinSize(trapID);
maxSize = Trap_GetSpherePriceMaxSize(trapID);
if (minSize == 0 && maxSize == 0) {
i--;
@ -158,10 +160,10 @@ static void UndergroundVendors_InitTrapsVendorInventory(UndergroundMenu *menu, i
}
menu->shopInventory[i] = trapID;
menu->shopPriceTypes[i] = TrapGetSpherePriceType(trapID);
menu->shopPriceTypes[i] = Trap_GetSpherePriceType(trapID);
if (menu->shopPriceTypes[i] == RANDOM_SPHERE_TYPE) {
menu->shopPriceTypes[i] = MATH_Rand16(&rand, 6 - 1) + 1;
menu->shopPriceTypes[i] = MATH_Rand16(&rand, SPHERE_MAX - 1) + 1;
}
menu->shopPriceSizes[i] = MATH_Rand16(&rand, maxSize - minSize) + minSize;
@ -179,7 +181,7 @@ static void UndergroundVendors_InitGoodsVendorInventory(UndergroundMenu *menu, i
MATH_InitRand16(&rand, Underground_GetRandomSeed(underground) + vendorIndex);
for (int i = 0; i < SHOP_INVENTORY_SIZE; i++) {
int goodID = MATH_Rand16(&rand, UG_GOOD_MAX - 1) + 1;
enum Good goodID = MATH_Rand16(&rand, UG_GOOD_MAX - 1) + 1;
for (int j = 0; j < i; j++) {
if (menu->shopInventory[j] == goodID) {
@ -204,7 +206,7 @@ static void UndergroundVendors_InitGoodsVendorInventory(UndergroundMenu *menu, i
i--;
continue;
} else if (menu->shopPriceTypes[i] == RANDOM_SPHERE_TYPE) {
menu->shopPriceTypes[i] = MATH_Rand16(&rand, 6 - 1) + 1;
menu->shopPriceTypes[i] = MATH_Rand16(&rand, SPHERE_MAX - 1) + 1;
}
minSize = Good_GetSpherePriceMinSize(goodID);
@ -335,31 +337,31 @@ static void UndergroundVendors_PrintItemDescriptionAndSellPrice(ListMenu *listMe
UndergroundMenu *menu = (UndergroundMenu *)ListMenu_GetAttribute(listMenu, LIST_MENU_PARENT);
Underground *underground = SaveData_GetUnderground(FieldSystem_GetSaveData(menu->fieldSystem));
int minSize, maxSize;
int sphereType = SPHERE_NONE, sphereSize;
enum SphereType sphereType = SPHERE_NONE, sphereSize;
Window_FillTilemap(&menu->secondaryWindow, 15);
if (index != LIST_CANCEL) {
if (menu->vendorType == VENDOR_TYPE_TRAPS) {
const int trapID = UndergroundMenu_GetTrapAtSlot(index, menu);
const enum Trap trapID = UndergroundMenu_GetTrapAtSlot(index, menu);
MATH_InitRand16(&rand, Underground_GetRandomSeed(underground) + menu->vendorIndex + trapID);
sphereType = TrapGetSpherePriceType(trapID);
sphereType = Trap_GetSpherePriceType(trapID);
if (sphereType == RANDOM_SPHERE_TYPE) {
sphereType = MATH_Rand16(&rand, SPHERE_TYPE_MAX - 1) + 1;
sphereType = MATH_Rand16(&rand, SPHERE_MAX - 1) + 1;
}
minSize = TrapGetSpherePriceMinSize(trapID);
maxSize = TrapGetSpherePriceMaxSize(trapID);
minSize = Trap_GetSpherePriceMinSize(trapID);
maxSize = Trap_GetSpherePriceMaxSize(trapID);
sphereSize = MATH_Rand16(&rand, maxSize - minSize) + minSize;
sphereSize /= 2;
} else if (menu->vendorType == VENDOR_TYPE_GOODS) {
const int goodID = UndergroundMenu_GetGoodAtSlotBag(index, menu);
const enum Good goodID = UndergroundMenu_GetGoodAtSlotBag(index, menu);
MATH_InitRand16(&rand, Underground_GetRandomSeed(underground) + menu->vendorIndex + goodID);
sphereType = Good_GetSpherePriceType(goodID);
if (sphereType == RANDOM_SPHERE_TYPE) {
sphereType = MATH_Rand16(&rand, SPHERE_TYPE_MAX - 1) + 1;
sphereType = MATH_Rand16(&rand, SPHERE_MAX - 1) + 1;
}
minSize = Good_GetSpherePriceMinSize(goodID);
@ -372,7 +374,7 @@ static void UndergroundVendors_PrintItemDescriptionAndSellPrice(ListMenu *listMe
sphereType = Treasure_GetSpherePriceType(treasureID);
if (sphereType == RANDOM_SPHERE_TYPE) {
sphereType = MATH_Rand16(&rand, SPHERE_TYPE_MAX - 1) + 1;
sphereType = MATH_Rand16(&rand, SPHERE_MAX - 1) + 1;
}
minSize = Treasure_GetSpherePriceMinSize(treasureID);
@ -487,10 +489,10 @@ static void UndergroundVendors_EraseCurrentMenu(UndergroundMenu *menu, BOOL unus
static void UndergroundVendors_PrintConfirmSellPrompt(int slot, UndergroundMenu *menu)
{
if (menu->vendorType == VENDOR_TYPE_TRAPS) {
int trapID = UndergroundMenu_GetTrapAtSlot(slot, menu);
enum Trap trapID = UndergroundMenu_GetTrapAtSlot(slot, menu);
UndergroundVendors_SetTrapNameForPrinter(2, trapID);
} else if (menu->vendorType == VENDOR_TYPE_GOODS) {
int goodID = UndergroundMenu_GetGoodAtSlotBag(slot, menu);
enum Good goodID = UndergroundMenu_GetGoodAtSlotBag(slot, menu);
UndergroundVendors_SetGoodNameForPrinter(2, goodID);
} else {
int treasureID = UndergroundMenu_GetTreasureAtSlot(slot, menu);
@ -556,12 +558,12 @@ void UndergroundVendors_SetTreasureNameForPrinter(int index, int treasureID)
UndergroundTextPrinter_SetUndergroundItemName(UndergroundMan_GetMiscTextPrinter(), index, treasureID);
}
void UndergroundVendors_SetTrapNameForPrinter(int index, int trapID)
void UndergroundVendors_SetTrapNameForPrinter(int index, enum Trap trapID)
{
UndergroundTextPrinter_SetUndergroundTrapNameWithIndex(UndergroundMan_GetMiscTextPrinter(), index, trapID);
}
void UndergroundVendors_SetGoodNameForPrinter(int index, int goodID)
void UndergroundVendors_SetGoodNameForPrinter(int index, enum Good goodID)
{
UndergroundTextPrinter_SetGoodNameWithIndex(UndergroundMan_GetMiscTextPrinter(), index, goodID);
}
@ -618,7 +620,7 @@ static int UndergroundVendors_FindVendorAtCoordinates(int x, int z, int *outInde
}
GF_ASSERT(FALSE);
return 0;
return VENDOR_TYPE_GOODS;
}
static void UndergroundVendors_ShopMenuTask(SysTask *sysTask, void *data)
@ -873,7 +875,7 @@ static void UndergroundVendors_ShopMenuTask(SysTask *sysTask, void *data)
break;
case SHOP_MENU_STATE_INIT_CONFIRM_SELL_MENU:
if (!UndergroundTextPrinter_IsPrinterActive(UndergroundMan_GetMiscTextPrinter())) {
menu->yesNoMenu = Menu_MakeYesNoChoice(menu->fieldSystem->bgConfig, &sWindowTemplate, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
menu->yesNoMenu = Menu_MakeYesNoChoice(menu->fieldSystem->bgConfig, &sYesNoWindowTemplate, BASE_TILE_STANDARD_WINDOW_FRAME, 11, HEAP_ID_FIELD1);
menu->state = SHOP_MENU_STATE_CONFIRM_SELL;
}
break;

View File

@ -7,12 +7,13 @@
#include "constants/items.h"
#include "constants/map_object.h"
#include "generated/goods.h"
#include "generated/sphere_types.h"
#include "generated/traps.h"
#include "struct_defs/underground.h"
#include "struct_defs/underground_record.h"
#include "overlay023/mining.h"
#include "underground/mining.h"
#include "heap.h"
#include "math_util.h"
@ -168,19 +169,19 @@ void Underground_HandleDailyEvents(SaveData *saveData, int daysPassed)
u8 growthRateRange[] = {
[SPHERE_NONE] = 0,
[PRISM_SPHERE] = 2,
[PALE_SPHERE] = 2,
[RED_SPHERE] = 4,
[BLUE_SPHERE] = 4,
[GREEN_SPHERE] = 5
[SPHERE_PRISM] = 2,
[SPHERE_PALE] = 2,
[SPHERE_RED] = 4,
[SPHERE_BLUE] = 4,
[SPHERE_GREEN] = 5
};
u8 baseGrowthRate[] = {
[SPHERE_NONE] = 0,
[PRISM_SPHERE] = 1,
[PALE_SPHERE] = 1,
[RED_SPHERE] = 3,
[BLUE_SPHERE] = 3,
[GREEN_SPHERE] = 5
[SPHERE_PRISM] = 1,
[SPHERE_PALE] = 1,
[SPHERE_RED] = 3,
[SPHERE_BLUE] = 3,
[SPHERE_GREEN] = 5
};
int i;
@ -342,7 +343,7 @@ int Underground_ConvertTreasureToBagItem(int treasureID)
return sMiningItems[treasureID];
}
BOOL Underground_TryAddGoodPC(Underground *underground, int goodID)
BOOL Underground_TryAddGoodPC(Underground *underground, enum Good goodID)
{
int i;
BOOL added = FALSE;
@ -387,11 +388,11 @@ int Underground_GetGoodAtSlotPC(Underground *underground, int slot)
return underground->goodsPC[slot];
}
int Underground_RemoveGoodAtSlotPC(Underground *underground, int slot)
enum Good Underground_RemoveGoodAtSlotPC(Underground *underground, int slot)
{
GF_ASSERT(!Underground_IsGoodAtSlotPlacedInBase(underground, slot));
int goodID = underground->goodsPC[slot];
enum Good goodID = underground->goodsPC[slot];
for (int i = slot; i < MAX_GOODS_PC_SLOTS - 1; i++) {
underground->goodsPC[i] = underground->goodsPC[i + 1];
@ -514,7 +515,7 @@ int Underground_RemoveGoodAtSlotBag(Underground *underground, int slot)
return goods;
}
BOOL Underground_TryAddGoodBag(Underground *underground, int goodID)
BOOL Underground_TryAddGoodBag(Underground *underground, enum Good goodID)
{
BOOL added = FALSE;
@ -585,7 +586,7 @@ int Underground_RemoveSphereAtSlot(Underground *underground, int slot)
return sphere;
}
BOOL Underground_TryAddSphere(Underground *underground, int sphereType, int sphereSize)
BOOL Underground_TryAddSphere(Underground *underground, enum SphereType sphereType, int sphereSize)
{
BOOL added = FALSE;
@ -720,7 +721,7 @@ int Underground_RemoveTrapAtSlot(Underground *underground, int slot)
return trap;
}
BOOL Underground_TryAddTrap(Underground *underground, int trapID)
BOOL Underground_TryAddTrap(Underground *underground, enum Trap trapID)
{
BOOL added = FALSE;
@ -754,7 +755,7 @@ void Underground_MoveTrapInInventory(Underground *underground, int origSlot, int
}
}
void Underground_SaveSpawnedTrap(Underground *underground, int trapID, int index, int x, int z)
void Underground_SaveSpawnedTrap(Underground *underground, enum Trap trapID, int index, int x, int z)
{
GF_ASSERT(index < MAX_SPAWNED_TRAPS);
@ -798,7 +799,7 @@ void Underground_RemoveSpawnedTrapAtIndex(Underground *underground, int index)
MI_CpuClear8(underground->spawnedTrapCoordinates[index], 3);
}
void Underground_SavePlacedTrap(Underground *underground, int trapID, int index, int x, int z, int param5)
void Underground_SavePlacedTrap(Underground *underground, enum Trap trapID, int index, int x, int z, int spawnedIndex)
{
GF_ASSERT(index < MAX_PLACED_TRAPS);
@ -806,7 +807,7 @@ void Underground_SavePlacedTrap(Underground *underground, int trapID, int index,
underground->placedTrapCoordinates[index][0] = x;
underground->placedTrapCoordinates[index][1] = ((x & 0xF00) >> 8) + ((z & 0xF00) >> 4);
underground->placedTrapCoordinates[index][2] = z;
underground->unk_548[index] = param5;
underground->placedTrapSpawnedIndices[index] = spawnedIndex; // pointless because placed traps aren't spawned
}
int Underground_GetPlacedTrapIDAtIndex(Underground *underground, int index)
@ -830,9 +831,10 @@ int Underground_GetPlacedTrapZCoordAtIndex(Underground *underground, int index)
return z;
}
int sub_0202907C(Underground *underground, int index)
// spawned indices don't apply to manually placed traps for obvious reasons, so this is completely pointless
int Underground_GetPlacedTrapSpawnedIndexAtIndex(Underground *underground, int index)
{
return underground->unk_548[index];
return underground->placedTrapSpawnedIndices[index];
}
void Underground_SaveBuriedSphere(Underground *underground, int type, int index, int x, int z, int initialSize, int growth)
@ -997,9 +999,9 @@ void SecretBase_SetInactive(SecretBase *secretBase)
secretBase->active = FALSE;
}
void SecretBase_AddGoodAtIndex(SecretBase *secretBase, int index, int goodID, int x, int z)
void SecretBase_AddGoodAtIndex(SecretBase *secretBase, int index, enum Good goodID, int x, int z)
{
GF_ASSERT(index < MAX_PLACED_GOODS + MAX_BASE_BOULDERS + 1);
GF_ASSERT(index < MAX_SECRET_BASE_GOODS);
GF_ASSERT(x < 32);
GF_ASSERT(z < 32);
GF_ASSERT(secretBase);
@ -1018,7 +1020,7 @@ void SecretBase_AddGoodAtIndex(SecretBase *secretBase, int index, int goodID, in
void SecretBase_SetGoodCoordsAtIndex(SecretBase *secretBase, int index, int x, int z)
{
int goodID = SecretBase_GetGoodIDAtIndex(secretBase, index);
enum Good goodID = SecretBase_GetGoodIDAtIndex(secretBase, index);
SecretBase_AddGoodAtIndex(secretBase, index, goodID, x, z);
}
@ -1041,7 +1043,7 @@ static int SecretBase_GetPCGoodID(const SecretBase *secretBase)
int SecretBase_GetGoodIDAtIndex(const SecretBase *secretBase, int index)
{
GF_ASSERT(index < MAX_PLACED_GOODS + MAX_BASE_BOULDERS + 1);
GF_ASSERT(index < MAX_SECRET_BASE_GOODS);
if (index == 0) {
return SecretBase_GetPCGoodID(secretBase);
@ -1056,7 +1058,7 @@ int SecretBase_GetGoodIDAtIndex(const SecretBase *secretBase, int index)
int SecretBase_GetGoodXCoordAtIndex(const SecretBase *secretBase, int index)
{
GF_ASSERT(index < MAX_PLACED_GOODS + MAX_BASE_BOULDERS + 1);
GF_ASSERT(index < MAX_SECRET_BASE_GOODS);
if (index == 0) {
return PC_COORDINATE_X;
@ -1069,7 +1071,7 @@ int SecretBase_GetGoodXCoordAtIndex(const SecretBase *secretBase, int index)
int SecretBase_GetGoodZCoordAtIndex(const SecretBase *secretBase, int index)
{
GF_ASSERT(index < MAX_PLACED_GOODS + MAX_BASE_BOULDERS + 1);
GF_ASSERT(index < MAX_SECRET_BASE_GOODS);
if (index == 0) {
return PC_COORDINATE_Z;

View File

@ -5,15 +5,15 @@
#include "struct_defs/struct_02039A58.h"
#include "overlay023/mining.h"
#include "overlay023/secret_bases.h"
#include "overlay023/underground_manager.h"
#include "overlay023/underground_pc.h"
#include "overlay023/underground_player.h"
#include "overlay023/underground_player_talk.h"
#include "overlay023/underground_records.h"
#include "overlay023/underground_spheres.h"
#include "overlay023/underground_traps.h"
#include "underground/manager.h"
#include "underground/mining.h"
#include "underground/pc.h"
#include "underground/player.h"
#include "underground/player_talk.h"
#include "underground/records.h"
#include "underground/secret_bases.h"
#include "underground/spheres.h"
#include "underground/traps.h"
#include "comm_player_manager.h"
#include "field_comm_manager.h"
@ -55,27 +55,27 @@ static const CommCmdTable Unk_020F68A4[] = {
{ UndergroundMan_ProcessInteractEvent, CommPacketSizeOf_InteractEvent, NULL },
{ UndergroundPlayer_ProcessOpenMenuEvent, CommPacketSizeOf_Variable, NULL },
{ UndergroundPlayer_ProcessTalkEvent, CommPacketSizeOf_Variable, NULL }, // 30
{ ov23_022433BC, CommPacketSizeOf_Nothing, NULL },
{ UndergroundTraps_TryPlaceTrap, CommPacketSizeOf_NetId, NULL },
{ UndergroundTraps_RemoveBuriedTrapAtIndex_Unused, CommPacketSizeOf_2Bytes_Unused, NULL }, // corresponding cmd never sent
{ UndergroundTraps_ProcessPlaceTrapResult, CommPacketSizeOf_PlaceTrapResult, NULL },
{ UndergroundTraps_LoadLinkPlacedTraps, CommPacketSizeOf_AllTrapsPlacedPlayer, NULL }, // 35
{ UndergroundTraps_ReceiveLoadTrapsResult, CommPacketSizeOf_LoadTrapsResult, NULL },
{ UndergroundTraps_HandleTriggeredTrap, CommPacketSizeOf_TriggeredTrap2, NULL },
{ UndergroundTraps_CallSecondTrapEffectServerFunc, CommPacketSizeOf_NetId, NULL },
{ UndergroundTraps_StartLinkSlideAnimation_Unused, CommPacketSizeOf_3Bytes_Unused, NULL }, // corresponding cmd never sent
{ UndergroundTraps_EscapeHole, CommPacketSizeOf_NetId, NULL },
{ UndergroundTraps_EscapeTrapServer, CommPacketSizeOf_Nothing, NULL },
{ UndergroundTraps_ProcessEscapedTrap, CommPacketSizeOf_EscapedTrap, NULL },
{ UndergroundTraps_EndCurrentTrapEffectServer, CommPacketSizeOf_Nothing, NULL },
{ UndergroundTraps_ProcessTrapHelp, CommPacketSizeOf_TrapHelpData, NULL },
{ UndergroundTraps_ProcessTriggeredTrapBits, CommPacketSizeOf_NetId, NULL },
{ UndergroundTraps_QueueSendTrapRadarResults, CommPacketSizeOf_Nothing, NULL },
{ UndergroundTraps_ReceiveTrapRadarResults, CommPacketSizeOf_TrapRadarResult, NULL },
{ UndergroundMan_ProcessAllDataSentMessage, CommPacketSizeOf_Nothing, NULL },
{ Traps_TryPlaceTrap, CommPacketSizeOf_NetId, NULL },
{ Traps_RemoveBuriedTrapAtIndex_Unused, CommPacketSizeOf_2Bytes_Unused, NULL }, // corresponding cmd never sent
{ Traps_ProcessPlaceTrapResult, CommPacketSizeOf_PlaceTrapResult, NULL },
{ Traps_LoadLinkPlacedTraps, CommPacketSizeOf_AllTrapsPlacedPlayer, NULL }, // 35
{ Traps_ReceiveLoadTrapsResult, CommPacketSizeOf_LoadTrapsResult, NULL },
{ Traps_HandleTriggeredTrap, CommPacketSizeOf_TriggeredTrap2, NULL },
{ Traps_CallSecondTrapEffectServerFunc, CommPacketSizeOf_NetId, NULL },
{ Traps_StartLinkSlideAnimation_Unused, CommPacketSizeOf_3Bytes_Unused, NULL }, // corresponding cmd never sent
{ Traps_EscapeHole, CommPacketSizeOf_NetId, NULL },
{ Traps_EscapeTrapServer, CommPacketSizeOf_Nothing, NULL },
{ Traps_ProcessEscapedTrap, CommPacketSizeOf_EscapedTrap, NULL },
{ Traps_EndCurrentTrapEffectServer, CommPacketSizeOf_Nothing, NULL },
{ Traps_ProcessTrapHelp, CommPacketSizeOf_TrapHelpData, NULL },
{ Traps_ProcessTriggeredTrapBits, CommPacketSizeOf_NetId, NULL },
{ Traps_QueueSendTrapRadarResults, CommPacketSizeOf_Nothing, NULL },
{ Traps_ReceiveTrapRadarResults, CommPacketSizeOf_TrapRadarResult, NULL },
{ UndergroundMan_ProcessTouchInput, CommPacketSizeOf_Coordinates, NULL },
{ UndergroundMan_ProcessTouchRadarTrapResults, CommPacketSizeOf_Variable, NULL },
{ UndergroundMan_ProcessTouchRadarMiningSpotResults, CommPacketSizeOf_Variable, NULL }, // 50
{ UndergroundTraps_ProcessDisengagedTrap, CommPacketSizeOf_TriggeredTrap, NULL },
{ Traps_ProcessDisengagedTrap, CommPacketSizeOf_TriggeredTrap, NULL },
{ CommPlayer_RecvDelete, CommPacketSizeOf_NetId, NULL },
{ SecretBases_ProcessBaseInfo, CommPacketSizeOf_SecretBaseInfo, NULL },
{ SecretBases_ProcessBaseEnter, CommPacketSizeOf_SecretBaseInfo, NULL },
@ -87,7 +87,7 @@ static const CommCmdTable Unk_020F68A4[] = {
{ SecretBases_ProcessGoodInteractionEvent, CommPacketSizeOf_GoodInteractionEvent, NULL }, // 60
{ SecretBases_ProcessFailedBaseEnter, CommPacketSizeOf_NetId, NULL },
{ sub_02058018, CommPacketSizeOf_NetId, NULL },
{ UndergroundSpheres_RetrieveBuriedSphere, CommPacketSizeOf_NetId, NULL },
{ Spheres_ProcessRetrieveBuriedSphereRequest, CommPacketSizeOf_NetId, NULL },
{ Mining_ProcessMiningSpotInteract, CommPacketSizeOf_NetId, NULL },
{ Mining_ProcessConfirmStartMiningResult, CommPacketSizeOf_NetId, NULL }, // 65
{ Mining_ProcessStartMiningConfirm, CommPacketSizeOf_NetId, NULL },
@ -116,7 +116,7 @@ static const CommCmdTable Unk_020F68A4[] = {
{ UndergroundPC_ProcessTakeFlagAttempt, CommPacketSizeOf_PCInteraction, NULL },
{ UndergroundPC_ProcessTakenFlag, CommPacketSizeOf_PCInteraction, NULL }, // 90
{ UndergroundPlayer_ProcessHeldFlagOwnerInfo, CommPacketSizeOf_TrainerInfo, NULL },
{ UndergroundPlayer_ProcessHeldFlagOwnerInfoServer, CommPacketSizeOf_HeldFlagInfo, ov23_0224AAA0 },
{ UndergroundPlayer_ProcessHeldFlagOwnerInfoServer, CommPacketSizeOf_HeldFlagInfo, UndergroundPlayer_GetHeldFlagInfoBuffer },
{ UndergroundPlayer_ProcessHeldFlagOwnerInfoAck, CommPacketSizeOf_NetId, NULL },
{ sub_02059180, CommPacketSizeOf_NetId, NULL },
{ sub_02059D0C, CommPacketSizeOf_NetId, NULL }, // 95