mirror of https://github.com/zeldaret/tmc.git
clean usage of transitions in existing code
This commit is contained in:
parent
2bdf0ae7df
commit
35eef68d96
|
@ -2,6 +2,7 @@
|
|||
#define AREA_H
|
||||
|
||||
#include "global.h"
|
||||
#include "transitions.h"
|
||||
|
||||
#define MAX_ROOMS 64
|
||||
|
||||
|
@ -14,7 +15,7 @@ typedef struct {
|
|||
void* map;
|
||||
void* metatiles;
|
||||
void* bg_anim;
|
||||
void* exits;
|
||||
const Transition* exits;
|
||||
void** properties;
|
||||
} RoomResInfo;
|
||||
static_assert(sizeof(RoomResInfo) == 0x20);
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef TMC_TRANSITIONS_H
|
||||
#define TMC_TRANSITIONS_H
|
||||
#include "global.h"
|
||||
|
||||
typedef struct Transition {
|
||||
u8 warp_type;
|
||||
u8 subtype;
|
||||
u16 startX;
|
||||
u16 startY;
|
||||
u16 endX;
|
||||
u16 endY;
|
||||
u8 shape;
|
||||
u8 area;
|
||||
u8 room;
|
||||
u8 height;
|
||||
u8 transition_type;
|
||||
u8 facing_direction;
|
||||
u8 unk0;
|
||||
u8 unk1;
|
||||
u8 unk2;
|
||||
u8 unk3;
|
||||
} Transition;
|
||||
|
||||
extern const Transition gExitList_RoyalValley_ForestMaze[];
|
||||
extern const Transition gUnk_08134FBC[];
|
||||
extern const Transition gUnk_08135048[];
|
||||
extern const Transition gUnk_08135190[];
|
||||
extern const Transition gUnk_0813A76C[];
|
||||
extern const Transition* const* const gExitLists[];
|
||||
|
||||
#endif // TMC_TRANSITIONS_H
|
|
@ -1,25 +1,6 @@
|
|||
#include "global.h"
|
||||
#include "transitions.h"
|
||||
#include "area.h"
|
||||
|
||||
typedef struct Transition {
|
||||
u8 warp_type;
|
||||
u8 subtype;
|
||||
u16 startX;
|
||||
u16 startY;
|
||||
u16 endX;
|
||||
u16 endY;
|
||||
u8 shape;
|
||||
u8 area;
|
||||
u8 room;
|
||||
u8 height;
|
||||
u8 transition_type;
|
||||
u8 facing_direction;
|
||||
u8 unk0;
|
||||
u8 unk1;
|
||||
u8 unk2;
|
||||
u8 unk3;
|
||||
} Transition;
|
||||
|
||||
// this terminates a list of Transitions
|
||||
#define TransitionListEnd \
|
||||
{ -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
|
@ -420,7 +401,6 @@ const Transition gExitList_RoyalValley_Main[] = {
|
|||
{ 0x1, 0x0, 0x78, 0x328, 0x78, 0x98, 0x0, AREA_ROYAL_VALLEY, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
|
||||
TransitionListEnd,
|
||||
};
|
||||
|
||||
const Transition gExitList_RoyalValley_ForestMaze[] = {
|
||||
{ 0x0, 0x0, 0x0, 0x0, 0x78, 0x338, 0x30, AREA_ROYAL_VALLEY, 0x0, 0x1, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0 },
|
||||
TransitionListEnd,
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "subtask.h"
|
||||
#include "itemMetaData.h"
|
||||
#include "player.h"
|
||||
#include "transitions.h"
|
||||
|
||||
// Game task
|
||||
|
||||
|
@ -82,7 +83,6 @@ extern void** gAreaTilesets[];
|
|||
extern void** gAreaRoomMaps[];
|
||||
extern void* gAreaMetatiles[];
|
||||
extern void* gUnk_080B755C[];
|
||||
extern void** gExitLists[];
|
||||
extern void** gAreaTable[];
|
||||
|
||||
extern void CreateDialogBox(u32, u32);
|
||||
|
@ -1438,7 +1438,7 @@ static void InitRoomResInfo(RoomResInfo* info, RoomHeader* r_hdr, u32 area, u32
|
|||
info->map = *(gAreaRoomMaps[area] + room);
|
||||
info->metatiles = gAreaMetatiles[area];
|
||||
info->bg_anim = gUnk_080B755C[area];
|
||||
info->exits = *(gExitLists[area] + room);
|
||||
info->exits = gExitLists[area][room];
|
||||
if (gAreaTable[area] != NULL) {
|
||||
info->properties = *(gAreaTable[area] + room);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "asm.h"
|
||||
#include "item.h"
|
||||
#include "coord.h"
|
||||
#include "transitions.h"
|
||||
#include "functions.h"
|
||||
|
||||
/** Collisions. */
|
||||
|
@ -29,12 +30,6 @@ typedef enum {
|
|||
COL_EAST_ANY = 0xe000,
|
||||
} Collisions;
|
||||
|
||||
extern u8 gExitList_RoyalValley_ForestMaze[];
|
||||
extern u8 gUnk_08135190[];
|
||||
extern u8 gUnk_08134FBC[];
|
||||
extern u8 gUnk_08135048[];
|
||||
extern u8 gUnk_0813A76C[];
|
||||
|
||||
bool32 IsTileCollision(const u8*, s32, s32, u32);
|
||||
void CalculateEntityTileCollisions(Entity*, u32, u32);
|
||||
bool32 ProcessMovementInternal(Entity*, s32, s32, u32);
|
||||
|
@ -2269,28 +2264,27 @@ void ProcessMovementInternal2(Entity* this, u32 direction, u32 speed) {
|
|||
void sub_080AF250(s32 param_1) {
|
||||
gArea.pCurrentRoomInfo = GetCurrentRoomInfo();
|
||||
if (param_1 != 0) {
|
||||
(gArea.pCurrentRoomInfo)->exits = gUnk_08135190;
|
||||
gArea.pCurrentRoomInfo->exits = gUnk_08135190;
|
||||
} else {
|
||||
(gArea.pCurrentRoomInfo)->exits = gExitList_RoyalValley_ForestMaze;
|
||||
gArea.pCurrentRoomInfo->exits = gExitList_RoyalValley_ForestMaze;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080AF284(void) {
|
||||
if (CheckPlayerInRegion(0x78, gRoomControls.height - 0x50, 0x78, 0x50)) {
|
||||
gArea.pCurrentRoomInfo = GetCurrentRoomInfo();
|
||||
(gArea.pCurrentRoomInfo)->exits = gUnk_08135048;
|
||||
gArea.pCurrentRoomInfo->exits = gUnk_08135048;
|
||||
} else {
|
||||
if (GetInventoryValue(ITEM_FOURSWORD) == 0) {
|
||||
return;
|
||||
if (GetInventoryValue(ITEM_FOURSWORD) != 0) {
|
||||
gArea.pCurrentRoomInfo = GetCurrentRoomInfo();
|
||||
gArea.pCurrentRoomInfo->exits = gUnk_08134FBC;
|
||||
}
|
||||
gArea.pCurrentRoomInfo = GetCurrentRoomInfo();
|
||||
(gArea.pCurrentRoomInfo)->exits = gUnk_08134FBC;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080AF2E4(void) {
|
||||
if (GetInventoryValue(ITEM_FOURSWORD)) {
|
||||
gArea.pCurrentRoomInfo = GetCurrentRoomInfo();
|
||||
(gArea.pCurrentRoomInfo)->exits = gUnk_0813A76C;
|
||||
gArea.pCurrentRoomInfo->exits = gUnk_0813A76C;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue