mirror of
https://github.com/pret/pokeplatinum.git
synced 2026-03-21 17:55:13 -05:00
unify coordinate structs (#1010)
Some checks are pending
build / build (push) Waiting to run
Some checks are pending
build / build (push) Waiting to run
This commit is contained in:
parent
92fffdc5d9
commit
8fbf711e09
|
|
@ -3,12 +3,31 @@
|
||||||
|
|
||||||
typedef struct CoordinatesS16 {
|
typedef struct CoordinatesS16 {
|
||||||
s16 x;
|
s16 x;
|
||||||
s16 y;
|
union {
|
||||||
|
s16 y;
|
||||||
|
s16 z;
|
||||||
|
};
|
||||||
} CoordinatesS16;
|
} CoordinatesS16;
|
||||||
|
|
||||||
typedef struct CoordinatesU16 {
|
typedef struct CoordinatesU16 {
|
||||||
u16 x;
|
u16 x;
|
||||||
u16 y;
|
union {
|
||||||
|
u16 y;
|
||||||
|
u16 z;
|
||||||
|
};
|
||||||
} CoordinatesU16;
|
} CoordinatesU16;
|
||||||
|
|
||||||
|
typedef struct CoordinatesInt {
|
||||||
|
int x;
|
||||||
|
union {
|
||||||
|
int y;
|
||||||
|
int z;
|
||||||
|
};
|
||||||
|
} CoordinatesInt;
|
||||||
|
|
||||||
|
typedef struct CoordinatesFX32 {
|
||||||
|
fx32 x;
|
||||||
|
fx32 y;
|
||||||
|
} CoordinatesFX32;
|
||||||
|
|
||||||
#endif // POKEPLATINUM_COORDINATES_H
|
#endif // POKEPLATINUM_COORDINATES_H
|
||||||
|
|
|
||||||
|
|
@ -34,16 +34,6 @@
|
||||||
#define MAX_GOOD_WIDTH 3
|
#define MAX_GOOD_WIDTH 3
|
||||||
#define MAX_GOOD_DEPTH 3
|
#define MAX_GOOD_DEPTH 3
|
||||||
|
|
||||||
typedef struct Coordinates {
|
|
||||||
u16 x;
|
|
||||||
u16 z;
|
|
||||||
} Coordinates;
|
|
||||||
|
|
||||||
typedef struct Coordinates2D {
|
|
||||||
u16 x;
|
|
||||||
u16 y;
|
|
||||||
} Coordinates2D;
|
|
||||||
|
|
||||||
typedef struct SpherePrice {
|
typedef struct SpherePrice {
|
||||||
u8 sphereType;
|
u8 sphereType;
|
||||||
u8 minSize;
|
u8 minSize;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
#include "underground/defs.h"
|
#include "underground/defs.h"
|
||||||
#include "underground/text_printer.h"
|
#include "underground/text_printer.h"
|
||||||
|
|
||||||
|
#include "coordinates.h"
|
||||||
#include "savedata.h"
|
#include "savedata.h"
|
||||||
#include "string_gf.h"
|
#include "string_gf.h"
|
||||||
#include "sys_task_manager.h"
|
#include "sys_task_manager.h"
|
||||||
|
|
@ -68,7 +69,7 @@ enum MapMarkerAnim {
|
||||||
|
|
||||||
#define MAX_RADAR_BLIPS 16
|
#define MAX_RADAR_BLIPS 16
|
||||||
|
|
||||||
typedef Coordinates *(*CoordinatesGetter)(Coordinates *, int);
|
typedef CoordinatesU16 *(*GetCoordinatesFunc)(CoordinatesU16 *coordinates, int index);
|
||||||
|
|
||||||
UndergroundTextPrinter *UndergroundMan_GetCommonTextPrinter(void);
|
UndergroundTextPrinter *UndergroundMan_GetCommonTextPrinter(void);
|
||||||
UndergroundTextPrinter *UndergroundMan_GetCaptureFlagTextPrinter(void);
|
UndergroundTextPrinter *UndergroundMan_GetCaptureFlagTextPrinter(void);
|
||||||
|
|
@ -83,9 +84,9 @@ BOOL UndergroundMan_CheckForTouchInput(void);
|
||||||
void UndergroundMan_ProcessTouchInput(int netID, int unused1, void *data, void *unused3);
|
void UndergroundMan_ProcessTouchInput(int netID, int unused1, void *data, void *unused3);
|
||||||
void UndergroundMan_ProcessTouchRadarTrapResults(int unused0, int size, void *data, void *unused3);
|
void UndergroundMan_ProcessTouchRadarTrapResults(int unused0, int size, void *data, void *unused3);
|
||||||
void UndergroundMan_ProcessTouchRadarMiningSpotResults(int unused0, int size, void *data, void *unused3);
|
void UndergroundMan_ProcessTouchRadarMiningSpotResults(int unused0, int size, void *data, void *unused3);
|
||||||
int UndergroundMan_CalcCoordsIndexGet(Coordinates *coordinates);
|
int UndergroundMan_CalcCoordsIndexGet(CoordinatesU16 *coordinates);
|
||||||
int UndergroundMan_CalcCoordsIndexInsert(Coordinates *coordinates);
|
int UndergroundMan_CalcCoordsIndexInsert(CoordinatesU16 *coordinates);
|
||||||
void UndergroundMan_InitCoordsOrderingState(int orderedArrayLength, CoordinatesGetter coordinatesGetter);
|
void UndergroundMan_InitCoordsOrderingState(int orderedArrayLength, GetCoordinatesFunc getCoordsFunc);
|
||||||
void UndergroundMan_OpenMenu(void);
|
void UndergroundMan_OpenMenu(void);
|
||||||
void UndergroundMan_ProgressInteractCooldown(void);
|
void UndergroundMan_ProgressInteractCooldown(void);
|
||||||
void UndergroundMan_ProcessInteract(u8 flags);
|
void UndergroundMan_ProcessInteract(u8 flags);
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#include "field/field_system_decl.h"
|
#include "field/field_system_decl.h"
|
||||||
#include "underground/defs.h"
|
#include "underground/defs.h"
|
||||||
|
|
||||||
|
#include "coordinates.h"
|
||||||
#include "string_gf.h"
|
#include "string_gf.h"
|
||||||
|
|
||||||
void MiningEnv_Init(void *dest, FieldSystem *fieldSystem);
|
void MiningEnv_Init(void *dest, FieldSystem *fieldSystem);
|
||||||
|
|
@ -13,7 +14,7 @@ int MiningEnv_Size(void);
|
||||||
void Mining_Dummy(void);
|
void Mining_Dummy(void);
|
||||||
void Mining_Dummy2(void);
|
void Mining_Dummy2(void);
|
||||||
void MiningEnv_Free(void);
|
void MiningEnv_Free(void);
|
||||||
BOOL Mining_CheckForMiningSpotInteract(int netID, Coordinates *coordinates);
|
BOOL Mining_CheckForMiningSpotInteract(int netID, CoordinatesU16 *coordinates);
|
||||||
void Mining_SpawnMiningSpotNearBuriedSphere(int buriedSphereX, int buriedSphereZ, MATHRandContext16 *rand);
|
void Mining_SpawnMiningSpotNearBuriedSphere(int buriedSphereX, int buriedSphereZ, MATHRandContext16 *rand);
|
||||||
void Mining_SendRadarResults(void);
|
void Mining_SendRadarResults(void);
|
||||||
void Mining_ProcessMiningSpotInteract(int unused0, int unused1, void *data, void *unused3);
|
void Mining_ProcessMiningSpotInteract(int unused0, int unused1, void *data, void *unused3);
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,10 @@
|
||||||
#include "underground/defs.h"
|
#include "underground/defs.h"
|
||||||
#include "underground/menus.h"
|
#include "underground/menus.h"
|
||||||
|
|
||||||
int UndergroundPC_GetPCOwnerNetIDAtCoordinates(Coordinates *coordinates, int dir);
|
#include "coordinates.h"
|
||||||
BOOL UndergroundPC_TryUsePC(int netID, Coordinates *coordinates);
|
|
||||||
|
int UndergroundPC_GetPCOwnerNetIDAtCoordinates(CoordinatesU16 *coordinates, int dir);
|
||||||
|
BOOL UndergroundPC_TryUsePC(int netID, CoordinatesU16 *coordinates);
|
||||||
void UndergroundPC_ProcessPCInteraction(int unused0, int unused1, void *data, void *data2);
|
void UndergroundPC_ProcessPCInteraction(int unused0, int unused1, void *data, void *data2);
|
||||||
int CommPacketSizeOf_PCInteraction(void);
|
int CommPacketSizeOf_PCInteraction(void);
|
||||||
void UndergroundPC_ProcessTakeFlagAttempt(int unused0, int unused1, void *data, void *unused3);
|
void UndergroundPC_ProcessTakeFlagAttempt(int unused0, int unused1, void *data, void *unused3);
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#include "field/field_system_decl.h"
|
#include "field/field_system_decl.h"
|
||||||
#include "underground/defs.h"
|
#include "underground/defs.h"
|
||||||
|
|
||||||
|
#include "coordinates.h"
|
||||||
#include "savedata.h"
|
#include "savedata.h"
|
||||||
#include "string_gf.h"
|
#include "string_gf.h"
|
||||||
#include "underground.h"
|
#include "underground.h"
|
||||||
|
|
@ -64,7 +65,7 @@ int SecretBases_PrintBaseDecorationMessage(int bankEntry);
|
||||||
void SecretBases_EraseBaseDecorationMessageBox(void);
|
void SecretBases_EraseBaseDecorationMessageBox(void);
|
||||||
void SecretBases_SetGoodNameForPrinter(enum Good goodID);
|
void SecretBases_SetGoodNameForPrinter(enum Good goodID);
|
||||||
void SecretBases_SetTwoDigitNumberWithIndexForPrinter(int num, int index);
|
void SecretBases_SetTwoDigitNumberWithIndexForPrinter(int num, int index);
|
||||||
BOOL SecretBases_CheckForInteractableGood(int netID, Coordinates *coordinates);
|
BOOL SecretBases_CheckForInteractableGood(int netID, CoordinatesU16 *coordinates);
|
||||||
void SecretBases_ProcessGoodInteractionEvent(int unused0, int unused1, void *data, void *unused3);
|
void SecretBases_ProcessGoodInteractionEvent(int unused0, int unused1, void *data, void *unused3);
|
||||||
int CommPacketSizeOf_GoodInteractionEvent(void);
|
int CommPacketSizeOf_GoodInteractionEvent(void);
|
||||||
void SecretBases_QueueObtainedFlagMessage(int netID, int flagOwnerNetID);
|
void SecretBases_QueueObtainedFlagMessage(int netID, int flagOwnerNetID);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "field/field_system_decl.h"
|
#include "field/field_system_decl.h"
|
||||||
|
|
||||||
|
#include "coordinates.h"
|
||||||
#include "string_gf.h"
|
#include "string_gf.h"
|
||||||
|
|
||||||
typedef struct TouchRadarSearchContext {
|
typedef struct TouchRadarSearchContext {
|
||||||
|
|
@ -14,11 +15,6 @@ typedef struct TouchRadarSearchContext {
|
||||||
u16 radius;
|
u16 radius;
|
||||||
} TouchRadarSearchContext;
|
} TouchRadarSearchContext;
|
||||||
|
|
||||||
typedef struct TouchRadarCoordinates {
|
|
||||||
s16 x;
|
|
||||||
s16 z;
|
|
||||||
} TouchRadarCoordinates;
|
|
||||||
|
|
||||||
void SpheresEnv_Init(void *dest, FieldSystem *fieldSystem);
|
void SpheresEnv_Init(void *dest, FieldSystem *fieldSystem);
|
||||||
int SpheresEnv_Size(void);
|
int SpheresEnv_Size(void);
|
||||||
void Spheres_DisableBuriedSphereSparkles(void);
|
void Spheres_DisableBuriedSphereSparkles(void);
|
||||||
|
|
@ -27,7 +23,7 @@ void SpheresEnv_Free(void);
|
||||||
void Spheres_AdvanceBuriedSphereSparkleTimer(void);
|
void Spheres_AdvanceBuriedSphereSparkleTimer(void);
|
||||||
void Spheres_ProcessRetrieveBuriedSphereRequest(int unused, int unused2, void *src, void *unused3);
|
void Spheres_ProcessRetrieveBuriedSphereRequest(int unused, int unused2, void *src, void *unused3);
|
||||||
void TouchRadarSearch_Init(TouchRadarSearchContext *ctx, int radius);
|
void TouchRadarSearch_Init(TouchRadarSearchContext *ctx, int radius);
|
||||||
BOOL TouchRadarSearch_GetNextCoords(TouchRadarSearchContext *ctx, TouchRadarCoordinates *out);
|
BOOL TouchRadarSearch_GetNextCoords(TouchRadarSearchContext *ctx, CoordinatesS16 *out);
|
||||||
void Spheres_TryBurySphere(enum SphereType sphereType, int sphereSize, int x, int z);
|
void Spheres_TryBurySphere(enum SphereType sphereType, int sphereSize, int x, int z);
|
||||||
BOOL Spheres_IsMiningItemSphere(int miningItemID);
|
BOOL Spheres_IsMiningItemSphere(int miningItemID);
|
||||||
BOOL Spheres_IsBuriedSphereAtCoordinates(int x, int z);
|
BOOL Spheres_IsBuriedSphereAtCoordinates(int x, int z);
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include "underground/defs.h"
|
#include "underground/defs.h"
|
||||||
|
|
||||||
#include "bg_window.h"
|
#include "bg_window.h"
|
||||||
|
#include "coordinates.h"
|
||||||
#include "string_gf.h"
|
#include "string_gf.h"
|
||||||
|
|
||||||
void TrapsEnv_Init(void *dest, FieldSystem *fieldSystem);
|
void TrapsEnv_Init(void *dest, FieldSystem *fieldSystem);
|
||||||
|
|
@ -34,8 +35,8 @@ void Traps_ReceiveLoadTrapsResult(int unused0, int unused1, void *data, void *un
|
||||||
int CommPacketSizeOf_LoadTrapsResult(void);
|
int CommPacketSizeOf_LoadTrapsResult(void);
|
||||||
BOOL Traps_HaveLinksReceivedPlacedTraps(void);
|
BOOL Traps_HaveLinksReceivedPlacedTraps(void);
|
||||||
void Traps_ClearLinksReceivedPlacedTraps(void);
|
void Traps_ClearLinksReceivedPlacedTraps(void);
|
||||||
int CommPacketSizeOf_Coordinates(void);
|
int CommPacketSizeOf_CoordinatesU16(void);
|
||||||
BOOL Traps_TryDisengageTrap(int netID, Coordinates *unused, u8 flags);
|
BOOL Traps_TryDisengageTrap(int netID, CoordinatesU16 *unused, u8 flags);
|
||||||
int CommPacketSizeOf_TriggeredTrap(void);
|
int CommPacketSizeOf_TriggeredTrap(void);
|
||||||
void Traps_ProcessDisengagedTrap(int unused0, int unused1, void *data, void *unused3);
|
void Traps_ProcessDisengagedTrap(int unused0, int unused1, void *data, void *unused3);
|
||||||
BOOL Traps_IsTrapAtCoordinates(int x, int z);
|
BOOL Traps_IsTrapAtCoordinates(int x, int z);
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
#include "berry_patch_graphics.h"
|
#include "berry_patch_graphics.h"
|
||||||
#include "bg_window.h"
|
#include "bg_window.h"
|
||||||
#include "billboard.h"
|
#include "billboard.h"
|
||||||
|
#include "coordinates.h"
|
||||||
#include "field_script_context.h"
|
#include "field_script_context.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "game_records.h"
|
#include "game_records.h"
|
||||||
|
|
@ -62,11 +63,6 @@
|
||||||
|
|
||||||
#define MAX_LIST_ENTRIES 120
|
#define MAX_LIST_ENTRIES 120
|
||||||
|
|
||||||
typedef struct RegiDotCoordinates {
|
|
||||||
s16 x;
|
|
||||||
s16 z;
|
|
||||||
} RegiDotCoordinates;
|
|
||||||
|
|
||||||
typedef struct BattleHallRecordSelector {
|
typedef struct BattleHallRecordSelector {
|
||||||
FieldSystem *fieldSystem;
|
FieldSystem *fieldSystem;
|
||||||
SysTask *task;
|
SysTask *task;
|
||||||
|
|
@ -846,34 +842,34 @@ BOOL ScrCmd_Dummy316(ScriptContext *ctx)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const RegiDotCoordinates sDotCoordinatesIronRuins[] = {
|
static const CoordinatesS16 sDotCoordinatesIronRuins[] = {
|
||||||
{ 4, 7 },
|
{ .x = 4, .z = 7 },
|
||||||
{ 5, 5 },
|
{ .x = 5, .z = 5 },
|
||||||
{ 5, 9 },
|
{ .x = 5, .z = 9 },
|
||||||
{ 7, 7 },
|
{ .x = 7, .z = 7 },
|
||||||
{ 9, 5 },
|
{ .x = 9, .z = 5 },
|
||||||
{ 9, 9 },
|
{ .x = 9, .z = 9 },
|
||||||
{ 10, 7 }
|
{ .x = 10, .z = 7 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const RegiDotCoordinates sDotCoordinatesIcebergRuins[] = {
|
static const CoordinatesS16 sDotCoordinatesIcebergRuins[] = {
|
||||||
{ 3, 7 },
|
{ .x = 3, .z = 7 },
|
||||||
{ 5, 7 },
|
{ .x = 5, .z = 7 },
|
||||||
{ 7, 5 },
|
{ .x = 7, .z = 5 },
|
||||||
{ 7, 7 },
|
{ .x = 7, .z = 7 },
|
||||||
{ 7, 9 },
|
{ .x = 7, .z = 9 },
|
||||||
{ 9, 7 },
|
{ .x = 9, .z = 7 },
|
||||||
{ 11, 7 }
|
{ .x = 11, .z = 7 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const RegiDotCoordinates sDotCoordinatesRockPeakRuins[] = {
|
static const CoordinatesS16 sDotCoordinatesRockPeakRuins[] = {
|
||||||
{ 5, 5 },
|
{ .x = 5, .z = 5 },
|
||||||
{ 5, 7 },
|
{ .x = 5, .z = 7 },
|
||||||
{ 5, 9 },
|
{ .x = 5, .z = 9 },
|
||||||
{ 7, 7 },
|
{ .x = 7, .z = 7 },
|
||||||
{ 9, 5 },
|
{ .x = 9, .z = 5 },
|
||||||
{ 9, 7 },
|
{ .x = 9, .z = 7 },
|
||||||
{ 9, 9 }
|
{ .x = 9, .z = 9 }
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOL ScrCmd_ActivateRegiRuinsDot(ScriptContext *ctx)
|
BOOL ScrCmd_ActivateRegiRuinsDot(ScriptContext *ctx)
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "badges.h"
|
#include "badges.h"
|
||||||
#include "char_transfer.h"
|
#include "char_transfer.h"
|
||||||
|
#include "coordinates.h"
|
||||||
#include "gx_layers.h"
|
#include "gx_layers.h"
|
||||||
#include "heap.h"
|
#include "heap.h"
|
||||||
#include "narc.h"
|
#include "narc.h"
|
||||||
|
|
@ -17,11 +18,6 @@
|
||||||
#include "sprite_transfer.h"
|
#include "sprite_transfer.h"
|
||||||
#include "sprite_util.h"
|
#include "sprite_util.h"
|
||||||
|
|
||||||
typedef struct Coordinates {
|
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
} Coordinates;
|
|
||||||
|
|
||||||
static const u8 sSpriteResourceCapacities[4] = {
|
static const u8 sSpriteResourceCapacities[4] = {
|
||||||
[SPRITE_RESOURCE_CHAR] = 1,
|
[SPRITE_RESOURCE_CHAR] = 1,
|
||||||
[SPRITE_RESOURCE_PLTT] = 2,
|
[SPRITE_RESOURCE_PLTT] = 2,
|
||||||
|
|
@ -29,7 +25,7 @@ static const u8 sSpriteResourceCapacities[4] = {
|
||||||
[SPRITE_RESOURCE_ANIM] = 1
|
[SPRITE_RESOURCE_ANIM] = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
static const Coordinates sBadgeCoordinates[] = {
|
static const CoordinatesInt sBadgeCoordinates[] = {
|
||||||
[BADGE_ID_COAL] = { .x = 24, .y = 40 },
|
[BADGE_ID_COAL] = { .x = 24, .y = 40 },
|
||||||
[BADGE_ID_FOREST] = { .x = 80, .y = 40 },
|
[BADGE_ID_FOREST] = { .x = 80, .y = 40 },
|
||||||
[BADGE_ID_COBBLE] = { .x = 136, .y = 40 },
|
[BADGE_ID_COBBLE] = { .x = 136, .y = 40 },
|
||||||
|
|
@ -40,7 +36,7 @@ static const Coordinates sBadgeCoordinates[] = {
|
||||||
[BADGE_ID_BEACON] = { .x = 192, .y = 72 }
|
[BADGE_ID_BEACON] = { .x = 192, .y = 72 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const Coordinates sSparkleCoordinates[] = {
|
static const CoordinatesInt sSparkleCoordinates[] = {
|
||||||
[BADGE_ID_COAL] = { .x = 24, .y = 40 },
|
[BADGE_ID_COAL] = { .x = 24, .y = 40 },
|
||||||
[BADGE_ID_FOREST] = { .x = 80, .y = 40 },
|
[BADGE_ID_FOREST] = { .x = 80, .y = 40 },
|
||||||
[BADGE_ID_COBBLE] = { .x = 136, .y = 40 },
|
[BADGE_ID_COBBLE] = { .x = 136, .y = 40 },
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#include "comm_player_manager.h"
|
#include "comm_player_manager.h"
|
||||||
#include "communication_information.h"
|
#include "communication_information.h"
|
||||||
#include "communication_system.h"
|
#include "communication_system.h"
|
||||||
|
#include "coordinates.h"
|
||||||
#include "field_system.h"
|
#include "field_system.h"
|
||||||
#include "game_options.h"
|
#include "game_options.h"
|
||||||
#include "graphics.h"
|
#include "graphics.h"
|
||||||
|
|
@ -71,8 +72,8 @@ typedef struct UndergroundManager {
|
||||||
FieldSystem *fieldSystem;
|
FieldSystem *fieldSystem;
|
||||||
u8 padding[4];
|
u8 padding[4];
|
||||||
SysTask *sysTask;
|
SysTask *sysTask;
|
||||||
Coordinates2D touchCoordinates;
|
CoordinatesU16 touchCoordinates;
|
||||||
Coordinates touchedTileCoords;
|
CoordinatesU16 touchedTileCoords;
|
||||||
StoredListMenuPos storedPositions[MAX_STORED_MENU_POSITIONS];
|
StoredListMenuPos storedPositions[MAX_STORED_MENU_POSITIONS];
|
||||||
u16 storedPositionKey;
|
u16 storedPositionKey;
|
||||||
u8 linksTalkedTo[MAX_CONNECTED_PLAYERS];
|
u8 linksTalkedTo[MAX_CONNECTED_PLAYERS];
|
||||||
|
|
@ -82,7 +83,7 @@ typedef struct UndergroundManager {
|
||||||
u8 touchRadarTrapResults[MAX_TOUCH_RADAR_RESULTS_OF_TYPE];
|
u8 touchRadarTrapResults[MAX_TOUCH_RADAR_RESULTS_OF_TYPE];
|
||||||
u8 touchRadarMiningSpotResults[MAX_TOUCH_RADAR_RESULTS_OF_TYPE];
|
u8 touchRadarMiningSpotResults[MAX_TOUCH_RADAR_RESULTS_OF_TYPE];
|
||||||
u8 touchRadarBuriedSphereResults[MAX_TOUCH_RADAR_RESULTS_OF_TYPE];
|
u8 touchRadarBuriedSphereResults[MAX_TOUCH_RADAR_RESULTS_OF_TYPE];
|
||||||
CoordinatesGetter coordinatesGetter;
|
GetCoordinatesFunc getCoordsFunc;
|
||||||
UndergroundTextPrinter *commonTextPrinter;
|
UndergroundTextPrinter *commonTextPrinter;
|
||||||
UndergroundTextPrinter *captureFlagTextPrinter;
|
UndergroundTextPrinter *captureFlagTextPrinter;
|
||||||
UndergroundTextPrinter *miscTextPrinter;
|
UndergroundTextPrinter *miscTextPrinter;
|
||||||
|
|
@ -311,7 +312,7 @@ static BOOL UndergroundMan_GetQueuedPlayerMessage(String *dest)
|
||||||
// doesn't check for everything that could be at the coordinates
|
// doesn't check for everything that could be at the coordinates
|
||||||
BOOL UndergroundMan_AreCoordinatesOccupied(int x, int z)
|
BOOL UndergroundMan_AreCoordinatesOccupied(int x, int z)
|
||||||
{
|
{
|
||||||
Coordinates coordinates = {
|
CoordinatesU16 coordinates = {
|
||||||
.x = x,
|
.x = x,
|
||||||
.z = z
|
.z = z
|
||||||
};
|
};
|
||||||
|
|
@ -358,7 +359,7 @@ BOOL UndergroundMan_CheckForTouchInput(void)
|
||||||
pos = ov5_GetPositionFromTouchCoordinates(gSystem.touchX, gSystem.touchY, sUndergroundMan->fieldSystem->unk_8C);
|
pos = ov5_GetPositionFromTouchCoordinates(gSystem.touchX, gSystem.touchY, sUndergroundMan->fieldSystem->unk_8C);
|
||||||
int x, z;
|
int x, z;
|
||||||
LandData_ObjectPosToTilePos(pos.x, pos.z, &x, &z);
|
LandData_ObjectPosToTilePos(pos.x, pos.z, &x, &z);
|
||||||
Coordinates touchedTileCoords = {
|
CoordinatesU16 touchedTileCoords = {
|
||||||
.x = x,
|
.x = x,
|
||||||
.z = z
|
.z = z
|
||||||
};
|
};
|
||||||
|
|
@ -368,7 +369,7 @@ BOOL UndergroundMan_CheckForTouchInput(void)
|
||||||
sUndergroundMan->touchedTileCoords.x = x;
|
sUndergroundMan->touchedTileCoords.x = x;
|
||||||
sUndergroundMan->touchedTileCoords.z = z;
|
sUndergroundMan->touchedTileCoords.z = z;
|
||||||
|
|
||||||
CommSys_SendData(48, &touchedTileCoords, sizeof(Coordinates));
|
CommSys_SendData(48, &touchedTileCoords, sizeof(CoordinatesU16));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -378,7 +379,7 @@ BOOL UndergroundMan_CheckForTouchInput(void)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int UndergroundMan_TouchRadarSearch(u8 *out, TouchRadarItemCheckFunc isItemAtCoords, Coordinates *touchedTileCoords)
|
static int UndergroundMan_TouchRadarSearch(u8 *out, TouchRadarItemCheckFunc isItemAtCoords, CoordinatesU16 *touchedTileCoords)
|
||||||
{
|
{
|
||||||
int index = 1;
|
int index = 1;
|
||||||
|
|
||||||
|
|
@ -388,7 +389,7 @@ static int UndergroundMan_TouchRadarSearch(u8 *out, TouchRadarItemCheckFunc isIt
|
||||||
TouchRadarSearchContext ctx;
|
TouchRadarSearchContext ctx;
|
||||||
TouchRadarSearch_Init(&ctx, TOUCH_RADAR_RADIUS);
|
TouchRadarSearch_Init(&ctx, TOUCH_RADAR_RADIUS);
|
||||||
|
|
||||||
TouchRadarCoordinates radarCoords;
|
CoordinatesS16 radarCoords;
|
||||||
while (TouchRadarSearch_GetNextCoords(&ctx, &radarCoords)) {
|
while (TouchRadarSearch_GetNextCoords(&ctx, &radarCoords)) {
|
||||||
int x = touchedTileCoords->x + radarCoords.x;
|
int x = touchedTileCoords->x + radarCoords.x;
|
||||||
int z = touchedTileCoords->z + radarCoords.z;
|
int z = touchedTileCoords->z + radarCoords.z;
|
||||||
|
|
@ -408,7 +409,7 @@ static int UndergroundMan_TouchRadarSearch(u8 *out, TouchRadarItemCheckFunc isIt
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UndergroundMan_StartTouchRadar(int netID, Coordinates *touchedTileCoords)
|
static void UndergroundMan_StartTouchRadar(int netID, CoordinatesU16 *touchedTileCoords)
|
||||||
{
|
{
|
||||||
u8 buffer[MAX_TOUCH_RADAR_RESULTS_OF_TYPE + 1];
|
u8 buffer[MAX_TOUCH_RADAR_RESULTS_OF_TYPE + 1];
|
||||||
int size = 1;
|
int size = 1;
|
||||||
|
|
@ -424,7 +425,7 @@ static void UndergroundMan_StartTouchRadar(int netID, Coordinates *touchedTileCo
|
||||||
|
|
||||||
void UndergroundMan_ProcessTouchInput(int netID, int unused1, void *data, void *unused3)
|
void UndergroundMan_ProcessTouchInput(int netID, int unused1, void *data, void *unused3)
|
||||||
{
|
{
|
||||||
Coordinates *touchedTileCoords = data;
|
CoordinatesU16 *touchedTileCoords = data;
|
||||||
|
|
||||||
if (!CommPlayerMan_IsMovementEnabled(netID)) {
|
if (!CommPlayerMan_IsMovementEnabled(netID)) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -469,7 +470,7 @@ void UndergroundMan_ProcessTouchRadarMiningSpotResults(int unused0, int size, vo
|
||||||
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);
|
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)
|
static int UndergroundMan_GetOrderedCoordinatesValue(CoordinatesU16 *coordinates)
|
||||||
{
|
{
|
||||||
int x = 0, z = 0;
|
int x = 0, z = 0;
|
||||||
|
|
||||||
|
|
@ -483,45 +484,45 @@ static int UndergroundMan_GetOrderedCoordinatesValue(Coordinates *coordinates)
|
||||||
return (z * MAP_MATRIX_MAX_WIDTH * MAP_TILES_COUNT_X) + x;
|
return (z * MAP_MATRIX_MAX_WIDTH * MAP_TILES_COUNT_X) + x;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UndergroundMan_CalcCoordsIndexGet(Coordinates *coordinates)
|
int UndergroundMan_CalcCoordsIndexGet(CoordinatesU16 *coordinates)
|
||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
int max = sUndergroundMan->orderedArrayLength - 1;
|
int max = sUndergroundMan->orderedArrayLength - 1;
|
||||||
int orderedValue = UndergroundMan_GetOrderedCoordinatesValue(coordinates);
|
int orderedValue = UndergroundMan_GetOrderedCoordinatesValue(coordinates);
|
||||||
Coordinates _;
|
CoordinatesU16 _;
|
||||||
CoordinatesGetter getCoordinates = sUndergroundMan->coordinatesGetter;
|
GetCoordinatesFunc getCoordsFunc = sUndergroundMan->getCoordsFunc;
|
||||||
|
|
||||||
while (index < max) {
|
while (index < max) {
|
||||||
int midpoint = (index + max) / 2;
|
int midpoint = (index + max) / 2;
|
||||||
|
|
||||||
if (UndergroundMan_GetOrderedCoordinatesValue(getCoordinates(&_, midpoint)) < orderedValue) {
|
if (UndergroundMan_GetOrderedCoordinatesValue(getCoordsFunc(&_, midpoint)) < orderedValue) {
|
||||||
index = midpoint + 1;
|
index = midpoint + 1;
|
||||||
} else {
|
} else {
|
||||||
max = midpoint;
|
max = midpoint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UndergroundMan_GetOrderedCoordinatesValue(getCoordinates(&_, index)) == orderedValue) {
|
if (UndergroundMan_GetOrderedCoordinatesValue(getCoordsFunc(&_, index)) == orderedValue) {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UndergroundMan_CalcCoordsIndexInsert(Coordinates *coordinates)
|
int UndergroundMan_CalcCoordsIndexInsert(CoordinatesU16 *coordinates)
|
||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
int max = sUndergroundMan->orderedArrayLength - 2;
|
int max = sUndergroundMan->orderedArrayLength - 2;
|
||||||
int orderedValue = UndergroundMan_GetOrderedCoordinatesValue(coordinates);
|
int orderedValue = UndergroundMan_GetOrderedCoordinatesValue(coordinates);
|
||||||
Coordinates _;
|
CoordinatesU16 _;
|
||||||
CoordinatesGetter getCoordinates = sUndergroundMan->coordinatesGetter;
|
GetCoordinatesFunc getCoordsFunc = sUndergroundMan->getCoordsFunc;
|
||||||
|
|
||||||
max++; // why?
|
max++; // why?
|
||||||
|
|
||||||
while (index < max) {
|
while (index < max) {
|
||||||
int midpoint = (index + max) / 2;
|
int midpoint = (index + max) / 2;
|
||||||
|
|
||||||
if (UndergroundMan_GetOrderedCoordinatesValue(getCoordinates(&_, midpoint)) < orderedValue) {
|
if (UndergroundMan_GetOrderedCoordinatesValue(getCoordsFunc(&_, midpoint)) < orderedValue) {
|
||||||
index = midpoint + 1;
|
index = midpoint + 1;
|
||||||
} else {
|
} else {
|
||||||
max = midpoint;
|
max = midpoint;
|
||||||
|
|
@ -531,9 +532,9 @@ int UndergroundMan_CalcCoordsIndexInsert(Coordinates *coordinates)
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UndergroundMan_InitCoordsOrderingState(int orderedArrayLength, CoordinatesGetter coordinatesGetter)
|
void UndergroundMan_InitCoordsOrderingState(int orderedArrayLength, GetCoordinatesFunc getCoordsFunc)
|
||||||
{
|
{
|
||||||
sUndergroundMan->coordinatesGetter = coordinatesGetter;
|
sUndergroundMan->getCoordsFunc = getCoordsFunc;
|
||||||
sUndergroundMan->orderedArrayLength = orderedArrayLength;
|
sUndergroundMan->orderedArrayLength = orderedArrayLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -595,7 +596,7 @@ void UndergroundMan_ProcessInteractEvent(int netID, int unused1, void *data, voi
|
||||||
{
|
{
|
||||||
TalkEvent talkEvent;
|
TalkEvent talkEvent;
|
||||||
InteractEvent *event = data;
|
InteractEvent *event = data;
|
||||||
Coordinates coordinates;
|
CoordinatesU16 coordinates;
|
||||||
u8 netIDBuffer = netID;
|
u8 netIDBuffer = netID;
|
||||||
coordinates.x = CommPlayer_GetXInFrontOfPlayerServer(netID);
|
coordinates.x = CommPlayer_GetXInFrontOfPlayerServer(netID);
|
||||||
coordinates.z = CommPlayer_GetZInFrontOfPlayerServer(netID);
|
coordinates.z = CommPlayer_GetZInFrontOfPlayerServer(netID);
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#include "comm_player_manager.h"
|
#include "comm_player_manager.h"
|
||||||
#include "communication_information.h"
|
#include "communication_information.h"
|
||||||
#include "communication_system.h"
|
#include "communication_system.h"
|
||||||
|
#include "coordinates.h"
|
||||||
#include "field_system.h"
|
#include "field_system.h"
|
||||||
#include "field_task.h"
|
#include "field_task.h"
|
||||||
#include "game_records.h"
|
#include "game_records.h"
|
||||||
|
|
@ -803,7 +804,7 @@ void MiningEnv_Free(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL Mining_CheckForMiningSpotInteract(int netID, Coordinates *coordinates)
|
BOOL Mining_CheckForMiningSpotInteract(int netID, CoordinatesU16 *coordinates)
|
||||||
{
|
{
|
||||||
MiningSpot *miningSpot = Mining_GetMiningSpotAtCoordinates(coordinates->x, coordinates->z);
|
MiningSpot *miningSpot = Mining_GetMiningSpotAtCoordinates(coordinates->x, coordinates->z);
|
||||||
u8 buffer = netID;
|
u8 buffer = netID;
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include "comm_player_manager.h"
|
#include "comm_player_manager.h"
|
||||||
#include "communication_information.h"
|
#include "communication_information.h"
|
||||||
#include "communication_system.h"
|
#include "communication_system.h"
|
||||||
|
#include "coordinates.h"
|
||||||
#include "field_system.h"
|
#include "field_system.h"
|
||||||
#include "field_task.h"
|
#include "field_task.h"
|
||||||
#include "heap.h"
|
#include "heap.h"
|
||||||
|
|
@ -142,7 +143,7 @@ static const WindowTemplate sYesNoWindowTemplate = {
|
||||||
.baseTile = BASE_TILE_YES_NO_MENU
|
.baseTile = BASE_TILE_YES_NO_MENU
|
||||||
};
|
};
|
||||||
|
|
||||||
int UndergroundPC_GetPCOwnerNetIDAtCoordinates(Coordinates *coordinates, int dir)
|
int UndergroundPC_GetPCOwnerNetIDAtCoordinates(CoordinatesU16 *coordinates, int dir)
|
||||||
{
|
{
|
||||||
int netID;
|
int netID;
|
||||||
int x = coordinates->x;
|
int x = coordinates->x;
|
||||||
|
|
@ -176,7 +177,7 @@ int UndergroundPC_GetPCOwnerNetIDAtCoordinates(Coordinates *coordinates, int dir
|
||||||
return NETID_NONE;
|
return NETID_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL UndergroundPC_TryUsePC(int netID, Coordinates *coordinates)
|
BOOL UndergroundPC_TryUsePC(int netID, CoordinatesU16 *coordinates)
|
||||||
{
|
{
|
||||||
int pcNetID = UndergroundPC_GetPCOwnerNetIDAtCoordinates(coordinates, CommPlayer_DirServer(netID));
|
int pcNetID = UndergroundPC_GetPCOwnerNetIDAtCoordinates(coordinates, CommPlayer_DirServer(netID));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
#include "comm_player_manager.h"
|
#include "comm_player_manager.h"
|
||||||
#include "communication_information.h"
|
#include "communication_information.h"
|
||||||
#include "communication_system.h"
|
#include "communication_system.h"
|
||||||
|
#include "coordinates.h"
|
||||||
#include "field_map_change.h"
|
#include "field_map_change.h"
|
||||||
#include "field_system.h"
|
#include "field_system.h"
|
||||||
#include "field_task.h"
|
#include "field_task.h"
|
||||||
|
|
@ -2303,7 +2304,7 @@ static enum Good SecretBases_GetGoodWithCollisionAtCoordinates(SecretBase *secre
|
||||||
return UG_GOOD_NONE;
|
return UG_GOOD_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL SecretBases_CheckForInteractableGood(int netID, Coordinates *coordinates)
|
BOOL SecretBases_CheckForInteractableGood(int netID, CoordinatesU16 *coordinates)
|
||||||
{
|
{
|
||||||
int x = coordinates->x;
|
int x = coordinates->x;
|
||||||
int z = coordinates->z;
|
int z = coordinates->z;
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#include "comm_player_manager.h"
|
#include "comm_player_manager.h"
|
||||||
#include "communication_system.h"
|
#include "communication_system.h"
|
||||||
|
#include "coordinates.h"
|
||||||
#include "field_system.h"
|
#include "field_system.h"
|
||||||
#include "game_records.h"
|
#include "game_records.h"
|
||||||
#include "heap.h"
|
#include "heap.h"
|
||||||
|
|
@ -158,7 +159,7 @@ void Spheres_AdvanceBuriedSphereSparkleTimer(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Coordinates *Spheres_GetCoordinatesOfBuriedSphereAtOrderedIndex(Coordinates *coordinates, int index)
|
static CoordinatesU16 *Spheres_GetCoordinatesOfBuriedSphereAtOrderedIndex(CoordinatesU16 *coordinates, int index)
|
||||||
{
|
{
|
||||||
if (spheresEnv->buriedSpheresByCoordinates[index] == NULL) {
|
if (spheresEnv->buriedSpheresByCoordinates[index] == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -172,7 +173,7 @@ static Coordinates *Spheres_GetCoordinatesOfBuriedSphereAtOrderedIndex(Coordinat
|
||||||
|
|
||||||
static void Spheres_AddBuriedSphereToCoordinatesOrdering(BuriedSphere *sphere)
|
static void Spheres_AddBuriedSphereToCoordinatesOrdering(BuriedSphere *sphere)
|
||||||
{
|
{
|
||||||
Coordinates coordinates = {
|
CoordinatesU16 coordinates = {
|
||||||
.x = sphere->x,
|
.x = sphere->x,
|
||||||
.z = sphere->z
|
.z = sphere->z
|
||||||
};
|
};
|
||||||
|
|
@ -221,7 +222,7 @@ static BuriedSphere *Spheres_Dummy(BuriedSphere *sphere)
|
||||||
|
|
||||||
static BuriedSphere *Spheres_GetBuriedSphereAtCoordinates(int x, int z)
|
static BuriedSphere *Spheres_GetBuriedSphereAtCoordinates(int x, int z)
|
||||||
{
|
{
|
||||||
Coordinates coordinates = {
|
CoordinatesU16 coordinates = {
|
||||||
.x = x,
|
.x = x,
|
||||||
.z = z
|
.z = z
|
||||||
};
|
};
|
||||||
|
|
@ -286,7 +287,7 @@ void TouchRadarSearch_Init(TouchRadarSearchContext *ctx, int radius)
|
||||||
ctx->iterator = 0;
|
ctx->iterator = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL TouchRadarSearch_GetNextCoords(TouchRadarSearchContext *ctx, TouchRadarCoordinates *out)
|
BOOL TouchRadarSearch_GetNextCoords(TouchRadarSearchContext *ctx, CoordinatesS16 *out)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int iterator = ctx->iterator;
|
int iterator = ctx->iterator;
|
||||||
|
|
|
||||||
|
|
@ -71,11 +71,6 @@ typedef struct MessageQueue {
|
||||||
charcode_t tempStringChars[TEMP_STRING_SIZE];
|
charcode_t tempStringChars[TEMP_STRING_SIZE];
|
||||||
} MessageQueue;
|
} MessageQueue;
|
||||||
|
|
||||||
typedef struct PlayerCoordinates {
|
|
||||||
int x;
|
|
||||||
int z;
|
|
||||||
} PlayerCoordinates;
|
|
||||||
|
|
||||||
typedef struct PlayerMarkerData {
|
typedef struct PlayerMarkerData {
|
||||||
int x;
|
int x;
|
||||||
int z;
|
int z;
|
||||||
|
|
@ -91,7 +86,7 @@ typedef struct OtherMarkerData {
|
||||||
|
|
||||||
struct UndergroundTopScreenContext_t {
|
struct UndergroundTopScreenContext_t {
|
||||||
int state;
|
int state;
|
||||||
PlayerCoordinates playerCoords[MAX_CONNECTED_PLAYERS];
|
CoordinatesInt playerCoords[MAX_CONNECTED_PLAYERS];
|
||||||
PlayerMarkerData playerMarkers[MAX_CONNECTED_PLAYERS];
|
PlayerMarkerData playerMarkers[MAX_CONNECTED_PLAYERS];
|
||||||
OtherMarkerData otherMarkers[MAX_RADAR_BLIPS + 1];
|
OtherMarkerData otherMarkers[MAX_RADAR_BLIPS + 1];
|
||||||
FieldSystem *parent;
|
FieldSystem *parent;
|
||||||
|
|
@ -114,8 +109,8 @@ static int positionsDummy[MAX_CONNECTED_PLAYERS][2];
|
||||||
|
|
||||||
static void UndergroundTopScreen_InitBackgrounds(BgConfig *bgConfig, Window *window);
|
static void UndergroundTopScreen_InitBackgrounds(BgConfig *bgConfig, Window *window);
|
||||||
static void UndergroundMap_InitSpriteResources(UndergroundTopScreenContext *ctx);
|
static void UndergroundMap_InitSpriteResources(UndergroundTopScreenContext *ctx);
|
||||||
static void UndergroundMap_FetchPlayerPositions(PlayerAvatar *const playerAvatar, PlayerCoordinates playerCoords[], PlayerMarkerData markerData[]);
|
static void UndergroundMap_FetchPlayerPositions(PlayerAvatar *const playerAvatar, CoordinatesInt playerCoords[], PlayerMarkerData markerData[]);
|
||||||
static void UndergroundMap_InitPlayerPositions(PlayerCoordinates playerCoords[], PlayerMarkerData markerData[]);
|
static void UndergroundMap_InitPlayerPositions(CoordinatesInt playerCoords[], PlayerMarkerData markerData[]);
|
||||||
static void UndergroundMap_DrawPlayerMarkers(PlayerMarkerData markerData[], Sprite *sprites[]);
|
static void UndergroundMap_DrawPlayerMarkers(PlayerMarkerData markerData[], Sprite *sprites[]);
|
||||||
static void UndergroundTopScreen_FreeBackgrounds(BgConfig *bgConfig);
|
static void UndergroundTopScreen_FreeBackgrounds(BgConfig *bgConfig);
|
||||||
static void UndergroundTopScreen_HandleMessageQueue(BgConfig *unused, Window *window, int *printerID, int *state, int *timer, MessageQueue *queue);
|
static void UndergroundTopScreen_HandleMessageQueue(BgConfig *unused, Window *window, int *printerID, int *state, int *timer, MessageQueue *queue);
|
||||||
|
|
@ -251,7 +246,7 @@ static void UndergroundTopScreen_Task(SysTask *sysTask, void *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UndergroundMap_InitPlayerPositions(PlayerCoordinates playerCoords[], PlayerMarkerData markerData[])
|
static void UndergroundMap_InitPlayerPositions(CoordinatesInt playerCoords[], PlayerMarkerData markerData[])
|
||||||
{
|
{
|
||||||
for (int netID = 0; netID < MAX_CONNECTED_PLAYERS; netID++) {
|
for (int netID = 0; netID < MAX_CONNECTED_PLAYERS; netID++) {
|
||||||
playerCoords[netID].x = 0;
|
playerCoords[netID].x = 0;
|
||||||
|
|
@ -265,7 +260,7 @@ static void UndergroundMap_InitPlayerPositions(PlayerCoordinates playerCoords[],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UndergroundMap_FetchPlayerPositions(PlayerAvatar *const playerAvatar, PlayerCoordinates playerCoords[], PlayerMarkerData markerData[])
|
static void UndergroundMap_FetchPlayerPositions(PlayerAvatar *const playerAvatar, CoordinatesInt playerCoords[], PlayerMarkerData markerData[])
|
||||||
{
|
{
|
||||||
for (int netID = 0; netID < MAX_CONNECTED_PLAYERS; netID++) {
|
for (int netID = 0; netID < MAX_CONNECTED_PLAYERS; netID++) {
|
||||||
playerCoords[netID].x = CommPlayer_GetXIfActive(netID);
|
playerCoords[netID].x = CommPlayer_GetXIfActive(netID);
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#include "comm_player_manager.h"
|
#include "comm_player_manager.h"
|
||||||
#include "communication_information.h"
|
#include "communication_information.h"
|
||||||
#include "communication_system.h"
|
#include "communication_system.h"
|
||||||
|
#include "coordinates.h"
|
||||||
#include "field_system.h"
|
#include "field_system.h"
|
||||||
#include "field_task.h"
|
#include "field_task.h"
|
||||||
#include "game_records.h"
|
#include "game_records.h"
|
||||||
|
|
@ -121,11 +122,6 @@ typedef struct TrapRadarResult {
|
||||||
u8 netID;
|
u8 netID;
|
||||||
} TrapRadarResult;
|
} TrapRadarResult;
|
||||||
|
|
||||||
typedef struct fx32Coordinates {
|
|
||||||
fx32 x;
|
|
||||||
fx32 y;
|
|
||||||
} fx32Coordinates;
|
|
||||||
|
|
||||||
typedef struct TrapRadarContext {
|
typedef struct TrapRadarContext {
|
||||||
TrapRadarResult results[MAX_PLACED_TRAPS + MAX_SPAWNED_TRAPS];
|
TrapRadarResult results[MAX_PLACED_TRAPS + MAX_SPAWNED_TRAPS];
|
||||||
u8 index;
|
u8 index;
|
||||||
|
|
@ -182,7 +178,7 @@ typedef struct LeafTrapContext {
|
||||||
int state;
|
int state;
|
||||||
int printerID;
|
int printerID;
|
||||||
u16 leafAngleIdx[MAX_TRAP_EFFECT_SPRITES];
|
u16 leafAngleIdx[MAX_TRAP_EFFECT_SPRITES];
|
||||||
Coordinates2D leafCoords[MAX_TRAP_EFFECT_SPRITES];
|
CoordinatesU16 leafCoords[MAX_TRAP_EFFECT_SPRITES];
|
||||||
u8 micBlowIntensities[40];
|
u8 micBlowIntensities[40];
|
||||||
u8 micBlowDelay[MAX_TRAP_EFFECT_SPRITES];
|
u8 micBlowDelay[MAX_TRAP_EFFECT_SPRITES];
|
||||||
u8 blowIntensityIndex;
|
u8 blowIntensityIndex;
|
||||||
|
|
@ -242,7 +238,7 @@ typedef struct BubbleTrapContext {
|
||||||
int printerID;
|
int printerID;
|
||||||
u8 bubbleSizes[MAX_BUBBLES];
|
u8 bubbleSizes[MAX_BUBBLES];
|
||||||
u16 bubbleAngleIdx[MAX_BUBBLES];
|
u16 bubbleAngleIdx[MAX_BUBBLES];
|
||||||
fx32Coordinates bubbleCoords[MAX_BUBBLES];
|
CoordinatesFX32 bubbleCoords[MAX_BUBBLES];
|
||||||
BOOL isBubblePopped[MAX_BUBBLES];
|
BOOL isBubblePopped[MAX_BUBBLES];
|
||||||
u16 bubbleScaleTimer[MAX_BUBBLES];
|
u16 bubbleScaleTimer[MAX_BUBBLES];
|
||||||
u8 timer;
|
u8 timer;
|
||||||
|
|
@ -1016,7 +1012,7 @@ int CommPacketSizeOf_AllTrapsPlacedPlayer(void)
|
||||||
return sizeof(BuriedTrap) * MAX_PLACED_TRAPS;
|
return sizeof(BuriedTrap) * MAX_PLACED_TRAPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Coordinates *Traps_GetCoordinatesOfBuriedTrapAtOrderedIndex(Coordinates *coordinates, int index)
|
static CoordinatesU16 *Traps_GetCoordinatesOfBuriedTrapAtOrderedIndex(CoordinatesU16 *coordinates, int index)
|
||||||
{
|
{
|
||||||
if (trapsEnv->buriedTrapsByCoordinates[index] == NULL) {
|
if (trapsEnv->buriedTrapsByCoordinates[index] == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -1030,7 +1026,7 @@ static Coordinates *Traps_GetCoordinatesOfBuriedTrapAtOrderedIndex(Coordinates *
|
||||||
|
|
||||||
static void Traps_AddBuriedTrapToCoordinatesOrdering(BuriedTrap *trap)
|
static void Traps_AddBuriedTrapToCoordinatesOrdering(BuriedTrap *trap)
|
||||||
{
|
{
|
||||||
Coordinates coordinates = {
|
CoordinatesU16 coordinates = {
|
||||||
.x = trap->x,
|
.x = trap->x,
|
||||||
.z = trap->z
|
.z = trap->z
|
||||||
};
|
};
|
||||||
|
|
@ -1480,12 +1476,12 @@ void Traps_ClearLinksReceivedPlacedTraps(void)
|
||||||
trapsEnv->linksReceivedPlacedTraps = FALSE;
|
trapsEnv->linksReceivedPlacedTraps = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CommPacketSizeOf_Coordinates(void)
|
int CommPacketSizeOf_CoordinatesU16(void)
|
||||||
{
|
{
|
||||||
return sizeof(Coordinates);
|
return sizeof(CoordinatesU16);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL Traps_TryDisengageTrap(int netID, Coordinates *unused, u8 flags)
|
BOOL Traps_TryDisengageTrap(int netID, CoordinatesU16 *unused, u8 flags)
|
||||||
{
|
{
|
||||||
Underground *underground = SaveData_GetUnderground(FieldSystem_GetSaveData(trapsEnv->fieldSystem));
|
Underground *underground = SaveData_GetUnderground(FieldSystem_GetSaveData(trapsEnv->fieldSystem));
|
||||||
|
|
||||||
|
|
@ -1594,7 +1590,7 @@ static int Traps_GetBuriedTrapSetterNetID(BuriedTrap *trap)
|
||||||
|
|
||||||
static BuriedTrap *Traps_GetTrapAtCoordinates(int x, int z)
|
static BuriedTrap *Traps_GetTrapAtCoordinates(int x, int z)
|
||||||
{
|
{
|
||||||
Coordinates coordinates = {
|
CoordinatesU16 coordinates = {
|
||||||
.x = x,
|
.x = x,
|
||||||
.z = z
|
.z = z
|
||||||
};
|
};
|
||||||
|
|
@ -2372,7 +2368,7 @@ static void Traps_EndSmokeTrapEffectClient(int netID, BOOL allowToolStepBack)
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true when less than 13 tiles of smoke remain
|
// returns true when less than 13 tiles of smoke remain
|
||||||
static BOOL Traps_ProcessSmoke(Coordinates2D *touchCoordinates, BgConfig *bgConfig, SmokeTrapContext *ctx)
|
static BOOL Traps_ProcessSmoke(CoordinatesU16 *touchCoordinates, BgConfig *bgConfig, SmokeTrapContext *ctx)
|
||||||
{
|
{
|
||||||
int smokeTilesLeft = 0;
|
int smokeTilesLeft = 0;
|
||||||
u8 *tilemap = Bg_GetTilemapBuffer(bgConfig, BG_LAYER_MAIN_2);
|
u8 *tilemap = Bg_GetTilemapBuffer(bgConfig, BG_LAYER_MAIN_2);
|
||||||
|
|
@ -2514,10 +2510,10 @@ static void Traps_SmokeTrapClientTask(SysTask *sysTask, void *data)
|
||||||
break;
|
break;
|
||||||
case SMOKE_TRAP_STATE_MAIN:
|
case SMOKE_TRAP_STATE_MAIN:
|
||||||
if (gSystem.touchHeld) {
|
if (gSystem.touchHeld) {
|
||||||
Coordinates2D touchCoordinates;
|
CoordinatesU16 touchCoordinates = {
|
||||||
|
.x = gSystem.touchX,
|
||||||
touchCoordinates.x = gSystem.touchX;
|
.y = gSystem.touchY
|
||||||
touchCoordinates.y = gSystem.touchY;
|
};
|
||||||
|
|
||||||
if (Traps_ProcessSmoke(&touchCoordinates, ctx->bgConfig, ctx)) {
|
if (Traps_ProcessSmoke(&touchCoordinates, ctx->bgConfig, ctx)) {
|
||||||
if (ctx->isTool) {
|
if (ctx->isTool) {
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ static const CommCmdTable Unk_020F68A4[] = {
|
||||||
{ Traps_ProcessTriggeredTrapBits, CommPacketSizeOf_NetId, NULL },
|
{ Traps_ProcessTriggeredTrapBits, CommPacketSizeOf_NetId, NULL },
|
||||||
{ Traps_QueueSendTrapRadarResults, CommPacketSizeOf_Nothing, NULL },
|
{ Traps_QueueSendTrapRadarResults, CommPacketSizeOf_Nothing, NULL },
|
||||||
{ Traps_ReceiveTrapRadarResults, CommPacketSizeOf_TrapRadarResult, NULL },
|
{ Traps_ReceiveTrapRadarResults, CommPacketSizeOf_TrapRadarResult, NULL },
|
||||||
{ UndergroundMan_ProcessTouchInput, CommPacketSizeOf_Coordinates, NULL },
|
{ UndergroundMan_ProcessTouchInput, CommPacketSizeOf_CoordinatesU16, NULL },
|
||||||
{ UndergroundMan_ProcessTouchRadarTrapResults, CommPacketSizeOf_Variable, NULL },
|
{ UndergroundMan_ProcessTouchRadarTrapResults, CommPacketSizeOf_Variable, NULL },
|
||||||
{ UndergroundMan_ProcessTouchRadarMiningSpotResults, CommPacketSizeOf_Variable, NULL }, // 50
|
{ UndergroundMan_ProcessTouchRadarMiningSpotResults, CommPacketSizeOf_Variable, NULL }, // 50
|
||||||
{ Traps_ProcessDisengagedTrap, CommPacketSizeOf_TriggeredTrap, NULL },
|
{ Traps_ProcessDisengagedTrap, CommPacketSizeOf_TriggeredTrap, NULL },
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user