Merge branch 'master' into master

This commit is contained in:
Cuyler36
2024-08-07 01:41:33 -04:00
committed by GitHub
14 changed files with 1072 additions and 55 deletions
+10 -12
View File
@@ -1,4 +1,4 @@
FROM ubuntu:22.04 as build
FROM ubuntu:24.04 as build
# --- basic package installation ---
RUN apt-get update && \
@@ -12,7 +12,8 @@ RUN apt-get update && \
# --- python package installation ---
COPY ./requirements.txt /temp/requirements.txt
COPY ./tools/ppcdis/requirements.txt /temp/tools/ppcdis/requirements.txt
RUN pip install -r /temp/requirements.txt
# why bother setting up a venv for this, right? ¯\_(ツ)_/¯
RUN pip install --break-system-packages -r /temp/requirements.txt
RUN rm -rf /temp
# --- wibo installation ---
@@ -23,26 +24,23 @@ RUN rm wibo
# --- devkitpro installation ---
RUN wget https://apt.devkitpro.org/install-devkitpro-pacman
RUN chmod +x install-devkitpro-pacman
## assume yes for in-script apt commands
# assume yes for in-script apt commands
RUN sed -i 's/^apt-get.*$/& -y/g' install-devkitpro-pacman
## now do dkp-pacman installation
RUN ./install-devkitpro-pacman
RUN rm install-devkitpro-pacman
## workaround for a dumb WSL bug that happens with Windows Docker. if we don't do this, devkitPPC installation fails on Windows.
# workaround for a dumb bug that happens with Windows Docker. if we don't do this, devkitPPC installation fails on Windows.
RUN if [ ! -e /etc/mtab ]; then ln -s /proc/self/mounts /etc/mtab; fi
## and finally, we get to install devkitPPC
RUN dkp-pacman -S devkitPPC --noconfirm
## dear fucking god this is hacky but it works (needed otherwise next step fails)
RUN rm /usr/bin/cpp /usr/bin/g++
## set devkitPPC executables as the default ones
# dear fucking god this is hacky but it works (needed otherwise next step fails)
RUN rm /usr/bin/cpp /usr/bin/g++ /lib/cpp
# set devkitPPC executables as the default ones
RUN for file in $(find "/opt/devkitpro/devkitPPC/bin" -type f -name 'powerpc-eabi*'); do new_file=$(basename "$file" | sed 's/powerpc-eabi-//g'); update-alternatives --install "/usr/bin/$new_file" "$new_file" "$file" 0; done
# --- stage ultralib headers ---
RUN mkdir -p /N64_SDK/ultra/usr/
RUN git clone https://github.com/decompals/ultralib.git /N64_SDK/ultra/usr/
## dockerfile does not seem to support extglob, so this monstrous command works around it to delete all of ultralib except the headers we need.
# dockerfile does not seem to support extglob, so this monstrous command works around it to delete all of ultralib except the headers we need.
RUN cd /N64_SDK/ultra/usr/ && find -type f -maxdepth 1 -delete && find . -not -name 'include' -type d -maxdepth 1 -exec rm -r "{}" \;
## modify Gpopmtx's param member to be unsigned int
# modify Gpopmtx's param member to be unsigned int
RUN sed -i 's/unsigned char param:8;/unsigned int param:8;/g' /N64_SDK/ultra/usr/include/PR/gbi.h
# --- set up work directory and env vars ---
+8 -8
View File
@@ -7,27 +7,27 @@
Decompilation in progress of Animal Crossing (GAFE01)
A decompilation of the original N64 version of the game is being worked on [here](https://github.com/zeldaret/af).
## Cloning
Use `--recursive` when cloning to have ppcdis in the repository.
## Building
> When using Windows, it's recommended to use WSL.
> On Windows, the build is known to run disproportionately slow when ran natively, so we recommend using WSL.
### Docker
1. [Dump a copy of the game](./docs/extract_game.md) and extract all files.
2. Place **main.dol**, **foresta.rel.szs**, **forest_1st.arc**, and **forest_2nd.arc** in *dump/*.
3. Download the [CodeWarrior 1.3.2, 1.3.2r, and 1.2.5n compilers](https://files.decomp.dev/compilers_latest.zip) and extract them to *tools/1.3.2/*, *tools/1.3.2r/*, and *tools/1.2.5n/*, respectively.
4. Install Docker.
5. Build the Docker image (`docker build -t ac-decomp .`).
6. Run configure.py (`docker run --rm -v ${PWD}:/ac-decomp ac-decomp python3 configure.py`).
7. Run build.py (`docker run --rm -v ${PWD}:/ac-decomp ac-decomp python3 build.py`).
3. Install Docker.
4. Set up the Docker image. If using MacOS or Linux (including WSL), run `chmod +x docker-setup.sh && ./docker-setup.sh`. If using Windows, run the `docker-setup.bat` file.
5. Run configure.py (`docker run --rm -v ${PWD}:/ac-decomp ac-decomp python3 configure.py`).
6. Run build.py (`docker run --rm -v ${PWD}:/ac-decomp ac-decomp python3 build.py`).
### Build manually
> ️ When building manually from a work directory originally used for Docker, you will need to run `sudo ninja -t clean` for the build to execute properly.
> ️ When building manually from a work directory previously used for Docker, you will need to run `sudo ninja -t clean` for the build to execute properly.
1. [Dump a copy of the game](./docs/extract_game.md) and extract all files.
2. Place **main.dol**, **foresta.rel.szs**, **forest_1st.arc**, and **forest_2nd.arc** in *dump/*.
@@ -36,7 +36,7 @@ Use `--recursive` when cloning to have ppcdis in the repository.
5. Install Python modules from requirements.txt (`pip install -r requirements.txt`).
6. Install version 0.6.13 of [wibo](https://github.com/decompals/wibo)
- Wibo is a lightweight Wine replacement that's tailor-made for use with decomp projects. Regular Wine can be used if preferred, but for the purposes of this guide, these instructions will use wibo.
- Download [version 0.6.13 GitHub release](https://github.com/decompals/wibo/releases/tag/0.6.13) and run `install ./wibo /usr/bin` to install it to your system.
- Download the [GitHub release of version 0.6.13](https://github.com/decompals/wibo/releases/tag/0.6.13) and run `install ./wibo /usr/bin` to install it to your system.
7. Install devkitPPC.
- To get devkitPPC, you'll need [devkitPro Pacman](https://devkitpro.org/wiki/devkitPro_pacman#Installing_devkitPro_Pacman).
- Run `dkp-pacman -S devkitPPC` once dkp-pacman is installed to install devkitPPC.
+33
View File
@@ -1083,6 +1083,10 @@ ef_ase_ch.c:
.text: [0x806052A8, 0x806054F0]
.rodata: [0x8064BCA8, 0x8064BCC0]
.data: [0x806D1EC8, 0x806D1F08]
ef_break_axe.c:
.text: [0x806054F0, 0x8060672C]
.rodata: [0x8064BCC0, 0x8064BD60]
.data: [0x806D1F08, 0x806D1F20]
ef_bubu.c:
.text: [0x8060672C, 0x80606878]
.rodata: [0x8064BD60, 0x8064BD68]
@@ -1115,6 +1119,30 @@ ef_coin.c:
.text: [0x80608060, 0x806087EC]
.rodata: [0x8064BE48, 0x8064BEA0]
.data: [0x806D20C0, 0x806D2128]
ef_dash_asimoto.c:
.text: [0x806087EC, 0x80609030]
.rodata: [0x8064BEA0, 0x8064BEB8]
.data: [0x806D2128, 0x806D21B0]
ef_dig_hole.c:
.text: [0x80609030, 0x80609910]
.rodata: [0x8064BEB8, 0x8064BF20]
.data: [0x806D21B0, 0x806D2220]
ef_dig_mud.c:
.text: [0x80609910, 0x80609F6C]
.rodata: [0x8064BF20, 0x8064BF70]
.data: [0x806D2220, 0x806D2268]
ef_dig_scoop.c:
.text: [0x80609F6C, 0x8060A808]
.rodata: [0x8064BF70, 0x8064BF90]
.data: [0x806D2268, 0x806D2280]
ef_douzou_light.c:
.text: [0x8060A808, 0x8060AAD4]
.rodata: [0x8064BF90, 0x8064BFA8]
.data: [0x806D2280, 0x806D2298]
ef_doyon.c:
.text: [0x8060AAD4, 0x8060B068]
.rodata: [0x8064BFA8, 0x8064C000]
.data: [0x806D2298, 0x806D22B0]
ef_flash.c:
.text: [0x8060B7B4, 0x8060BCB0]
.rodata: [0x8064C078, 0x8064C0B0]
@@ -1127,6 +1155,10 @@ ef_halloween.c:
.text: [0x8060D44C, 0x8060D654]
.rodata: [0x8064C1C0, 0x8064C1D0]
.data: [0x806D2600, 0x806D2618]
ef_hanabi_dummy.c:
.text: [0x8060E6D8, 0x8060E9B8]
.rodata: [0x8064C2A0, 0x8064C2C0]
.data: [0x806D2858, 0x806D2888]
ef_killer.c:
.text: [0x80614178, 0x8061481C]
.rodata: [0x8064C680, 0x8064C6C0]
@@ -1238,6 +1270,7 @@ data/npc/model/tex/bea_9.c:
.data: [0x806F8F20, 0x806FA140]
data/npc/model/tex/bea_10.c:
.data: [0x806FA140, 0x806FB360]
# dataobject.obj files
data/field/bg/flower/obj_flower.c:
.data: [0x8074FE80, 0x807508C0]
+15
View File
@@ -0,0 +1,15 @@
@echo off
echo "Please ensure Docker Desktop is running before continuing."
pause
curl -O https://files.decomp.dev/compilers_latest.zip
mkdir compilers_temp
tar -xf compilers_latest.zip -C compilers_temp
xcopy compilers_temp\GC\1.2.5n\ tools\1.2.5n\ /E /I
xcopy compilers_temp\GC\1.3.2\ tools\1.3.2\ /E /I
xcopy compilers_temp\GC\1.3.2r\ tools\1.3.2r\ /E /I
del compilers_latest.zip
rmdir /S /Q compilers_temp\
docker build -t ac-decomp .
echo "Docker image setup is now complete. You may proceed with the instructions."
pause
exit
+24
View File
@@ -0,0 +1,24 @@
echo "Please ensure Docker is installed before continuing."
read -p "Press Enter to continue or CTRL-C to exit."
if command -v curl &> /dev/null; then
curl -O https://files.decomp.dev/compilers_latest.zip
elif command -v wget &> /dev/null; then
wget https://files.decomp.dev/compilers_latest.zip
else
echo "You do not seem to have curl or wget installed on this system. Please install one or the other to continue."
exit 0
fi
mkdir compilers_temp
if command -v unzip &> /dev/null; then
unzip compilers_latest.zip -d compilers_temp
else
echo "You do not seem to have unzip installed on this system. Please install it to continue."
rm compilers_latest.zip
rm -r compilers_temp
exit 1
fi
mv compilers_temp/GC/1.2.5n/ tools/ && mv compilers_temp/GC/1.3.2/ tools/ && mv compilers_temp/GC/1.3.2r/ tools/
rm -r compilers_temp compilers_latest.zip
docker build -t ac-decomp .
echo "Docker image setup is now complete. You may proceed with the instructions."
+9 -2
View File
@@ -12,8 +12,9 @@ extern "C" {
#define VOICE_MODE_SILENT 2
/* audio is monophonic */
#define MONO(id) (id | 0x1000)
#define SE_FLAG_15(id) (id | 0x8000)
#define MONO(id) ((id) | 0x1000)
#define HANABI(id) ((id) | 0x2000) /* TODO: better name, this probably is some echo effect modifier */
#define SE_FLAG_15(id) ((id) | 0x8000)
// TODO: Make the rest of Sound Effects with parameters
#define SE_REGISTER MONO(0x50)
@@ -83,6 +84,10 @@ typedef enum audio_sound_effects {
NA_SE_ROD_STROKE = 0x109,
NA_SE_ROD_BACK,
NA_SE_HANABI0 = HANABI(0x10F),
NA_SE_HANABI1 = HANABI(0x110),
NA_SE_HANABI2 = HANABI(0x111),
NA_SE_HANABI3 = HANABI(0x112),
NA_SE_EAT = 0x113,
NA_SE_WEAR = 0x11C,
@@ -95,6 +100,8 @@ typedef enum audio_sound_effects {
NA_SE_TREE_TOUCH = 0x134,
NA_SE_TREE_YURASU,
NA_SE_DOYON = 0x13F,
NA_SE_KIRIBASU_SCOOP = 0x148,
NA_SE_KIRIBASU_OUT,
+172 -4
View File
@@ -1,5 +1,10 @@
#include "ef_effect_control.h"
#include "m_common_data.h"
#include "m_debug.h"
#include "m_rcp.h"
#include "sys_matrix.h"
static void eBreak_Axe_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eBreak_Axe_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eBreak_Axe_mv(eEC_Effect_c* effect, GAME* game);
@@ -18,17 +23,180 @@ eEC_PROFILE_c iam_ef_break_axe = {
};
static void eBreak_Axe_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
// TODO
eEC_CLIP->make_effect_proc(eEC_EFFECT_BREAK_AXE, pos, NULL, game, &angle, item_name, prio, arg0, arg1);
}
static void eBreak_Axe_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
s16 angle = *(s16*)ct_arg + DEG2SHORT_ANGLE2(180.0f);
f32 speed_xz;
f32 speed_y;
f32 tz;
f32 ty;
f32 tx;
s16 add_angle;
effect->timer = RANDOM(10) * 2 + (35 + GETREG(TAKREG, 60)) * 2;
effect->effect_specific[5] = effect->timer;
if (effect->arg0 > 1) {
effect->scale.x = effect->scale.y = effect->scale.z = (1.0f + fqrand()) * 0.01f;
} else {
effect->scale.x = effect->scale.y = effect->scale.z = 0.01f;
}
effect->offset.x = effect->position.y;
effect->offset.y = mCoBG_GetBgY_AngleS_FromWpos(NULL, effect->position, 0.0f);
if (effect->arg0 == 0) {
angle += (int)((40.0f + GETREG(TAKREG, 56) + RANDOM_F(20.0f + GETREG(TAKREG, 57))) * 182.04445f);
effect->offset.y += 10.0f;
} else if (effect->arg0 == 1) {
angle += (int)((20.0f + GETREG(TAKREG, 58) + RANDOM_F(20.0f + GETREG(TAKREG, 59))) * 182.04445f);
effect->offset.y += 15.0f;
} else {
angle += RANDOM_F(14563.0f);
effect->offset.y += 3.0f;
}
effect->effect_specific[4] = *(s16*)ct_arg;
if (effect->arg0 == 0) {
tx = -17.0f + GETREG(TAKREG, 32);
ty = 34.0f + GETREG(TAKREG, 33);
tz = 20.0f + GETREG(TAKREG, 34);
effect->position.x += tz * sin_s(effect->effect_specific[4]) + tx * cos_s(effect->effect_specific[4]);
effect->position.y += ty;
effect->position.z += tz * cos_s(effect->effect_specific[4]) - tx * sin_s(effect->effect_specific[4]);
effect->effect_specific[0] = (-20.0f + GETREG(TAKREG, 35)) * 182.04445f;
add_angle = (int)((-77.0f + GETREG(TAKREG, 36)) * 182.04445f);
effect->effect_specific[4] += add_angle;
effect->effect_specific[2] = (0.0f + GETREG(TAKREG, 37)) * 182.04445f;
effect->effect_specific[1] = qrand() & 0xFFF;
effect->effect_specific[3] = qrand() & 0xFFF;
speed_xz = (0.5f + GETREG(TAKREG, 48) * 0.1f) * 0.5f + RANDOM_F((1.5f + GETREG(TAKREG, 49) * 0.1f) * 0.5f);
speed_y = (8.0f + GETREG(TAKREG, 50) * 0.1f) * 0.5f + RANDOM_F((2.0f + GETREG(TAKREG, 51) * 0.1f) * 0.5f);
} else if (effect->arg0 == 1) {
tz = -4.0f + GETREG(TAKREG, 38);
ty = 27.0f + GETREG(TAKREG, 39);
tx = 17.0f + GETREG(TAKREG, 40);
effect->position.x += tx * sin_s(effect->effect_specific[4]) + tz * cos_s(effect->effect_specific[4]);
effect->position.y += ty;
effect->position.z += tx * cos_s(effect->effect_specific[4]) - tz * sin_s(effect->effect_specific[4]);
effect->effect_specific[0] = (-20.0f + GETREG(TAKREG, 41)) * 182.04445f;
add_angle = (int)((-77.0f + GETREG(TAKREG, 42)) * 182.04445f);
effect->effect_specific[4] += add_angle;
effect->effect_specific[2] = (0.0f + GETREG(TAKREG, 43)) * 182.04445f;
effect->effect_specific[1] = qrand() & 0xFFF;
effect->effect_specific[3] = qrand() & 0xFFF;
speed_xz = (1.5f + GETREG(TAKREG, 52) * 0.1f) * 0.5f + RANDOM_F((1.0f + GETREG(TAKREG, 53) * 0.1f) * 0.5f);
speed_y = (7.5f + GETREG(TAKREG, 54) * 0.1f) * 0.5f + RANDOM_F((3.0f + GETREG(TAKREG, 55) * 0.1f) * 0.5f);
} else {
effect->position.x += RANDOM2_F(10.0f);
effect->position.y += RANDOM2_F(10.0f);
effect->position.z += RANDOM2_F(10.0f);
effect->effect_specific[0] = qrand();
effect->effect_specific[2] = qrand();
effect->effect_specific[1] = qrand() & 0x1FFF;
effect->effect_specific[3] = qrand() & 0x1FFF;
speed_xz = (2.0f + GETREG(TAKREG, 44) * 0.1f) * 0.5f + RANDOM_F((3.5f + GETREG(TAKREG, 45) * 0.1f) * 0.5f);
speed_y = (8.0f + GETREG(TAKREG, 46) * 0.1f) * 0.5f + RANDOM_F((5.0f + GETREG(TAKREG, 47) * 0.1f) * 0.5f);
}
effect->velocity.x = speed_xz * sin_s(angle);
effect->velocity.z = speed_xz * cos_s(angle);
effect->velocity.y = speed_y;
effect->acceleration.y = -0.25f;
}
static void eBreak_Axe_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
u32 ut_attr = mCoBG_Wpos2Attribute(effect->position, NULL);
effect->offset.x = effect->position.y;
effect->offset.z = effect->offset.y;
effect->offset.y = mCoBG_GetBgY_AngleS_FromWpos(NULL, effect->position, 0.0f);
if (effect->arg0 == 0) {
effect->offset.y += 10.0f;
} else if (effect->arg0 == 1) {
effect->offset.y += 15.0f;
}
xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity);
xyz_t_add(&effect->position, &effect->velocity, &effect->position);
effect->effect_specific[0] += effect->effect_specific[1];
effect->effect_specific[2] += effect->effect_specific[3];
if (effect->timer <= ((35 + GETREG(TAKREG, 60)) * 2 - 5)) {
if (effect->position.y < effect->offset.y && mCoBG_CheckWaterAttribute(ut_attr)) {
xyz_t_mult_v(&effect->velocity, 0.8f);
add_calc_short_angle2(&effect->effect_specific[1], 0, 1.0f - sqrtf(0.9f), 182, 9);
add_calc_short_angle2(&effect->effect_specific[3], 0, 1.0f - sqrtf(0.9f), 182, 9);
}
if (effect->position.y < effect->offset.y && effect->offset.x >= effect->offset.y &&
effect->velocity.y < 0.0f) {
if (mCoBG_CheckWaterAttribute(ut_attr)) {
if (effect->arg0 < 2) {
eEC_CLIP->effect_make_proc(eEC_EFFECT_AMI_MIZU, effect->position, effect->prio, 0, game,
effect->item_name, 0, 0);
eEC_CLIP->effect_make_proc(eEC_EFFECT_TURI_HAMON, effect->position, effect->prio, 0, game,
effect->item_name, 0, 0);
}
} else {
effect->position.y = effect->offset.y;
effect->velocity.x *= 0.6f;
effect->velocity.y *= -0.6f;
effect->velocity.z *= 0.6f;
effect->effect_specific[1] >>= 1;
effect->effect_specific[3] >>= 1;
}
}
if (effect->position.y < effect->offset.y && effect->position.y >= effect->offset.z) {
effect->position.x -= effect->velocity.x;
effect->position.y -= effect->velocity.y;
effect->position.z -= effect->velocity.z;
effect->velocity.x *= -0.6f;
effect->velocity.z *= -0.6f;
}
}
}
extern Gfx ef_axe1_model[];
extern Gfx ef_axe2_model[];
extern Gfx ef_axe3_model[];
static void eBreak_Axe_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
u8 a = (int)eEC_CLIP->calc_adjust_proc(effect->timer, 0, (15 + GETREG(TAKREG, 61)) * 2, 0.0f, 255.0f);
_texture_z_light_fog_prim_xlu(game->graph);
OPEN_DISP(game->graph);
Matrix_translate(effect->position.x, effect->position.y, effect->position.z, 0);
Matrix_RotateY(effect->effect_specific[4] + (int)(GETREG(TAKREG, 21) * 182.04445f), 1);
Matrix_rotateXYZ(effect->effect_specific[0] + (int)(GETREG(TAKREG, 20) * 182.04445f), 0,
effect->effect_specific[2] + (int)(GETREG(TAKREG, 22) * 182.04445f), 1);
Matrix_scale(effect->scale.x, effect->scale.y, effect->scale.z, 1);
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 128, 255, 255, 255, a);
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (effect->arg0 == 0) {
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_axe1_model);
} else if (effect->arg0 == 1) {
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_axe2_model);
} else {
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_axe3_model);
}
CLOSE_DISP(game->graph);
}
+165 -5
View File
@@ -1,5 +1,7 @@
#include "ef_effect_control.h"
#include "m_common_data.h"
static void eDashAsimoto_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eDashAsimoto_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eDashAsimoto_mv(eEC_Effect_c* effect, GAME* game);
@@ -17,18 +19,176 @@ eEC_PROFILE_c iam_ef_dash_asimoto = {
// clang-format on
};
static void eDashAsimoto_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
// TODO
static xyz_t eDahsAsimoto_GetMakeOffset(xyz_t pos, s16 angle_y) {
xyz_t base_ofs = { 0.0f, 0.0f, 10.0f };
sMath_RotateY(&base_ofs, SHORTANGLE2RAD(angle_y));
xyz_t_add(&pos, &base_ofs, &pos);
return pos;
}
static void eDashAsimoto_Hanabira_Make(eEC_Effect_c* effect, GAME* game) {
mActor_name_t* item_p = mFI_GetUnitFG(effect->position);
if (item_p != NULL && *item_p >= FLOWER_PANSIES0 && *item_p <= FLOWER_TULIP2) {
int i;
for (i = 0; i < 2; i++) {
eEC_CLIP->effect_make_proc(eEC_EFFECT_HANABIRA, effect->position, effect->prio, 0, game, effect->item_name,
*item_p - FLOWER_PANSIES0, 0);
}
}
}
static void eDashAsimoto_RainDay(eEC_Effect_c* effect, GAME* game) {
xyz_t pos = effect->position;
xyz_t bush_pos;
xyz_t ofs;
int i;
ofs = eDahsAsimoto_GetMakeOffset(pos, effect->effect_specific[0]);
bush_pos = ofs;
switch (effect->arg0) {
case mCoBG_ATTRIBUTE_BUSH:
i = 2;
do {
eEC_CLIP->effect_make_proc(eEC_EFFECT_BUSH_HAPPA, bush_pos, effect->prio, effect->effect_specific[0],
game, effect->item_name, effect->arg0, 1);
} while (i-- != 0);
break;
case mCoBG_ATTRIBUTE_FLOOR:
break;
case mCoBG_ATTRIBUTE_WAVE:
eEC_CLIP->effect_make_proc(eEC_EFFECT_SIBUKI, effect->position, effect->prio, effect->effect_specific[0],
game, effect->item_name, effect->arg0, 1);
break;
default:
eEC_CLIP->effect_make_proc(eEC_EFFECT_SIBUKI, effect->position, effect->prio, effect->effect_specific[0],
game, effect->item_name, effect->arg0, 0);
break;
}
}
static void eDashAsimoto_FineDay(eEC_Effect_c* effect, GAME* game) {
xyz_t pos = effect->position;
xyz_t bush_pos;
xyz_t ofs;
int season;
int i;
ofs = eDahsAsimoto_GetMakeOffset(pos, effect->effect_specific[0]);
bush_pos = ofs;
season = Common_Get(time.season);
switch (season) {
case mTM_SEASON_WINTER: {
switch (effect->arg0) {
case mCoBG_ATTRIBUTE_GRASS0:
case mCoBG_ATTRIBUTE_GRASS1:
case mCoBG_ATTRIBUTE_GRASS2:
case mCoBG_ATTRIBUTE_GRASS3:
eEC_CLIP->effect_make_proc(eEC_EFFECT_YUKIHANE, effect->position, effect->prio,
effect->effect_specific[0], game, effect->item_name, effect->arg0,
effect->arg1);
break;
case mCoBG_ATTRIBUTE_BUSH:
i = 2;
do {
eEC_CLIP->effect_make_proc(eEC_EFFECT_BUSH_HAPPA, bush_pos, effect->prio,
effect->effect_specific[0], game, effect->item_name, effect->arg0,
1);
} while (i-- != 0);
i = 2;
do {
eEC_CLIP->effect_make_proc(eEC_EFFECT_BUSH_YUKI, bush_pos, effect->prio,
effect->effect_specific[0], game, effect->item_name, effect->arg0,
0);
} while (i-- != 0);
break;
case mCoBG_ATTRIBUTE_FLOOR:
break;
case mCoBG_ATTRIBUTE_SAND:
eEC_CLIP->effect_make_proc(eEC_EFFECT_SANDSPLASH, effect->position, effect->prio,
effect->effect_specific[0], game, effect->item_name, effect->arg0, 0);
break;
case mCoBG_ATTRIBUTE_WAVE:
eEC_CLIP->effect_make_proc(eEC_EFFECT_SIBUKI, effect->position, effect->prio,
effect->effect_specific[0], game, effect->item_name, effect->arg0, 1);
break;
default:
eEC_CLIP->effect_make_proc(eEC_EFFECT_DUST, effect->position, effect->prio,
effect->effect_specific[0], game, effect->item_name, effect->arg0, 8);
break;
}
break;
}
default: {
switch (effect->arg0) {
case mCoBG_ATTRIBUTE_BUSH:
i = 2;
do {
eEC_CLIP->effect_make_proc(eEC_EFFECT_BUSH_HAPPA, bush_pos, effect->prio,
effect->effect_specific[0], game, effect->item_name, effect->arg0,
1);
} while (i-- != 0);
break;
case mCoBG_ATTRIBUTE_FLOOR:
break;
case mCoBG_ATTRIBUTE_SAND:
eEC_CLIP->effect_make_proc(eEC_EFFECT_SANDSPLASH, effect->position, effect->prio,
effect->effect_specific[0], game, effect->item_name, effect->arg0, 0);
break;
case mCoBG_ATTRIBUTE_WAVE:
eEC_CLIP->effect_make_proc(eEC_EFFECT_SIBUKI, effect->position, effect->prio,
effect->effect_specific[0], game, effect->item_name, effect->arg0, 1);
break;
default:
eEC_CLIP->effect_make_proc(eEC_EFFECT_DUST, effect->position, effect->prio,
effect->effect_specific[0], game, effect->item_name, effect->arg0, 8);
break;
}
break;
}
}
}
static void eDashAsimoto_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
eEC_CLIP->make_effect_proc(eEC_EFFECT_DASH_ASIMOTO, pos, NULL, game, &angle, item_name, prio, arg0, arg1);
}
typedef void (*eDashAsimoto_PROC)(eEC_Effect_c*, GAME*);
static void eDashAsimoto_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
// clang-format off
static eDashAsimoto_PROC asimoto_func_table[mEnv_WEATHER_NUM] = {
&eDashAsimoto_FineDay,
&eDashAsimoto_RainDay,
&eDashAsimoto_FineDay,
&eDashAsimoto_FineDay,
/* @BUG - the step effect process func for 'leaves' weather is left as NULL */
#ifdef BUGFIXES
&eDashAsimoto_FineDay,
#else
NULL,
#endif
};
// clang-format on
s16 weather = mEnv_NowWeather();
s16* angle_p = (s16*)ct_arg;
effect->timer = 0;
eDashAsimoto_Hanabira_Make(effect, game);
effect->effect_specific[0] = *angle_p;
(*asimoto_func_table[weather])(effect, game);
}
static void eDashAsimoto_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
// empty
}
static void eDashAsimoto_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
// empty
}
+167 -4
View File
@@ -1,5 +1,10 @@
#include "ef_effect_control.h"
#include "m_common_data.h"
#include "m_player_lib.h"
#include "m_rcp.h"
#include "sys_matrix.h"
static void eDig_Hole_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eDig_Hole_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eDig_Hole_mv(eEC_Effect_c* effect, GAME* game);
@@ -17,18 +22,176 @@ eEC_PROFILE_c iam_ef_dig_hole = {
// clang-format on
};
typedef struct dig_hole_init_data_s {
s16 type;
s16 angle_y;
s16 goal_angle_x;
s16 timer;
} eDig_Hole_init_data_c;
static void eDig_Hole_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
// TODO
GAME_PLAY* play = (GAME_PLAY*)game;
PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play);
pos.x += player->actor_class.world.position.x + sin_s(angle) * 30.0f;
pos.z += player->actor_class.world.position.z + cos_s(angle) * 30.0f;
pos.x /= 2.0f;
pos.z /= 2.0f;
eEC_CLIP->make_effect_proc(eEC_EFFECT_DIG_HOLE, pos, NULL, game, &angle, item_name, prio, arg0, arg1);
}
static void eDig_Hole_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
static xyz_t fill_hole_pos_tbl[] = {
{ 0.0f, 0.0f, -21.0f },
{ 11.0f, 0.0f, -14.0f },
{ -3.0f, 0.0f, -8.0f },
};
static eDig_Hole_init_data_c init_data[] = {
{ 0, DEG2SHORT_ANGLE2(180.0f), DEG2SHORT_ANGLE2(179.0f), 36 },
{ 0, DEG2SHORT_ANGLE2(60.0f), DEG2SHORT_ANGLE2(179.0f), 36 },
{ 0, DEG2SHORT_ANGLE2(300.0f) + 1, DEG2SHORT_ANGLE2(179.0f), 36 },
{ 1, DEG2SHORT_ANGLE2(270.0f), DEG2SHORT_ANGLE2(179.0f), 58 },
{ 1, DEG2SHORT_ANGLE2(270.0f), DEG2SHORT_ANGLE2(179.0f), 46 },
{ 1, DEG2SHORT_ANGLE2(270.0f), DEG2SHORT_ANGLE2(150.0f), 34 },
};
s16* angle_p = (s16*)ct_arg;
effect->effect_specific[0] = *angle_p;
effect->effect_specific[4] = init_data[effect->arg1].type;
effect->effect_specific[0] += init_data[effect->arg1].angle_y;
effect->effect_specific[3] = init_data[effect->arg1].goal_angle_x;
effect->effect_specific[2] = init_data[effect->arg1].timer;
effect->effect_specific[1] = 0;
effect->scale = ZeroVec;
if (effect->effect_specific[4] == 1) {
xyz_t pos = fill_hole_pos_tbl[effect->arg1 - 3];
eEC_CLIP->vector_rotate_y_proc(&pos, SHORTANGLE2RAD(effect->effect_specific[0]));
effect->position.x += pos.x;
effect->position.y += 10.0f;
effect->position.z += pos.z;
eEC_CLIP->effect_make_proc(eEC_EFFECT_DIG_MUD, effect->position, effect->prio, effect->effect_specific[0], game,
effect->item_name, effect->arg0, 6);
} else {
effect->position.x += 5.0f * sin_s(effect->effect_specific[0]);
effect->position.y += 10.0f;
effect->position.z += 5.0f * cos_s(effect->effect_specific[0]);
}
if (effect->arg0 == mCoBG_ATTRIBUTE_WAVE) {
int i;
s16 mizutama_arg1;
s16 mizutama_angle = *angle_p;
s16 angle;
xyz_t pos = effect->position;
pos.y = 21.0f;
if (effect->arg1 <= 2) {
mizutama_arg1 = 0x4000 | (effect->arg1 << 1);
} else {
mizutama_arg1 = 0x4000 | (5 << 1);
}
for (i = 0; i < 2; i++) {
pos.x = effect->position.x + RANDOM2_F(10.0f);
pos.z = effect->position.z + RANDOM2_F(10.0f);
if (effect->arg1 > 2) {
angle = mizutama_angle + (s16)(int)(RANDOM2_F(150.0f) * 182.04445f);
} else {
angle = mizutama_angle + (s16)(int)(RANDOM2_F(90.0f) * 182.04445f);
}
mizutama_angle = angle;
eEC_CLIP->effect_make_proc(eEC_EFFECT_MIZUTAMA, pos, effect->prio, mizutama_angle, game, effect->item_name,
effect->arg0, mizutama_arg1);
}
}
effect->timer = effect->effect_specific[2];
}
static void eDig_Hole_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
if (effect->timer > (effect->effect_specific[2] - 6)) {
effect->scale.x += 0.00108333334f;
effect->scale.y = effect->scale.z = effect->scale.x;
} else if (effect->timer < 6 && effect->effect_specific[4] == 1) {
effect->scale.x -= 0.00108333334f;
effect->scale.y = effect->scale.z = effect->scale.x;
} else if (effect->effect_specific[4] == 1 || effect->timer <= (effect->effect_specific[2] - 8)) {
add_calc_short_angle2(&effect->effect_specific[1], effect->effect_specific[3], 1.0f - sqrtf(0.8f), 1820, 91);
}
if (effect->timer == (effect->effect_specific[2] - 8)) {
f32 speed;
if (effect->arg1 == 0 || effect->arg1 == 1 || effect->arg1 == 2) {
speed = 0.15f;
} else {
speed = 0.75f;
}
effect->velocity.y = 1.0f;
effect->velocity.x = speed * sin_s(effect->effect_specific[0]);
effect->velocity.z = speed * cos_s(effect->effect_specific[0]);
effect->acceleration.y = -0.1f;
}
if (effect->effect_specific[4] == 0 || effect->timer > (effect->effect_specific[2] - 30)) {
xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity);
xyz_t_add(&effect->position, &effect->velocity, &effect->position);
}
}
extern Gfx ef_anahori01_00_model[];
extern Gfx ef_anahori01_01_model[];
extern Gfx ef_anahori01_02_model[];
static void eDig_Hole_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
OPEN_DISP(game->graph);
_texture_z_light_fog_prim_xlu(game->graph);
Matrix_translate(effect->position.x, effect->position.y, effect->position.z, 0);
Matrix_RotateY(effect->effect_specific[0], 1);
Matrix_RotateX(effect->effect_specific[1], 1);
Matrix_scale(effect->scale.x, effect->scale.y, effect->scale.z, 1);
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (effect->effect_specific[4] == 0) {
u8 a = (int)eEC_CLIP->calc_adjust_proc(effect->timer, 0, 10, 0.0f, 255.0f);
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 255, 255, 255, 255, a);
} else {
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 255, 255, 255, 255, 255);
}
switch (effect->arg0) {
case mCoBG_ATTRIBUTE_GRASS0:
case mCoBG_ATTRIBUTE_GRASS1:
case mCoBG_ATTRIBUTE_GRASS2:
if (effect->effect_specific[4] == 0) {
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_anahori01_00_model);
} else {
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_anahori01_01_model);
}
break;
case mCoBG_ATTRIBUTE_WAVE:
case mCoBG_ATTRIBUTE_SAND:
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_anahori01_02_model);
break;
default:
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_anahori01_01_model);
break;
}
CLOSE_DISP(game->graph);
}
+138 -4
View File
@@ -1,5 +1,46 @@
#include "ef_effect_control.h"
#include "m_common_data.h"
#include "m_rcp.h"
#include "sys_matrix.h"
#include "m_debug.h"
extern u8 ef_mogura01_01_tex[];
extern u8 ef_mogura01_02_tex[];
extern u8 ef_mogura01_03_tex[];
extern u8 ef_mogura01_04_tex[];
extern u8 ef_anahori02_01_tex[];
extern u8 ef_anahori02_02_tex[];
extern u8 ef_anahori02_03_tex[];
extern u8 ef_anahori02_04_tex[];
extern u8 ef_anahori03_01_tex[];
extern u8 ef_anahori03_02_tex[];
extern u8 ef_anahori03_03_tex[];
extern u8 ef_anahori03_04_tex[];
static u8* eDig_Mud_tex_tbl[] = {
ef_anahori02_01_tex,
ef_anahori02_02_tex,
ef_anahori02_03_tex,
ef_anahori02_04_tex,
};
static u8* eDig_Mud_Sand_tex_tbl[] = {
ef_anahori03_01_tex,
ef_anahori03_02_tex,
ef_anahori03_03_tex,
ef_anahori03_04_tex,
};
static u8* eDig_Mud_Mogura_tex_tbl[] = {
ef_mogura01_02_tex,
ef_mogura01_03_tex,
ef_mogura01_01_tex,
ef_mogura01_04_tex,
};
static void eDig_Mud_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eDig_Mud_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eDig_Mud_mv(eEC_Effect_c* effect, GAME* game);
@@ -18,17 +59,110 @@ eEC_PROFILE_c iam_ef_dig_mud = {
};
static void eDig_Mud_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
// TODO
eEC_CLIP->make_effect_proc(eEC_EFFECT_DIG_MUD, pos, NULL, game, &angle, item_name, prio, arg0, arg1);
}
static void eDig_Mud_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
s16* angle_p = (s16*)ct_arg;
s16 angle_y = *angle_p;
s16 angle_x = (s16)(int)((-60.0f + RANDOM2_F(20.0f)) * 182.04445f);
f32 cos_x = cos_s(angle_x);
f32 speed = -3.5f + RANDOM2_F(4.5f) * 0.5f;
if ((effect->arg1 & 0x8000)) {
effect->effect_specific[1] = 1;
effect->arg1 &= ~0x8000;
} else {
effect->effect_specific[1] = 0;
}
if ((effect->arg1 & 0x4000)) {
effect->scale.x = effect->scale.y = effect->scale.z = (0.5f + GETREG(TAKREG, 15) * 0.01f) * 0.01f;
effect->effect_specific[2] = 1;
effect->arg1 &= ~0x4000;
} else {
effect->scale.x = effect->scale.y = effect->scale.z = 0.01f;
effect->effect_specific[2] = 0;
}
if (effect->arg1 == 0 || effect->arg1 == 3) {
effect->effect_specific[0] = 32;
} else if (effect->arg1 == 1 || effect->arg1 == 4) {
effect->effect_specific[0] = 30;
} else {
effect->effect_specific[0] = 28;
}
if (effect->arg1 < 3) {
angle_y += (int)((30.0f + RANDOM2_F(20.0f)) * 182.04445f);
effect->velocity.x = (speed * cos_x) * sin_s(angle_y);
effect->velocity.y = speed * sin_s(angle_x);
effect->velocity.z = (speed * cos_x) * cos_s(angle_y);
} else if (effect->arg1 < 6) {
angle_y += (s16)(int)((120.0f * effect->arg1) * 182.04445f);
effect->velocity.x = 0.4f * sin_s(angle_y);
effect->velocity.y = 1.75f + fqrand();
effect->velocity.z = 0.4f * cos_s(angle_y);
} else if (effect->arg1 != 8) {
effect->velocity.x = sin_s(angle_y);
effect->velocity.y = 2.0f + fqrand();
effect->velocity.z = cos_s(angle_y);
} else {
effect->velocity.x = 0.0f;
effect->velocity.y = 2.0f + fqrand();
effect->velocity.z = 0.0f;
}
effect->acceleration.y = -0.175f;
effect->timer = effect->effect_specific[0];
}
static void eDig_Mud_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity);
xyz_t_add(&effect->position, &effect->velocity, &effect->position);
if (effect->timer < 18) {
if (effect->effect_specific[2] != 1) {
eEC_CLIP->calc_adjust_proc(effect->timer, 0, 18, 0.012f, 0.010f);
} else {
eEC_CLIP->calc_adjust_proc(effect->timer, 0, 18, 0.006f, 0.005f);
}
}
}
extern Gfx ef_anahori02_00_modelT[];
extern Gfx ef_anahori03_00_modelT[];
extern Gfx ef_mogura01_00_modelT[];
static void eDig_Mud_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
int tex_idx;
if (effect->timer > 18) {
tex_idx = 0;
} else if (effect->timer > 14) {
tex_idx = 1;
} else if (effect->timer > 10) {
tex_idx = 2;
} else {
tex_idx = 3;
}
OPEN_DISP(game->graph);
eEC_CLIP->auto_matrix_xlu_proc(game, &effect->position, &effect->scale);
if (effect->effect_specific[1] == 1) {
gSPSegment(NEXT_POLY_XLU_DISP, ANIME_1_TXT_SEG, eDig_Mud_Mogura_tex_tbl[tex_idx]);
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_mogura01_00_modelT);
} else if (effect->arg0 == mCoBG_ATTRIBUTE_SAND || effect->arg0 == mCoBG_ATTRIBUTE_WAVE) {
gSPSegment(NEXT_POLY_XLU_DISP, ANIME_1_TXT_SEG, eDig_Mud_Sand_tex_tbl[tex_idx]);
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_anahori03_00_modelT);
} else {
gSPSegment(NEXT_POLY_XLU_DISP, ANIME_1_TXT_SEG, eDig_Mud_tex_tbl[tex_idx]);
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_anahori02_00_modelT);
}
CLOSE_DISP(game->graph);
}
+151 -4
View File
@@ -1,5 +1,8 @@
#include "ef_effect_control.h"
#include "m_common_data.h"
#include "m_player_lib.h"
static void eDig_Scoop_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eDig_Scoop_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eDig_Scoop_mv(eEC_Effect_c* effect, GAME* game);
@@ -18,17 +21,161 @@ eEC_PROFILE_c iam_ef_dig_scoop = {
};
static void eDig_Scoop_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
// TODO
ACTOR* player_actorx = (ACTOR*)GET_PLAYER_ACTOR_GAME(game);
PLAYER_ACTOR* player;
int i;
s16 star_ef_angle;
s16 sand_angle;
xyz_t sand_pos;
s16 dust_angle;
pos.x += player_actorx->world.position.x + 30.0f * sin_s(angle);
pos.z += player_actorx->world.position.z + 30.0f * cos_s(angle);
pos.x /= 2.0f;
pos.z /= 2.0f;
if (eEC_CLIP != NULL) {
if (arg1 == 1) {
player = GET_PLAYER_ACTOR_GAME(game);
star_ef_angle = angle + DEG2SHORT_ANGLE2(22.5f);
switch (arg0) {
case mCoBG_ATTRIBUTE_BUSH: {
int i = 4;
do {
eEC_CLIP->effect_make_proc(eEC_EFFECT_BUSH_HAPPA, player->actor_class.world.position, prio,
angle, game, item_name, arg0, 1);
} while (i--);
if (Common_Get(time).season == mTM_SEASON_WINTER) {
int j = 4;
do {
eEC_CLIP->effect_make_proc(eEC_EFFECT_BUSH_YUKI, player->actor_class.world.position, prio,
angle, game, item_name, arg0, 0);
} while (j--);
}
break;
}
case mCoBG_ATTRIBUTE_GRASS0:
case mCoBG_ATTRIBUTE_GRASS1:
case mCoBG_ATTRIBUTE_GRASS2:
case mCoBG_ATTRIBUTE_SOIL0:
case mCoBG_ATTRIBUTE_SOIL1:
case mCoBG_ATTRIBUTE_SOIL2: {
f32 ground_dist = mCoBG_GetBgY_AngleS_FromWpos(NULL, pos, 0.0f);
if (ground_dist < (pos.y + 10.0f)) {
break;
}
}
/* Fallthrough */
default: {
s16 i;
pos.y += 11.0f;
for (i = 0; i < 2; i++) {
eEC_CLIP->effect_make_proc(eEC_EFFECT_IMPACT_STAR, pos, prio, star_ef_angle, game, item_name,
arg0, (s16)i);
}
break;
}
}
} else if (arg1 == 0) {
pos.y += 10.0f;
for (i = 0; i < 6; i++) {
eEC_CLIP->effect_make_proc(eEC_EFFECT_DIG_MUD, pos, prio, angle, game, item_name, arg0, i);
}
} else if (arg1 == 3) {
pos.y += 10.0f;
for (i = 3; i < 6; i++) {
eEC_CLIP->effect_make_proc(eEC_EFFECT_DIG_MUD, pos, prio, angle, game, item_name, arg0, i);
}
} else {
pos.y += 5.0f;
if (Common_Get(time).season == mTM_SEASON_WINTER) {
if (arg0 == mCoBG_ATTRIBUTE_GRASS0 || arg0 == mCoBG_ATTRIBUTE_GRASS1 ||
arg0 == mCoBG_ATTRIBUTE_GRASS2) {
for (i = 2; i < 6; i++) {
eEC_CLIP->effect_make_proc(eEC_EFFECT_YUKIDAMA, pos, prio, angle, game, item_name, arg0,
(0x2000 | 0x1000) | i);
}
} else if (arg0 == mCoBG_ATTRIBUTE_SAND) {
sand_angle = angle - DEG2SHORT_ANGLE2(45.0f);
for (i = 0; i < 3; i++) {
xyz_t sand_pos = pos;
sand_pos.x += 15.0f * sin_s(sand_angle);
sand_pos.z += 15.0f * cos_s(sand_angle);
eEC_CLIP->effect_make_proc(eEC_EFFECT_SANDSPLASH, sand_pos, prio, sand_angle, game, item_name,
3, 0);
sand_angle += DEG2SHORT_ANGLE2(45.0f);
}
} else if (mEnv_NowWeather() != mEnv_WEATHER_RAIN && arg0 != mCoBG_ATTRIBUTE_WAVE) {
dust_angle = angle - DEG2SHORT_ANGLE2(45.0f);
for (i = 0; i < 3; i++) {
eEC_CLIP->effect_make_proc(eEC_EFFECT_TUMBLE_DUST, pos, prio, dust_angle, game, item_name, arg0,
i);
dust_angle += DEG2SHORT_ANGLE2(45.0f);
}
} else {
for (i = 2; i < 6; i++) {
eEC_CLIP->effect_make_proc(eEC_EFFECT_MIZUTAMA, pos, prio, angle, game, item_name, arg0,
(0x2000 | 0x1000) | i);
}
if (arg0 == mCoBG_ATTRIBUTE_WAVE) {
eEC_CLIP->effect_make_proc(eEC_EFFECT_AMI_MIZU, pos, prio, angle, game, item_name, 1, 0);
}
}
} else {
if (arg0 == mCoBG_ATTRIBUTE_SAND) {
sand_angle = angle - DEG2SHORT_ANGLE2(45.0f);
for (i = 0; i < 3; i++) {
xyz_t sand_pos = pos;
sand_pos.x += 15.0f * sin_s(sand_angle);
sand_pos.z += 15.0f * cos_s(sand_angle);
eEC_CLIP->effect_make_proc(eEC_EFFECT_SANDSPLASH, sand_pos, prio, sand_angle, game, item_name,
3, 0);
sand_angle += DEG2SHORT_ANGLE2(45.0f);
}
} else if (mEnv_NowWeather() == mEnv_WEATHER_RAIN || arg0 == mCoBG_ATTRIBUTE_WAVE) {
for (i = 2; i < 6; i++) {
eEC_CLIP->effect_make_proc(eEC_EFFECT_MIZUTAMA, pos, prio, angle, game, item_name, arg0,
(0x2000 | 0x1000) | i);
}
if (arg0 == mCoBG_ATTRIBUTE_WAVE) {
eEC_CLIP->effect_make_proc(eEC_EFFECT_AMI_MIZU, pos, prio, angle, game, item_name, 1, 0);
}
} else {
dust_angle = angle - DEG2SHORT_ANGLE2(45.0f);
for (i = 0; i < 3; i++) {
eEC_CLIP->effect_make_proc(eEC_EFFECT_TUMBLE_DUST, pos, prio, dust_angle, game, item_name, arg0,
i);
dust_angle += DEG2SHORT_ANGLE2(45.0f);
}
}
}
}
}
eEC_CLIP->make_effect_proc(eEC_EFFECT_DIG_SCOOP, pos, NULL, game, NULL, item_name, prio, arg0, arg1);
}
static void eDig_Scoop_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
effect->timer = 0;
}
static void eDig_Scoop_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
// empty
}
static void eDig_Scoop_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
// empty
}
+52 -4
View File
@@ -1,5 +1,9 @@
#include "ef_effect_control.h"
#include "m_common_data.h"
#include "m_rcp.h"
#include "sys_matrix.h"
static void eDouzou_Light_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eDouzou_Light_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eDouzou_Light_mv(eEC_Effect_c* effect, GAME* game);
@@ -18,17 +22,61 @@ eEC_PROFILE_c iam_ef_douzou_light = {
};
static void eDouzou_Light_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
// TODO
eEC_CLIP->make_effect_proc(eEC_EFFECT_DOUZOU_LIGHT, pos, NULL, game, NULL, item_name, prio, arg0, arg1);
}
static void eDouzou_Light_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
switch (effect->arg0) {
case 0:
effect->offset.x = 0.012f;
break;
case 1:
effect->offset.x = 0.011f;
break;
case 2:
effect->offset.x = 0.010f;
break;
default:
effect->offset.x = 0.009f;
break;
}
effect->timer = 24;
}
static void eDouzou_Light_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
if (effect->timer > 12) {
effect->scale.x = eEC_CLIP->calc_adjust_proc(effect->timer, 12, 24, effect->offset.x, 0.0f);
} else {
effect->scale.x = eEC_CLIP->calc_adjust_proc(effect->timer, 0, 12, 0.0f, effect->offset.x);
}
effect->scale.y = effect->scale.z = effect->scale.x;
}
extern Gfx ef_carhosi01_00_modelT[];
static void eDouzou_Light_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
OPEN_DISP(game->graph);
eEC_CLIP->auto_matrix_xlu_proc(game, &effect->position, &effect->scale);
switch (effect->arg0) {
case 0:
gDPSetEnvColor(NEXT_POLY_XLU_DISP, 255, 255, 0, 255);
break;
case 1:
gDPSetEnvColor(NEXT_POLY_XLU_DISP, 200, 255, 255, 255);
break;
case 2:
gDPSetEnvColor(NEXT_POLY_XLU_DISP, 255, 100, 100, 255);
break;
default:
gDPSetEnvColor(NEXT_POLY_XLU_DISP, 100, 255, 100, 255);
break;
}
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_carhosi01_00_modelT);
CLOSE_DISP(game->graph);
}
+56 -4
View File
@@ -1,5 +1,9 @@
#include "ef_effect_control.h"
#include "m_common_data.h"
#include "m_rcp.h"
#include "sys_matrix.h"
static void eDoyon_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eDoyon_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eDoyon_mv(eEC_Effect_c* effect, GAME* game);
@@ -18,17 +22,65 @@ eEC_PROFILE_c iam_ef_doyon = {
};
static void eDoyon_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
// TODO
eEC_CLIP->make_effect_proc(eEC_EFFECT_DOYON, pos, NULL, game, &angle, item_name, prio, arg0, arg1);
}
static void eDoyon_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
s16 rng = qrand();
s16 rng_angle = (s16)((f32)rng * 0.75f);
effect->position.x += 10.0f * sin_s(rng_angle);
effect->position.y += 10.0f * cos_s(rng_angle);
effect->velocity.x += sin_s(rng_angle) * 0.5f;
effect->velocity.y += cos_s(rng_angle) * 0.5f;
effect->offset.z = 20.0f;
effect->scale = ZeroVec;
effect->scale.z = 0.1f;
effect->timer = 60;
sAdo_OngenTrgStart(NA_SE_DOYON, &effect->position);
}
static void eDoyon_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
f32 progress = eEC_CLIP->calc_adjust_proc(effect->timer, 0, 60, 0.0f, 5.0f);
xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity);
xyz_t_add(&effect->position, &effect->velocity, &effect->position);
effect->effect_specific[0] += DEG2SHORT_ANGLE2(5.625f);
effect->effect_specific[1] += DEG2SHORT_ANGLE2(5.625f);
effect->velocity.x *= sqrtf(0.95f);
effect->velocity.y *= sqrtf(0.95f);
if (effect->timer > 50) {
f32 scale = (60 - effect->timer) * 0.00065f;
effect->scale.x = scale * (1.0f + 0.2f * cos_s(effect->effect_specific[0]));
effect->scale.y = scale * (1.0f + 0.2f * sin_s(effect->effect_specific[0]));
} else {
effect->scale.x = (1.0f + 0.2f * cos_s(effect->effect_specific[0])) * 0.0065f;
effect->scale.y = (1.0f + 0.2f * sin_s(effect->effect_specific[0])) * 0.0065f;
}
effect->offset.x = progress * cos_s(effect->effect_specific[1]);
effect->offset.y = progress * sin_s(effect->effect_specific[1]);
}
extern Gfx ef_doyon01_00_modelT[];
static void eDoyon_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
u8 a = (int)eEC_CLIP->calc_adjust_proc(effect->timer, 0, 8, 0.0f, 220.0f);
OPEN_DISP(game->graph);
eEC_CLIP->auto_matrix_xlu_offset_proc(game, &effect->position, &effect->scale, &effect->offset);
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 255, 40, 30, 40, a);
gDPSetEnvColor(NEXT_POLY_XLU_DISP, 100, 100, 255, 255);
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_doyon01_00_modelT);
CLOSE_DISP(game->graph);
}
+72 -4
View File
@@ -1,5 +1,25 @@
#include "ef_effect_control.h"
#include "m_common_data.h"
#define eHanabiDummy_TIMER 80
#define eHanabiDummy_MIN_POWER 0.0f
#define eHanabiDummy_MAX_POWER 2.0f
#define eHanabiDummy_MAX_DIST (mFI_UNIT_BASE_SIZE_F * 12)
enum {
eHanabiDummy_TYPE0,
eHanabiDummy_TYPE1,
eHanabiDummy_TYPE2,
eHanabiDummy_TYPE3,
eHanabiDummy_TYPE4,
eHanabiDummy_TYPE5,
eHanabiDummy_TYPE_NUM
};
#define eHanabiDummy_TYPE_ARG (effect->effect_specific[0])
static void eHanabiDummy_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eHanabiDummy_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eHanabiDummy_mv(eEC_Effect_c* effect, GAME* game);
@@ -18,17 +38,65 @@ eEC_PROFILE_c iam_ef_hanabi_dummy = {
};
static void eHanabiDummy_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
// TODO
(*eEC_CLIP->make_effect_proc)(eEC_EFFECT_HANABI_DUMMY, pos, NULL, game, NULL, item_name, prio, arg0, arg1);
}
static void eHanabiDummy_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
effect->timer = eHanabiDummy_TIMER;
eHanabiDummy_TYPE_ARG = RANDOM(eHanabiDummy_TYPE_NUM);
}
static void eHanabiDummy_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
rgba_t light_color;
s16 frames_passed = eHanabiDummy_TIMER - effect->timer;
if (frames_passed == 10) {
static rgba_t dummy_light[eHanabiDummy_TYPE_NUM] = {
{ 50, 30, 20, 255 }, { 20, 60, 20, 255 }, { 40, 10, 60, 255 },
{ 40, 20, 20, 255 }, { 20, 40, 20, 255 }, { 60, 60, 30, 255 },
};
eEC_CLIP->decide_light_power_proc(&light_color, dummy_light[eHanabiDummy_TYPE_ARG], effect->position, game,
eHanabiDummy_MAX_POWER, eHanabiDummy_MIN_POWER, eHanabiDummy_MAX_DIST);
if (effect->arg0 != 0) {
light_color.r = light_color.r * eHanabiDummy_MAX_POWER;
light_color.g = light_color.g * eHanabiDummy_MAX_POWER;
light_color.b = light_color.b * eHanabiDummy_MAX_POWER;
}
eEC_CLIP->regist_effect_light(light_color, 20, 50, TRUE);
}
if (frames_passed == 72) {
xyz_t pos = effect->position;
u16 sfx_no;
pos.y += 200.0f;
switch (eHanabiDummy_TYPE_ARG) {
case eHanabiDummy_TYPE0:
case eHanabiDummy_TYPE1:
sfx_no = NA_SE_HANABI0;
break;
case eHanabiDummy_TYPE2:
sfx_no = NA_SE_HANABI1;
break;
case eHanabiDummy_TYPE3:
case eHanabiDummy_TYPE4:
sfx_no = NA_SE_HANABI2;
break;
case eHanabiDummy_TYPE5:
sfx_no = NA_SE_HANABI3;
break;
default:
sfx_no = NA_SE_HANABI0;
break;
}
sAdo_OngenTrgStart(sfx_no, &pos);
}
}
static void eHanabiDummy_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
// empty
}