mirror of
https://github.com/SAT-R/sa2.git
synced 2026-10-28 09:43:38 +00:00
extract pipe horn data
This commit is contained in:
1 parent
392263f2e7
commit
45d72635a5
11 files changed
+937
-543
No files matched your search
Vendored
+2
-1
@@ -228,7 +228,8 @@
|
||||
"keyboard.h": "c",
|
||||
"crane.h": "c",
|
||||
"clear_pipe.h": "c",
|
||||
"slowing_snow.h": "c"
|
||||
"slowing_snow.h": "c",
|
||||
"handlers_ia_pipe_horn_sequences.h": "c"
|
||||
},
|
||||
"asm-code-lens.donated": true,
|
||||
"editor.formatOnSave": true,
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
.section .rodata
|
||||
|
||||
.global gUnknown_080DFCF0
|
||||
gUnknown_080DFCF0:
|
||||
.incbin "baserom.gba", 0x000DFCF0, 0x50
|
||||
|
||||
.global gUnknown_080DFD40
|
||||
gUnknown_080DFD40:
|
||||
.incbin "baserom.gba", 0x000DFD40, 0x58
|
||||
|
||||
.global gUnknown_080DFD98
|
||||
gUnknown_080DFD98:
|
||||
.incbin "baserom.gba", 0x000DFD98, 0x40
|
||||
|
||||
.global gUnknown_080DFDD8
|
||||
gUnknown_080DFDD8:
|
||||
.incbin "baserom.gba", 0x000DFDD8, 0x58
|
||||
|
||||
.global gUnknown_080DFE30
|
||||
gUnknown_080DFE30:
|
||||
.incbin "baserom.gba", 0x000DFE30, 0x60
|
||||
|
||||
.global gUnknown_080DFE90
|
||||
gUnknown_080DFE90:
|
||||
.incbin "baserom.gba", 0x000DFE90, 0x24
|
||||
|
||||
.global gUnknown_080DFEB4
|
||||
gUnknown_080DFEB4:
|
||||
.incbin "baserom.gba", 0x000DFEB4, 0x1C
|
||||
|
||||
.global gUnknown_080DFED0
|
||||
gUnknown_080DFED0:
|
||||
.incbin "baserom.gba", 0x000DFED0, 0x14
|
||||
|
||||
.global gUnknown_080DFEE4
|
||||
gUnknown_080DFEE4:
|
||||
.incbin "baserom.gba", 0x000DFEE4, 0x58
|
||||
|
||||
.global gUnknown_080DFF3C
|
||||
gUnknown_080DFF3C:
|
||||
.incbin "baserom.gba", 0x000DFF3C, 0x60
|
||||
|
||||
.global gUnknown_080DFF9C
|
||||
gUnknown_080DFF9C:
|
||||
.incbin "baserom.gba", 0x000DFF9C, 0x58
|
||||
@@ -2,7 +2,7 @@
|
||||
#define GUARD_HANDLERS_IA_PIPE_HORN_SEQUENCES_H
|
||||
|
||||
#include "global.h"
|
||||
#include "game/interactables_2/music_plant/handlers_ia_pipe_horn.h"
|
||||
#include "game/interactables_2/music_plant/pipe_horn.h"
|
||||
|
||||
extern const Pipe_Data (*gUnknown_08C8793C[9])[];
|
||||
extern const Pipe_Data (*gUnknown_08C87960[3])[];
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifndef GUARD_INTERACTABLE_HANDLERS_IA_PIPE_HORN_H
|
||||
#define GUARD_INTERACTABLE_HANDLERS_IA_PIPE_HORN_H
|
||||
|
||||
#include "global.h"
|
||||
#include "game/entity.h"
|
||||
#include "game/interactables_2/music_plant/pipe_horn.h"
|
||||
|
||||
#define NUM_PIPE_HANDLERS 16
|
||||
|
||||
// VERY unsure about this union...
|
||||
typedef union {
|
||||
s16 _16[2];
|
||||
s32 _32; // Q_24_8?
|
||||
} PipeData_Weirdness;
|
||||
|
||||
typedef struct {
|
||||
u16 unk0;
|
||||
u16 unk2;
|
||||
|
||||
PipeData_Weirdness unk4;
|
||||
|
||||
} Pipe_Data;
|
||||
|
||||
typedef void (*PipeHandler)(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
|
||||
extern const PipeHandler gPipeHandlers[NUM_PIPE_HANDLERS];
|
||||
|
||||
#endif
|
||||
@@ -17,7 +17,7 @@ typedef struct {
|
||||
/* 0x10 */ s32 x2;
|
||||
/* 0x14 */ s32 y2;
|
||||
/* 0x18 */ u16 unk18;
|
||||
/* 0x1A */ u16 unk1A;
|
||||
/* 0x1A */ s16 unk1A;
|
||||
/* 0x1C */ s32 posX;
|
||||
/* 0x20 */ s32 posY;
|
||||
/* 0x24 */ u16 kind;
|
||||
@@ -27,4 +27,20 @@ typedef struct {
|
||||
/* 0x2D */ u8 spriteY;
|
||||
} Sprite_Pipe_Horn;
|
||||
|
||||
#define NUM_PIPE_HANDLERS 16
|
||||
|
||||
// VERY unsure about this union...
|
||||
typedef union {
|
||||
s16 _16[2];
|
||||
s32 _32; // Q_24_8?
|
||||
} PipeData_Weirdness;
|
||||
|
||||
typedef struct {
|
||||
u16 unk0;
|
||||
u16 unk2;
|
||||
|
||||
PipeData_Weirdness unk4;
|
||||
|
||||
} Pipe_Data;
|
||||
|
||||
#endif // GUARD_INTERACTABLE_PIPE_HORN_H
|
||||
@@ -180,7 +180,6 @@ SECTIONS
|
||||
build/sa2/src/game/interactables_2/music_plant/guitar_string.o(.text);
|
||||
build/sa2/src/game/interactables_2/music_plant/keyboard.o(.text);
|
||||
build/sa2/src/game/interactables_2/music_plant/german_flute.o(.text);
|
||||
build/sa2/src/game/interactables_2/music_plant/handlers_ia_pipe_horn.o(.text);
|
||||
build/sa2/src/game/interactables_2/music_plant/pipe_horn.o(.text);
|
||||
build/sa2/src/game/interactables_2/ice_paradise/slowing_snow.o(.text);
|
||||
build/sa2/src/game/interactables_2/ice_paradise/funnel_sphere.o(.text);
|
||||
@@ -341,8 +340,6 @@ SECTIONS
|
||||
build/sa2/src/game/interactables_2/music_plant/note_block.o(.rodata);
|
||||
build/sa2/src/game/interactables_2/music_plant/keyboard.o(.rodata);
|
||||
build/sa2/src/game/interactables_2/music_plant/german_flute.o(.rodata);
|
||||
build/sa2/src/game/interactables_2/music_plant/handlers_ia_pipe_horn.o(.rodata);
|
||||
build/sa2/data/handlers_ia_pipe_horn_data.o(.rodata);
|
||||
build/sa2/src/game/interactables_2/music_plant/pipe_horn.o(.rodata);
|
||||
build/sa2/src/game/interactables_2/tec_base/note_block.o(.rodata);
|
||||
build/sa2/src/game/interactables_2/tec_base/light_bridge.o(.rodata);
|
||||
|
||||
Vendored
+7
-7
@@ -30,13 +30,13 @@ def format_hex(val):
|
||||
|
||||
with open('baserom.gba', 'rb') as rom:
|
||||
rom.seek(address)
|
||||
# for i in range(length // 2):
|
||||
# print(f"{read_u16(rom)}, ", end="")
|
||||
for i in range(length // 12):
|
||||
print("{ ", end="")
|
||||
for j in range(6):
|
||||
print(f"{read_u16(rom)}" + ", ", end="")
|
||||
print("},")
|
||||
for i in range(length // 2):
|
||||
print(f"{read_u16(rom)}, ")
|
||||
# for i in range(length // 4):
|
||||
# print("{ ", end="")
|
||||
# for j in range(2):
|
||||
# print(f"Q_8_8({read_s16(rom) / 256})" + ", ", end="")
|
||||
# print("},")
|
||||
|
||||
# print("{ ", end="")
|
||||
# for i in range(length):
|
||||
|
||||
Vendored
+48
@@ -0,0 +1,48 @@
|
||||
from io import BufferedReader
|
||||
import os
|
||||
import sys
|
||||
import struct
|
||||
|
||||
address = int(sys.argv[1], 16)
|
||||
length = int(sys.argv[2], 16)
|
||||
|
||||
def read_u8(rom: BufferedReader):
|
||||
return struct.unpack('B', rom.read(1))[0]
|
||||
|
||||
def read_s8(rom: BufferedReader):
|
||||
return struct.unpack('b', rom.read(1))[0]
|
||||
|
||||
def read_u16(rom: BufferedReader):
|
||||
return struct.unpack('H', rom.read(2))[0]
|
||||
|
||||
def read_s16(rom: BufferedReader):
|
||||
return struct.unpack('h', rom.read(2))[0]
|
||||
|
||||
def read_u32(rom: BufferedReader):
|
||||
return struct.unpack('I', rom.read(4))[0]
|
||||
|
||||
def read_s32(rom: BufferedReader):
|
||||
return struct.unpack('i', rom.read(4))[0]
|
||||
|
||||
|
||||
def format_hex(val):
|
||||
return f"0x{hex(val)[2:].upper()}"
|
||||
|
||||
with open('baserom.gba', 'rb') as rom:
|
||||
rom.seek(address)
|
||||
# for i in range(length // 2):
|
||||
# print(f"{read_u16(rom)}, ", end="")
|
||||
for i in range(length // 8):
|
||||
print("{ ", end="")
|
||||
print(f"{read_u16(rom)}" + ", ", end="")
|
||||
print(f"{read_u16(rom)}" + ", ", end="")
|
||||
print("{ ._16 = {", end="")
|
||||
print(f"Q_8_8({read_s16(rom) / 256})" + ", ", end="")
|
||||
print(f"Q_8_8({read_s16(rom) / 256})" + " ", end="")
|
||||
print("}},},")
|
||||
|
||||
# print("{ ", end="")
|
||||
# for i in range(length):
|
||||
# print(str(read_u8(rom)) + ", ", end="")
|
||||
# print("},")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "game/interactables_2/music_plant/handlers_ia_pipe_horn.h"
|
||||
#include "game/interactables_2/music_plant/pipe_horn.h"
|
||||
|
||||
// NOTE: Stored at end of rom, probably because it's configured data (like levels and
|
||||
// assets?) it's made up of pointers defined in handlers_ia_pipe_horn.c
|
||||
// assets?) it's made up of pointers defined in pipe_horn.c
|
||||
// see data/handlers_ia_pipe_horn_sequences.s
|
||||
extern const Pipe_Data (*gUnknown_08C8793C[9])[];
|
||||
extern const Pipe_Data (*gUnknown_08C87960[3])[];
|
||||
@@ -1,417 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "trig.h"
|
||||
|
||||
#include "game/interactables_2/music_plant/handlers_ia_pipe_horn.h"
|
||||
#include "game/interactables_2/music_plant/pipe_horn.h"
|
||||
|
||||
void Handler_MusicPlant_Pipe_0(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_1(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_2(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_3(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_4(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_5(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_6(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_7(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_8(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_9(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_10(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
|
||||
// These functions control the character when they enter
|
||||
// one of the horns or pipes in Music Plant.
|
||||
const PipeHandler gPipeHandlers[NUM_PIPE_HANDLERS] = { Handler_MusicPlant_Pipe_0,
|
||||
Handler_MusicPlant_Pipe_1,
|
||||
Handler_MusicPlant_Pipe_2,
|
||||
Handler_MusicPlant_Pipe_3,
|
||||
Handler_MusicPlant_Pipe_4,
|
||||
Handler_MusicPlant_Pipe_5,
|
||||
Handler_MusicPlant_Pipe_6,
|
||||
Handler_MusicPlant_Pipe_7,
|
||||
Handler_MusicPlant_Pipe_8,
|
||||
Handler_MusicPlant_Pipe_9,
|
||||
Handler_MusicPlant_Pipe_10,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL };
|
||||
|
||||
#if TRUE
|
||||
extern const Pipe_Data gUnknown_080DFCF0[];
|
||||
#else
|
||||
const Pipe_Data gUnknown_080DFCF0[]
|
||||
= { { 0, 0x22, { 0x0000, 0x0800 } }, { 0, 0xCC, { 0, 0x5000 } },
|
||||
{ 2, 0x140, { 0, 0x1400 } }, { 0, 0x100, { 0x4000, 0x0000 } },
|
||||
{ 4, 0x140, { 0x0000, 0x1400 } }, { 1, 0x140, { 0x0000, 0x1400 } },
|
||||
{ 0, 0xAA, { 0xA000, 0x0000 } }, { 0, 0xAA, { 0xA000, 0x0000 } },
|
||||
{ 0, 0x200, { 0xE000, 0x0000 } },
|
||||
{
|
||||
-1,
|
||||
-1,
|
||||
{ -1, -1 },
|
||||
};
|
||||
#endif
|
||||
extern const Pipe_Data gUnknown_080DFD40[];
|
||||
extern const Pipe_Data gUnknown_080DFD98[];
|
||||
extern const Pipe_Data gUnknown_080DFDD8[];
|
||||
extern const Pipe_Data gUnknown_080DFE30[];
|
||||
|
||||
extern const Pipe_Data gUnknown_080DFEE4[];
|
||||
extern const Pipe_Data gUnknown_080DFF3C[];
|
||||
extern const Pipe_Data gUnknown_080DFF9C[];
|
||||
|
||||
void Handler_MusicPlant_Pipe_0(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s32 r1 = (u16)(Q_24_8_TO_INT(data[pipe->unk18].unk4._32) >> 8);
|
||||
s32 r0, r3, r6, r7;
|
||||
|
||||
r0 = data[pipe->unk18].unk4._16[0];
|
||||
r3 = pipe->x1;
|
||||
r7 = -r0;
|
||||
pipe->x2 = r3 - (((s16)pipe->unk1A * r7) >> 10);
|
||||
|
||||
r1 <<= 16;
|
||||
r1 >>= 16;
|
||||
|
||||
r6 = pipe->y1;
|
||||
pipe->y2 = r6 - ((-r1 * (s16)pipe->unk1A) >> 10);
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A > ONE_CYCLE) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
pipe->x1 = pipe->x1 - r7;
|
||||
pipe->y1 = pipe->y1 - -r1;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_1(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s16 sin, cos;
|
||||
s32 r5 = data[pipe->unk18].unk4._32;
|
||||
u32 index = (pipe->unk1A >> 2);
|
||||
u16 sinIndex = (DEG_TO_SIN(90) - index) & ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
pipe->x2 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
|
||||
sin = SIN_24_8(sinIndex);
|
||||
pipe->y2 = Q_24_8_TO_INT(sin * r5) + pipe->y1 - r5;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A > ONE_CYCLE) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = COS_DEG(0);
|
||||
pipe->x1 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
|
||||
sin = SIN_DEG(0);
|
||||
pipe->y1 = Q_24_8_TO_INT(sin * r5) + pipe->y1 - r5;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_2(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s16 sin, cos;
|
||||
s32 r5 = data[pipe->unk18].unk4._32;
|
||||
u32 index = (pipe->unk1A >> 2);
|
||||
u16 sinIndex = (DEG_TO_SIN(270) + index) & ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
pipe->x2 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
|
||||
sin = SIN_24_8(sinIndex);
|
||||
pipe->y2 = Q_24_8_TO_INT(sin * r5) + pipe->y1 + r5;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A > ONE_CYCLE) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = COS_DEG(0);
|
||||
pipe->x1 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
|
||||
sin = SIN_DEG(0);
|
||||
pipe->y1 = Q_24_8_TO_INT(sin * r5) + pipe->y1 + r5;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_3(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s16 sin, cos;
|
||||
s32 r5 = data[pipe->unk18].unk4._32;
|
||||
u32 index = (pipe->unk1A >> 2);
|
||||
u16 sinIndex = (index)&ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
pipe->x2 = Q_24_8_TO_INT(cos * r5) + pipe->x1 - r5;
|
||||
|
||||
sin = SIN_24_8(sinIndex);
|
||||
pipe->y2 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A > ONE_CYCLE) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = COS_DEG(90);
|
||||
pipe->x1 = Q_24_8_TO_INT(cos * r5) + pipe->x1 - r5;
|
||||
|
||||
sin = SIN_DEG(90);
|
||||
pipe->y1 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_4(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s16 sin, cos;
|
||||
s32 r5 = data[pipe->unk18].unk4._32;
|
||||
u32 index = (pipe->unk1A >> 2);
|
||||
u16 sinIndex = (DEG_TO_SIN(180) - index) & ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
pipe->x2 = Q_24_8_TO_INT(cos * r5) + pipe->x1 + r5;
|
||||
|
||||
sin = SIN_24_8(sinIndex);
|
||||
pipe->y2 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A > ONE_CYCLE) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = COS_DEG(90);
|
||||
pipe->x1 = Q_24_8_TO_INT(cos * r5) + pipe->x1 + r5;
|
||||
|
||||
sin = SIN_DEG(90);
|
||||
pipe->y1 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_5(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s16 sin, cos;
|
||||
s32 r5 = data[pipe->unk18].unk4._32;
|
||||
u32 index = (pipe->unk1A >> 2);
|
||||
u16 sinIndex = (index + DEG_TO_SIN(90)) & ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
pipe->x2 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
|
||||
sin = SIN_24_8(sinIndex);
|
||||
pipe->y2 = Q_24_8_TO_INT(sin * r5) + pipe->y1 - r5;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A > ONE_CYCLE) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = COS_DEG(180);
|
||||
pipe->x1 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
|
||||
sin = SIN_DEG(180);
|
||||
pipe->y1 = Q_24_8_TO_INT(sin * r5) + pipe->y1 - r5;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_6(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s16 sin, cos;
|
||||
s32 r5 = data[pipe->unk18].unk4._32;
|
||||
u32 index = (pipe->unk1A >> 2);
|
||||
u16 sinIndex = (DEG_TO_SIN(270) - index) & ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
pipe->x2 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
|
||||
sin = SIN_24_8(sinIndex);
|
||||
pipe->y2 = Q_24_8_TO_INT(sin * r5) + pipe->y1 + r5;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A > ONE_CYCLE) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = COS_DEG(180);
|
||||
pipe->x1 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
|
||||
sin = SIN_DEG(180);
|
||||
pipe->y1 = Q_24_8_TO_INT(sin * r5) + pipe->y1 + r5;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_7(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s16 sin, cos;
|
||||
s32 r5 = data[pipe->unk18].unk4._32;
|
||||
u32 index = (pipe->unk1A >> 2);
|
||||
u16 sinIndex = (DEG_TO_SIN(360) - index) & ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
pipe->x2 = Q_24_8_TO_INT(cos * r5) + pipe->x1 - r5;
|
||||
|
||||
sin = SIN_24_8(sinIndex);
|
||||
pipe->y2 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A > ONE_CYCLE) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = COS_DEG(270);
|
||||
pipe->x1 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
pipe->x1 -= r5;
|
||||
|
||||
sin = SIN_DEG(270);
|
||||
pipe->y1 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_8(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s16 sin, cos;
|
||||
s32 r5 = data[pipe->unk18].unk4._32;
|
||||
u16 sinIndex = ((pipe->unk1A >> 2) + 512) & ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
pipe->x2 = Q_24_8_TO_INT(cos * r5) + pipe->x1 + r5;
|
||||
|
||||
sin = SIN_24_8(sinIndex);
|
||||
pipe->y2 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A > ONE_CYCLE) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = COS_DEG(270);
|
||||
pipe->x1 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
pipe->x1 += r5;
|
||||
|
||||
sin = SIN_DEG(270);
|
||||
pipe->y1 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_9(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s32 sin, cos;
|
||||
s32 sin2;
|
||||
s32 r8, r9;
|
||||
s32 r7 = data[pipe->unk18].unk4._32;
|
||||
u16 sinIndex = ((pipe->unk1A >> 3) + DEG_TO_SIN(315)) & ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
r8 = r7 * cos;
|
||||
|
||||
sin = SIN_DEG(135);
|
||||
r9 = r7 * sin;
|
||||
pipe->x2 = Q_24_8_TO_INT(r8 - r9) + pipe->x1;
|
||||
|
||||
sin2 = (SIN_24_8(sinIndex) + SIN_DEG(45));
|
||||
pipe->y2 = Q_24_8_TO_INT(sin2 * r7) + pipe->y1;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A > ONE_CYCLE) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = SIN_DEG(90) * r7;
|
||||
pipe->x1 = Q_24_8_TO_INT(cos - r9) + pipe->x1;
|
||||
|
||||
pipe->y1 = Q_24_8_TO_INT((SIN_DEG(0) + SIN_DEG(45)) * r7) + pipe->y1;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_10(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s16 sin, cos;
|
||||
s32 r5 = data[pipe->unk18].unk4._32;
|
||||
u16 sinIndex = ((pipe->unk1A >> 3) + 512) & ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
pipe->x2 = Q_24_8_TO_INT(cos * r5) + pipe->x1 + r5;
|
||||
|
||||
sin = SIN_24_8(sinIndex);
|
||||
pipe->y2 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A > ONE_CYCLE) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = COS_DEG(225);
|
||||
pipe->x1 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
pipe->x1 += r5;
|
||||
|
||||
sin = SIN_DEG(225);
|
||||
pipe->y1 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,14 +5,511 @@
|
||||
|
||||
#include "game/game.h"
|
||||
#include "game/entity.h"
|
||||
|
||||
#include "game/interactables_2/music_plant/pipe_horn.h"
|
||||
#include "game/interactables_2/music_plant/handlers_ia_pipe_horn.h"
|
||||
|
||||
#include "data/handlers_ia_pipe_horn_sequences.h"
|
||||
|
||||
#include "constants/songs.h"
|
||||
|
||||
void Handler_MusicPlant_Pipe_0(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_1(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_2(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_3(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_4(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_5(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_6(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_7(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_8(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_9(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void Handler_MusicPlant_Pipe_10(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
void sub_80778AC(void);
|
||||
void sub_80778E4(Sprite_Pipe_Horn *pipe);
|
||||
bool32 sub_807794C(Sprite_Pipe_Horn *);
|
||||
void sub_8077994(Sprite_Pipe_Horn *);
|
||||
void sub_8077A3C(void);
|
||||
static void TaskDestructor_Pipe(struct Task *t);
|
||||
void sub_8077AAC(Sprite_Pipe_Horn *horn);
|
||||
static void sub_8077B28(Sprite_Pipe_Horn *);
|
||||
void sub_8077C3C(Sprite_Pipe_Horn *);
|
||||
void sub_8077CA0(Sprite_Pipe_Horn *);
|
||||
bool32 sub_8077CB0(Sprite_Pipe_Horn *);
|
||||
void Task_FrenchHorn_8077C04(void);
|
||||
void FrenchHorn_Despawn(Sprite_Pipe_Horn *);
|
||||
void TaskDestructor_FrenchHorn(struct Task *);
|
||||
|
||||
typedef void (*PipeHandler)(Sprite_Pipe_Horn *, const Pipe_Data[]);
|
||||
|
||||
// These functions control the character when they enter
|
||||
// one of the horns or pipes in Music Plant.
|
||||
const PipeHandler gPipeHandlers[NUM_PIPE_HANDLERS] = {
|
||||
Handler_MusicPlant_Pipe_0,
|
||||
Handler_MusicPlant_Pipe_1,
|
||||
Handler_MusicPlant_Pipe_2,
|
||||
Handler_MusicPlant_Pipe_3,
|
||||
Handler_MusicPlant_Pipe_4,
|
||||
Handler_MusicPlant_Pipe_5,
|
||||
Handler_MusicPlant_Pipe_6,
|
||||
Handler_MusicPlant_Pipe_7,
|
||||
Handler_MusicPlant_Pipe_8,
|
||||
Handler_MusicPlant_Pipe_9,
|
||||
Handler_MusicPlant_Pipe_10,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const Pipe_Data gUnknown_080DFCF0[] = {
|
||||
{
|
||||
0,
|
||||
34,
|
||||
{ ._32 = Q_24_8(8.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
204,
|
||||
{ ._32 = Q_24_8(80.0) },
|
||||
},
|
||||
{
|
||||
2,
|
||||
320,
|
||||
{ ._32 = Q_24_8(20.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
256,
|
||||
{ ._16 = { Q_8_8(0.0), Q_8_8(64.0) } },
|
||||
},
|
||||
{
|
||||
4,
|
||||
320,
|
||||
{ ._32 = Q_24_8(20.0) },
|
||||
},
|
||||
{
|
||||
1,
|
||||
320,
|
||||
{ ._32 = Q_24_8(20.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
170,
|
||||
{ ._16 = { Q_8_8(0.0), Q_8_8(-96.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
170,
|
||||
{ ._16 = { Q_8_8(0.0), Q_8_8(-96.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
512,
|
||||
{ ._16 = { Q_8_8(0.0), Q_8_8(-32.0) } },
|
||||
},
|
||||
{ -1, -1, { ._32 = -1 } },
|
||||
};
|
||||
|
||||
const Pipe_Data gUnknown_080DFD40[] = {
|
||||
{
|
||||
0,
|
||||
34,
|
||||
{ ._32 = Q_24_8(8.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
204,
|
||||
{ ._32 = Q_24_8(80.0) },
|
||||
},
|
||||
{
|
||||
2,
|
||||
320,
|
||||
{ ._32 = Q_24_8(20.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
256,
|
||||
{ ._16 = { Q_8_8(0.0), Q_8_8(64.0) } },
|
||||
},
|
||||
{
|
||||
4,
|
||||
320,
|
||||
{ ._32 = Q_24_8(20.0) },
|
||||
},
|
||||
{
|
||||
1,
|
||||
320,
|
||||
{ ._32 = Q_24_8(20.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
170,
|
||||
{ ._16 = { Q_8_8(0.0), Q_8_8(-96.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
170,
|
||||
{ ._16 = { Q_8_8(0.0), Q_8_8(-96.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
170,
|
||||
{ ._16 = { Q_8_8(0.0), Q_8_8(-96.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
409,
|
||||
{ ._16 = { Q_8_8(0.0), Q_8_8(-40.0) } },
|
||||
},
|
||||
{ -1, -1, { ._32 = -1 } },
|
||||
};
|
||||
|
||||
const Pipe_Data gUnknown_080DFD98[] = {
|
||||
{
|
||||
0,
|
||||
34,
|
||||
{ ._32 = Q_24_8(8.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
204,
|
||||
{ ._32 = Q_24_8(80.0) },
|
||||
},
|
||||
{
|
||||
2,
|
||||
320,
|
||||
{ ._32 = Q_24_8(20.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
256,
|
||||
{ ._16 = { Q_8_8(0.0), Q_8_8(64.0) } },
|
||||
},
|
||||
{
|
||||
4,
|
||||
320,
|
||||
{ ._32 = Q_24_8(20.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
157,
|
||||
{ ._16 = { Q_8_8(80.0), Q_8_8(-74.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
157,
|
||||
{ ._16 = { Q_8_8(80.0), Q_8_8(-74.0) } },
|
||||
},
|
||||
{ -1, -1, { ._32 = -1 } },
|
||||
};
|
||||
|
||||
const Pipe_Data gUnknown_080DFDD8[] = {
|
||||
{
|
||||
0,
|
||||
34,
|
||||
{ ._32 = Q_24_8(8.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
170,
|
||||
{ ._32 = Q_24_8(96.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
256,
|
||||
{ ._32 = Q_24_8(64.0) },
|
||||
},
|
||||
{
|
||||
2,
|
||||
320,
|
||||
{ ._32 = Q_24_8(20.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
292,
|
||||
{ ._16 = { Q_8_8(0.0), Q_8_8(56.0) } },
|
||||
},
|
||||
{
|
||||
4,
|
||||
320,
|
||||
{ ._32 = Q_24_8(20.0) },
|
||||
},
|
||||
{
|
||||
1,
|
||||
320,
|
||||
{ ._32 = Q_24_8(20.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
170,
|
||||
{ ._16 = { Q_8_8(0.0), Q_8_8(-96.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
170,
|
||||
{ ._16 = { Q_8_8(0.0), Q_8_8(-96.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
227,
|
||||
{ ._16 = { Q_8_8(0.0), Q_8_8(-72.0) } },
|
||||
},
|
||||
{ -1, -1, { ._32 = -1 } },
|
||||
};
|
||||
|
||||
const Pipe_Data gUnknown_080DFE30[] = {
|
||||
{
|
||||
0,
|
||||
34,
|
||||
{ ._32 = Q_24_8(8.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
170,
|
||||
{ ._32 = Q_24_8(96.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
256,
|
||||
{ ._32 = Q_24_8(64.0) },
|
||||
},
|
||||
{
|
||||
2,
|
||||
320,
|
||||
{ ._32 = Q_24_8(20.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
292,
|
||||
{ ._16 = { (0.0), Q_8_8(56.0) } },
|
||||
},
|
||||
{
|
||||
4,
|
||||
320,
|
||||
{ ._32 = Q_24_8(20.0) },
|
||||
},
|
||||
{
|
||||
1,
|
||||
320,
|
||||
{ ._32 = Q_24_8(20.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
170,
|
||||
{ ._16 = { Q_8_8(0.0), Q_8_8(-96.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
170,
|
||||
{ ._16 = { Q_8_8(0.0), Q_8_8(-96.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
170,
|
||||
{ ._16 = { Q_8_8(0.0), Q_8_8(-96.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
227,
|
||||
{ ._16 = { Q_8_8(0.0), Q_8_8(-72.0) } },
|
||||
},
|
||||
{
|
||||
-1,
|
||||
-1,
|
||||
{ ._32 = -1 },
|
||||
},
|
||||
};
|
||||
|
||||
const s16 gUnknown_080DFE90[9][2] = {
|
||||
{ Q_8_8(0.0), Q_8_8(-9.0) }, { Q_8_8(0.0), Q_8_8(-12.0) },
|
||||
{ Q_8_8(0.0), Q_8_8(-9.0) }, { Q_8_8(0.0), Q_8_8(-12.0) },
|
||||
{ Q_8_8(9.0), Q_8_8(-9.0) }, { Q_8_8(0.0), Q_8_8(-9.0) },
|
||||
{ Q_8_8(0.0), Q_8_8(-12.0) }, { Q_8_8(0.0), Q_8_8(-9.0) },
|
||||
{ Q_8_8(0.0), Q_8_8(-12.0) },
|
||||
};
|
||||
|
||||
const s16 gUnknown_080DFEB4[14] = {
|
||||
Q_8_8(0.75), Q_8_8(0.75), Q_8_8(0.75), Q_8_8(0.75), Q_8_8(0.875),
|
||||
Q_8_8(0.75), Q_8_8(0.75), Q_8_8(0.75), Q_8_8(0.75), Q_8_8(-63.25),
|
||||
Q_8_8(-63.25), Q_8_8(-63.125), Q_8_8(-63.25), Q_8_8(0.75),
|
||||
};
|
||||
|
||||
const u16 gUnknown_080DFED0[10] = {
|
||||
SE_MUSIC_PLANT_EXIT_HORN2, SE_MUSIC_PLANT_HORN3,
|
||||
SE_MUSIC_PLANT_EXIT_HORN2, SE_MUSIC_PLANT_HORN3,
|
||||
SE_MUSIC_PLANT_EXIT_HORN2, SE_MUSIC_PLANT_EXIT_HORN2,
|
||||
SE_MUSIC_PLANT_HORN3, SE_MUSIC_PLANT_EXIT_HORN2,
|
||||
SE_MUSIC_PLANT_HORN3, MUS_DUMMY,
|
||||
};
|
||||
|
||||
const Pipe_Data gUnknown_080DFEE4[] = {
|
||||
{
|
||||
0,
|
||||
34,
|
||||
{ ._16 = { Q_8_8(8.0), Q_8_8(8.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
120,
|
||||
{ ._16 = { Q_8_8(96.0), Q_8_8(96.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
341,
|
||||
{ ._16 = { Q_8_8(32.0), Q_8_8(32.0) } },
|
||||
},
|
||||
{
|
||||
9,
|
||||
640,
|
||||
{ ._32 = Q_24_8(40.0) },
|
||||
},
|
||||
{
|
||||
3,
|
||||
320,
|
||||
{ ._32 = Q_24_8(56.0) },
|
||||
},
|
||||
{
|
||||
5,
|
||||
320,
|
||||
{ ._32 = Q_24_8(56.0) },
|
||||
},
|
||||
{
|
||||
10,
|
||||
640,
|
||||
{ ._32 = Q_24_8(48.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
146,
|
||||
{ ._16 = { Q_8_8(84.0), Q_8_8(-84.0) } },
|
||||
},
|
||||
{ 0, 120, { ._32 = Q_24_8(96.0) } },
|
||||
{ 0, 292, { ._32 = Q_24_8(56.0) } },
|
||||
{
|
||||
-1,
|
||||
-1,
|
||||
{ ._32 = -1 },
|
||||
},
|
||||
};
|
||||
const Pipe_Data gUnknown_080DFF3C[] = {
|
||||
{
|
||||
0,
|
||||
34,
|
||||
{ ._16 = { Q_8_8(8.0), Q_8_8(8.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
120,
|
||||
{ ._16 = { Q_8_8(96.0), Q_8_8(96.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
341,
|
||||
{ ._16 = { Q_8_8(32.0), Q_8_8(32.0) } },
|
||||
},
|
||||
{
|
||||
9,
|
||||
640,
|
||||
{ ._16 = { Q_8_8(40.0), Q_8_8(0.0) } },
|
||||
},
|
||||
{
|
||||
3,
|
||||
320,
|
||||
{ ._16 = { Q_8_8(56.0), Q_8_8(0.0) } },
|
||||
},
|
||||
{
|
||||
5,
|
||||
320,
|
||||
{ ._16 = { Q_8_8(56.0), Q_8_8(0.0) } },
|
||||
},
|
||||
{
|
||||
10,
|
||||
640,
|
||||
{ ._16 = { Q_8_8(48.0), Q_8_8(0.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
146,
|
||||
{ ._16 = { Q_8_8(84.0), Q_8_8(-84.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
120,
|
||||
{ ._32 = Q_24_8(96.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
120,
|
||||
{ ._32 = Q_24_8(96.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
292,
|
||||
{ ._32 = Q_24_8(56.0) },
|
||||
},
|
||||
{
|
||||
-1,
|
||||
-1,
|
||||
{ ._32 = -1 },
|
||||
},
|
||||
};
|
||||
const Pipe_Data gUnknown_080DFF9C[] = {
|
||||
{
|
||||
0,
|
||||
34,
|
||||
{ ._16 = { Q_8_8(8.0), Q_8_8(8.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
120,
|
||||
{ ._16 = { Q_8_8(96.0), Q_8_8(96.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
341,
|
||||
{ ._16 = { Q_8_8(32.0), Q_8_8(32.0) } },
|
||||
},
|
||||
{
|
||||
9,
|
||||
640,
|
||||
{ ._32 = Q_24_8(40.0) },
|
||||
},
|
||||
{
|
||||
3,
|
||||
320,
|
||||
{ ._32 = Q_24_8(56.0) },
|
||||
},
|
||||
{
|
||||
5,
|
||||
320,
|
||||
{ ._32 = Q_24_8(56.0) },
|
||||
},
|
||||
{
|
||||
10,
|
||||
640,
|
||||
{ ._32 = Q_24_8(48.0) },
|
||||
},
|
||||
{
|
||||
0,
|
||||
146,
|
||||
{ ._16 = { Q_8_8(84.0), Q_8_8(-84.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
120,
|
||||
{ ._16 = { Q_8_8(96.0), Q_8_8(-96.0) } },
|
||||
},
|
||||
{
|
||||
0,
|
||||
341,
|
||||
{ ._16 = { Q_8_8(32.0), Q_8_8(-32.0) } },
|
||||
},
|
||||
{
|
||||
-1,
|
||||
-1,
|
||||
{ ._32 = -1 },
|
||||
},
|
||||
};
|
||||
|
||||
static const s16 gUnknown_080DFFF4[3][2] = {
|
||||
{ Q_8_8(9), Q_8_8(0) },
|
||||
{ Q_8_8(12), Q_8_8(0) },
|
||||
@@ -26,41 +523,363 @@ static const s16 gUnknown_080E0000[4] = {
|
||||
Q_8_8(0),
|
||||
};
|
||||
|
||||
extern s16 gUnknown_080DFE90[9][2];
|
||||
extern s16 gUnknown_080DFEB4[14];
|
||||
void Handler_MusicPlant_Pipe_0(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s32 r1 = (u16)data[pipe->unk18].unk4._16[1];
|
||||
s32 r0, r3, r5, r6, r7;
|
||||
|
||||
// TODO: Replace
|
||||
#if TRUE
|
||||
extern u16 gUnknown_080DFED0[10];
|
||||
#else
|
||||
extern u16 gUnknown_080DFED0[10] = {
|
||||
SE_MUSIC_PLANT_EXIT_HORN2, SE_MUSIC_PLANT_HORN3, SE_MUSIC_PLANT_EXIT_HORN2,
|
||||
SE_MUSIC_PLANT_HORN3, SE_MUSIC_PLANT_EXIT_HORN2, SE_MUSIC_PLANT_EXIT_HORN2,
|
||||
SE_MUSIC_PLANT_HORN3, SE_MUSIC_PLANT_EXIT_HORN2, MUS_DUMMY,
|
||||
};
|
||||
#endif
|
||||
r0 = data[pipe->unk18].unk4._16[0];
|
||||
r3 = pipe->x1;
|
||||
r7 = -r0;
|
||||
pipe->x2 = r3 - (((s16)pipe->unk1A * r7) >> 10);
|
||||
|
||||
extern void sub_8077774(Sprite_Pipe_Horn *, s32, s32);
|
||||
extern void sub_80777C8(Sprite_Pipe_Horn *);
|
||||
extern bool32 sub_8077788(Sprite_Pipe_Horn *, const Pipe_Data data[]);
|
||||
bool32 sub_8077840(Sprite_Pipe_Horn *);
|
||||
extern void sub_80778AC(void);
|
||||
void sub_80778E4(Sprite_Pipe_Horn *pipe);
|
||||
bool32 sub_807794C(Sprite_Pipe_Horn *);
|
||||
void sub_8077994(Sprite_Pipe_Horn *);
|
||||
extern void sub_8077A3C(void);
|
||||
extern void sub_8077ABC(void);
|
||||
static void TaskDestructor_Pipe(struct Task *t);
|
||||
extern void sub_8077AAC(Sprite_Pipe_Horn *);
|
||||
void sub_8077AAC(Sprite_Pipe_Horn *horn);
|
||||
static void sub_8077B28(Sprite_Pipe_Horn *);
|
||||
extern bool32 sub_8077B98(Sprite_Pipe_Horn *);
|
||||
extern void sub_8077C3C(Sprite_Pipe_Horn *);
|
||||
extern void sub_8077CA0(Sprite_Pipe_Horn *);
|
||||
extern bool32 sub_8077CB0(Sprite_Pipe_Horn *);
|
||||
extern void Task_FrenchHorn_8077C04(void);
|
||||
void FrenchHorn_Despawn(Sprite_Pipe_Horn *);
|
||||
void TaskDestructor_FrenchHorn(struct Task *);
|
||||
r1 <<= 0x10;
|
||||
r1 >>= 0x10;
|
||||
|
||||
r6 = pipe->y1;
|
||||
r5 = -r1;
|
||||
pipe->y2 = r6 - ((r5 * (s16)pipe->unk1A) >> 10);
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A >= 1024U) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
pipe->x1 = pipe->x1 - r7;
|
||||
pipe->y1 = pipe->y1 - -r1;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_1(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s16 sin, cos;
|
||||
s32 r5 = data[pipe->unk18].unk4._32;
|
||||
u32 index = ((u16)pipe->unk1A >> 2);
|
||||
u16 sinIndex = (DEG_TO_SIN(90) - index) & ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
pipe->x2 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
|
||||
sin = SIN_24_8(sinIndex);
|
||||
pipe->y2 = Q_24_8_TO_INT(sin * r5) + pipe->y1 - r5;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A >= 1024U) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = COS_DEG(0);
|
||||
pipe->x1 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
|
||||
sin = SIN_DEG(0);
|
||||
pipe->y1 = Q_24_8_TO_INT(sin * r5) + pipe->y1 - r5;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_2(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s16 sin, cos;
|
||||
s32 r5 = data[pipe->unk18].unk4._32;
|
||||
u32 index = ((u16)pipe->unk1A >> 2);
|
||||
u16 sinIndex = (DEG_TO_SIN(270) + index) & ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
pipe->x2 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
|
||||
sin = SIN_24_8(sinIndex);
|
||||
pipe->y2 = Q_24_8_TO_INT(sin * r5) + pipe->y1 + r5;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A >= 1024U) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = COS_DEG(0);
|
||||
pipe->x1 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
|
||||
sin = SIN_DEG(0);
|
||||
pipe->y1 = Q_24_8_TO_INT(sin * r5) + pipe->y1 + r5;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_3(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s16 sin, cos;
|
||||
s32 r5 = data[pipe->unk18].unk4._32;
|
||||
u32 index = ((u16)pipe->unk1A >> 2);
|
||||
u16 sinIndex = (index)&ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
pipe->x2 = Q_24_8_TO_INT(cos * r5) + pipe->x1 - r5;
|
||||
|
||||
sin = SIN_24_8(sinIndex);
|
||||
pipe->y2 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A >= 1024U) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = COS_DEG(90);
|
||||
pipe->x1 = Q_24_8_TO_INT(cos * r5) + pipe->x1 - r5;
|
||||
|
||||
sin = SIN_DEG(90);
|
||||
pipe->y1 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_4(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s16 sin, cos;
|
||||
s32 r5 = data[pipe->unk18].unk4._32;
|
||||
u32 index = ((u16)pipe->unk1A >> 2);
|
||||
u16 sinIndex = (DEG_TO_SIN(180) - index) & ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
pipe->x2 = Q_24_8_TO_INT(cos * r5) + pipe->x1 + r5;
|
||||
|
||||
sin = SIN_24_8(sinIndex);
|
||||
pipe->y2 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A >= 1024U) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = COS_DEG(90);
|
||||
pipe->x1 = Q_24_8_TO_INT(cos * r5) + pipe->x1 + r5;
|
||||
|
||||
sin = SIN_DEG(90);
|
||||
pipe->y1 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_5(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s16 sin, cos;
|
||||
s32 r5 = data[pipe->unk18].unk4._32;
|
||||
u32 index = ((u16)pipe->unk1A >> 2);
|
||||
u16 sinIndex = (index + DEG_TO_SIN(90)) & ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
pipe->x2 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
|
||||
sin = SIN_24_8(sinIndex);
|
||||
pipe->y2 = Q_24_8_TO_INT(sin * r5) + pipe->y1 - r5;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A >= 1024U) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = COS_DEG(180);
|
||||
pipe->x1 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
|
||||
sin = SIN_DEG(180);
|
||||
pipe->y1 = Q_24_8_TO_INT(sin * r5) + pipe->y1 - r5;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_6(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s16 sin, cos;
|
||||
s32 r5 = data[pipe->unk18].unk4._32;
|
||||
u32 index = ((u16)pipe->unk1A >> 2);
|
||||
u16 sinIndex = (DEG_TO_SIN(270) - index) & ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
pipe->x2 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
|
||||
sin = SIN_24_8(sinIndex);
|
||||
pipe->y2 = Q_24_8_TO_INT(sin * r5) + pipe->y1 + r5;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A >= 1024U) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = COS_DEG(180);
|
||||
pipe->x1 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
|
||||
sin = SIN_DEG(180);
|
||||
pipe->y1 = Q_24_8_TO_INT(sin * r5) + pipe->y1 + r5;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_7(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s16 sin, cos;
|
||||
s32 r5 = data[pipe->unk18].unk4._32;
|
||||
u32 index = ((u16)pipe->unk1A >> 2);
|
||||
u16 sinIndex = (DEG_TO_SIN(360) - index) & ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
pipe->x2 = Q_24_8_TO_INT(cos * r5) + pipe->x1 - r5;
|
||||
|
||||
sin = SIN_24_8(sinIndex);
|
||||
pipe->y2 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A >= 1024U) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = COS_DEG(270);
|
||||
pipe->x1 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
pipe->x1 -= r5;
|
||||
|
||||
sin = SIN_DEG(270);
|
||||
pipe->y1 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_8(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s16 sin, cos;
|
||||
s32 r5 = data[pipe->unk18].unk4._32;
|
||||
u16 sinIndex = (((u16)pipe->unk1A >> 2) + 512) & ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
pipe->x2 = Q_24_8_TO_INT(cos * r5) + pipe->x1 + r5;
|
||||
|
||||
sin = SIN_24_8(sinIndex);
|
||||
pipe->y2 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A >= 1024U) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = COS_DEG(270);
|
||||
pipe->x1 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
pipe->x1 += r5;
|
||||
|
||||
sin = SIN_DEG(270);
|
||||
pipe->y1 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_9(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s32 sin, cos;
|
||||
s32 sin2;
|
||||
s32 r8, r9;
|
||||
s32 r7 = data[pipe->unk18].unk4._32;
|
||||
u16 sinIndex = (((u16)pipe->unk1A >> 3) + DEG_TO_SIN(315)) & ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
r8 = r7 * cos;
|
||||
|
||||
sin = SIN_DEG(135);
|
||||
r9 = r7 * sin;
|
||||
pipe->x2 = Q_24_8_TO_INT(r8 - r9) + pipe->x1;
|
||||
|
||||
sin2 = (SIN_24_8(sinIndex) + SIN_DEG(45));
|
||||
pipe->y2 = Q_24_8_TO_INT(sin2 * r7) + pipe->y1;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A >= 1024U) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = SIN_DEG(90) * r7;
|
||||
pipe->x1 = Q_24_8_TO_INT(cos - r9) + pipe->x1;
|
||||
|
||||
pipe->y1 = Q_24_8_TO_INT((SIN_DEG(0) + SIN_DEG(45)) * r7) + pipe->y1;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Handler_MusicPlant_Pipe_10(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
s16 sin, cos;
|
||||
s32 r5 = data[pipe->unk18].unk4._32;
|
||||
u16 sinIndex = (((u16)pipe->unk1A >> 3) + 512) & ONE_CYCLE;
|
||||
|
||||
cos = COS_24_8(sinIndex);
|
||||
pipe->x2 = Q_24_8_TO_INT(cos * r5) + pipe->x1 + r5;
|
||||
|
||||
sin = SIN_24_8(sinIndex);
|
||||
pipe->y2 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
pipe->unk1A += data[pipe->unk18].unk2;
|
||||
|
||||
if (pipe->unk1A >= 1024U) {
|
||||
u32 value;
|
||||
pipe->unk1A -= 1024;
|
||||
|
||||
cos = COS_DEG(225);
|
||||
pipe->x1 = Q_24_8_TO_INT(cos * r5) + pipe->x1;
|
||||
pipe->x1 += r5;
|
||||
|
||||
sin = SIN_DEG(225);
|
||||
pipe->y1 = Q_24_8_TO_INT(sin * r5) + pipe->y1;
|
||||
|
||||
value = data[++pipe->unk18].unk0;
|
||||
if (value == (u16)-1) {
|
||||
pipe->unk18 |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_8077774(Sprite_Pipe_Horn *pipe, s32 x, s32 y)
|
||||
{
|
||||
@@ -74,11 +893,11 @@ void sub_8077774(Sprite_Pipe_Horn *pipe, s32 x, s32 y)
|
||||
pipe->unk1A = 0;
|
||||
}
|
||||
|
||||
u32 sub_8077788(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
bool32 sub_8077788(Sprite_Pipe_Horn *pipe, const Pipe_Data data[])
|
||||
{
|
||||
u32 result;
|
||||
if (pipe->unk18 == (u16)-1) {
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gPipeHandlers[data[pipe->unk18].unk0](pipe, data);
|
||||
@@ -382,4 +1201,7 @@ void CreateEntity_FrenchHorn_Entry(MapEntity *me, u16 spriteRegionX, u16 spriteR
|
||||
SET_MAP_ENTITY_INITIALIZED(me);
|
||||
}
|
||||
|
||||
void TaskDestructor_FrenchHorn(struct Task *t) { }
|
||||
void TaskDestructor_FrenchHorn(struct Task *t)
|
||||
{
|
||||
// unused
|
||||
}
|
||||
Reference in new issue
Block a user