mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-20 13:23:45 -07:00
Replace malloc and vector with fixed-size arrays
This commit is contained in:
parent
e1b72e4ea9
commit
836d377ff0
1 changed files with 4 additions and 5 deletions
|
@ -13,7 +13,7 @@
|
||||||
#define GRAVEYARD_SCENE_FILEPATH "scenes/shared/spot02_scene/spot02_scene"
|
#define GRAVEYARD_SCENE_FILEPATH "scenes/shared/spot02_scene/spot02_scene"
|
||||||
#define CUSTOM_SURFACE_TYPE 32
|
#define CUSTOM_SURFACE_TYPE 32
|
||||||
|
|
||||||
const static std::vector<std::pair<std::pair<u16, u16>, std::pair<u16, u16>>> graveyardGeometryPatches = {
|
const static std::array<std::pair<std::pair<u16, u16>, std::pair<u16, u16>>, 6> graveyardGeometryPatches = { {
|
||||||
// { { startPolygon, endPolygon }, { originalSurfaceType, patchedSurfaceType } }
|
// { { startPolygon, endPolygon }, { originalSurfaceType, patchedSurfaceType } }
|
||||||
{ { 487, 509 }, { 20, CUSTOM_SURFACE_TYPE } }, // Floor around graves
|
{ { 487, 509 }, { 20, CUSTOM_SURFACE_TYPE } }, // Floor around graves
|
||||||
{ { 651, 658 }, { 20, CUSTOM_SURFACE_TYPE } }, // Floor around Royal Family Tomb
|
{ { 651, 658 }, { 20, CUSTOM_SURFACE_TYPE } }, // Floor around Royal Family Tomb
|
||||||
|
@ -21,7 +21,7 @@ const static std::vector<std::pair<std::pair<u16, u16>, std::pair<u16, u16>>> gr
|
||||||
{ { 623, 630 }, { 0, 15 } }, // Grave ledges (Redead)
|
{ { 623, 630 }, { 0, 15 } }, // Grave ledges (Redead)
|
||||||
{ { 633, 640 }, { 0, 15 } }, // Grave ledges (Dampe)
|
{ { 633, 640 }, { 0, 15 } }, // Grave ledges (Dampe)
|
||||||
{ { 643, 650 }, { 0, 15 } }, // Grave ledges (Royal Family)
|
{ { 643, 650 }, { 0, 15 } }, // Grave ledges (Royal Family)
|
||||||
};
|
} };
|
||||||
|
|
||||||
CollisionHeader* getGraveyardCollisionHeader() {
|
CollisionHeader* getGraveyardCollisionHeader() {
|
||||||
/*
|
/*
|
||||||
|
@ -46,9 +46,8 @@ CollisionHeader* getGraveyardCollisionHeader() {
|
||||||
* into graves. NTSC 1.0's graveyard has 31 surface types, while later versions have 32. The contents of the lists
|
* into graves. NTSC 1.0's graveyard has 31 surface types, while later versions have 32. The contents of the lists
|
||||||
* are shifted somewhat between versions, so to be safe we just create an extra slot that is not in any version.
|
* are shifted somewhat between versions, so to be safe we just create an extra slot that is not in any version.
|
||||||
*/
|
*/
|
||||||
size_t surfaceTypeListSize = sizeof(SurfaceType) * 33;
|
SurfaceType newSurfaceTypes[33];
|
||||||
SurfaceType* newSurfaceTypes = (SurfaceType*)malloc(surfaceTypeListSize);
|
memcpy(newSurfaceTypes, graveyardColHeader->surfaceTypeList, sizeof(SurfaceType) * 33);
|
||||||
memcpy(newSurfaceTypes, graveyardColHeader->surfaceTypeList, surfaceTypeListSize);
|
|
||||||
newSurfaceTypes[CUSTOM_SURFACE_TYPE].data[0] = 0x24000004;
|
newSurfaceTypes[CUSTOM_SURFACE_TYPE].data[0] = 0x24000004;
|
||||||
newSurfaceTypes[CUSTOM_SURFACE_TYPE].data[1] = 0xFC8;
|
newSurfaceTypes[CUSTOM_SURFACE_TYPE].data[1] = 0xFC8;
|
||||||
graveyardColHeader->surfaceTypeList = newSurfaceTypes;
|
graveyardColHeader->surfaceTypeList = newSurfaceTypes;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue