Add support for 16 areas (#502)

This commit is contained in:
defacube 2023-11-07 19:29:09 +11:00 committed by Agent X
parent 8ab0e17876
commit 36e9274ef5
7 changed files with 16 additions and 14 deletions

View File

@ -388,7 +388,7 @@ INSTANT_WARP_INDEX_START = 0x00
INSTANT_WARP_INDEX_STOP = 0x04
--- @type integer
MAX_AREAS = 8
MAX_AREAS = 16
--- @type integer
WARP_TRANSITION_FADE_FROM_BOWSER = 0x12

View File

@ -373,7 +373,7 @@ static void level_reset_globals(void) {
gEnvFxMode = ENVFX_MODE_NONE;
// clear area's level pool pointers
for (int i = 0; i < 8; i++) {
for (int i = 0; i < MAX_AREAS; i++) {
gAreas[i].unk04 = NULL;
}
@ -407,7 +407,7 @@ static void level_cmd_free_level_pool(void) {
gLevelPool = NULL;
}
for (i = 0; i < 8; i++) {
for (i = 0; i < MAX_AREAS; i++) {
if (gAreaData[i].terrainData != NULL) {
alloc_surface_pools();
break;
@ -421,7 +421,7 @@ static void level_cmd_begin_area(void) {
u8 areaIndex = CMD_GET(u8, 2);
void *geoLayoutAddr = CMD_GET(void *, 4);
if (areaIndex < 8) {
if (areaIndex < MAX_AREAS) {
u32 id = 0;
struct GraphNodeRoot *screenArea = (struct GraphNodeRoot *) dynos_model_load_geo(&id, MODEL_POOL_LEVEL, geoLayoutAddr, false);
struct GraphNodeCamera *node = (struct GraphNodeCamera *) screenArea->views[0];

View File

@ -228,7 +228,7 @@ void clear_areas(void) {
gPlayerSpawnInfos[0].areaIndex = -1;
gPlayerSpawnInfos[1].areaIndex = -1;
for (s32 i = 0; i < 8; i++) {
for (s32 i = 0; i < MAX_AREAS; i++) {
gAreaData[i].index = i;
gAreaData[i].flags = 0;
gAreaData[i].terrainType = 0;
@ -258,7 +258,7 @@ void clear_area_graph_nodes(void) {
gWarpTransition.isActive = FALSE;
}
for (s32 i = 0; i < 8; i++) {
for (s32 i = 0; i < MAX_AREAS; i++) {
if (gAreaData[i].unk04 != NULL) {
geo_call_global_function_nodes(&gAreaData[i].unk04->node, GEO_CONTEXT_AREA_INIT);
gAreaData[i].unk04 = NULL;

View File

@ -26,7 +26,7 @@ struct ObjectWarpNode
#define INSTANT_WARP_INDEX_START 0x00 // Equal and greater than Surface 0x1B
#define INSTANT_WARP_INDEX_STOP 0x04 // Less than Surface 0x1F
#define MAX_AREAS 8
#define MAX_AREAS 16
struct InstantWarp
{

View File

@ -343,7 +343,7 @@ char gSmluaConstants[] = ""
"COURSE_MIN = 1\n"
"INSTANT_WARP_INDEX_START = 0x00\n"
"INSTANT_WARP_INDEX_STOP = 0x04\n"
"MAX_AREAS = 8\n"
"MAX_AREAS = 16\n"
"WARP_TRANSITION_FADE_FROM_COLOR = 0x00\n"
"WARP_TRANSITION_FADE_INTO_COLOR = 0x01\n"
"WARP_TRANSITION_FADE_FROM_STAR = 0x08\n"
@ -4319,4 +4319,4 @@ char gSmluaConstants[] = ""
"VERSION_REGION = 'US'\n"
"MAX_VERSION_LENGTH = 32\n"
"MAX_LOCAL_VERSION_LENGTH = 36\n"
;
;

View File

@ -6,6 +6,7 @@
#include "game/interaction.h"
#include "game/level_update.h"
#include "game/macro_special_objects.h"
#include "game/area.h"
#include "macro_presets.h"
#include "object_constants.h"
#include "object_fields.h"
@ -115,7 +116,7 @@ void network_send_level_macro(struct NetworkPlayer* destNp) {
return;
}
for (s32 i = 0; i < 8; i++) {
for (s32 i = 0; i < MAX_AREAS; i++) {
network_send_level_macro_area(destNp, i);
}
}
@ -134,7 +135,7 @@ void network_receive_level_macro(struct Packet* p) {
u8 thisAreaIndex;
packet_read(p, &thisAreaIndex, sizeof(u8));
if (thisAreaIndex >= 8) {
if (thisAreaIndex >= MAX_AREAS) {
LOG_ERROR("Receiving 'location response' with invalid areaIndex!");
return;
}
@ -231,4 +232,4 @@ void network_receive_level_macro(struct Packet* p) {
}
}
}
}
}

View File

@ -1,5 +1,6 @@
#include <stdio.h>
#include "../network.h"
#include "game/area.h"
#include "game/interaction.h"
#include "game/object_list_processor.h"
#include "game/object_helpers.h"
@ -84,7 +85,7 @@ void network_send_level_spawn_info(struct NetworkPlayer* destNp) {
return;
}
for (s32 i = 0; i < 8; i++) {
for (s32 i = 0; i < MAX_AREAS; i++) {
network_send_level_spawn_info_area(destNp, i);
}
}
@ -135,4 +136,4 @@ void network_receive_level_spawn_info(struct Packet* p) {
spawnInfo = spawnInfo->next;
spawnInfoIndex++;
}
}
}