diff options
Diffstat (limited to '')
-rw-r--r-- | SummerSun.yaml | 6 | ||||
-rw-r--r-- | kamek_pal.x | 2 | ||||
-rwxr-xr-x | makeSummerSun | 37 | ||||
-rw-r--r-- | src/bossCaptainBowser.cpp | 14 | ||||
-rw-r--r-- | src/summermodel.cpp | 286 | ||||
-rw-r--r-- | summerhax.yaml | 16 |
6 files changed, 353 insertions, 8 deletions
diff --git a/SummerSun.yaml b/SummerSun.yaml new file mode 100644 index 0000000..078243c --- /dev/null +++ b/SummerSun.yaml @@ -0,0 +1,6 @@ +output_dir: "NewerASM" +code_address: 0x808D9000 +modules: + - processed/prolog.yaml + - processed/summerhax.yaml + - processed/bugfixes.yaml diff --git a/kamek_pal.x b/kamek_pal.x index cea244a..d2fd02f 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -84,7 +84,7 @@ SECTIONS { instance__11dStage32C_c = 0x8042A1F0; instance__7WLClass = 0x80429F74; - ShakeScreen = 0x800D8A50; + ShakeScreen = 0x800D8D50; StageScreen = 0x8042A2E8; createChild__13dStageActor_cF6ActorsP13dStageActor_cUiP7Point3dP6S16VecUc = 0x80064680; diff --git a/makeSummerSun b/makeSummerSun new file mode 100755 index 0000000..a8b665b --- /dev/null +++ b/makeSummerSun @@ -0,0 +1,37 @@ +#!/bin/sh +rm -r ~/.wine + +rm ~/Dropbox/NEWERsmbw/Summer\ Sun/SystemEU_1.bin +rm ~/Dropbox/NEWERsmbw/Summer\ Sun/DLCodeEU_1.bin +rm ~/Dropbox/NEWERsmbw/Summer\ Sun/DLRelocsEU_1.bin + +rm ~/Dropbox/NEWERsmbw/Summer\ Sun/SystemUS_1.bin +rm ~/Dropbox/NEWERsmbw/Summer\ Sun/DLCodeUS_1.bin +rm ~/Dropbox/NEWERsmbw/Summer\ Sun/DLRelocsUS_1.bin + +rm ~/Dropbox/NEWERsmbw/Summer\ Sun/SystemUS_2.bin +rm ~/Dropbox/NEWERsmbw/Summer\ Sun/DLCodeUS_2.bin +rm ~/Dropbox/NEWERsmbw/Summer\ Sun/DLRelocsUS_2.bin + +python tools/mapfile_tool.py +python tools/kamek.py SummerSun.yaml --no-rels --use-mw --use-wine --gcc-type=/usr/local/devkitPRO/devkitPPC/bin/powerpc-eabi --mw-path=tools +if [ "$?" = "0" ]; then + echo "compile successful" +else + exit 1 +fi + +mv NewerASM/pal_loader.bin ~/Dropbox/NEWERsmbw/Summer\ Sun/SystemEU_1.bin +mv NewerASM/pal_dlcode.bin ~/Dropbox/NEWERsmbw/Summer\ Sun/DLCodeEU_1.bin +mv NewerASM/pal_dlrelocs.bin ~/Dropbox/NEWERsmbw/Summer\ Sun/DLRelocsEU_1.bin + +mv NewerASM/ntsc_loader.bin ~/Dropbox/NEWERsmbw/Summer\ Sun/SystemUS_1.bin +mv NewerASM/ntsc_dlcode.bin ~/Dropbox/NEWERsmbw/Summer\ Sun/DLCodeUS_1.bin +mv NewerASM/ntsc_dlrelocs.bin ~/Dropbox/NEWERsmbw/Summer\ Sun/DLRelocsUS_1.bin + +mv NewerASM/ntsc2_loader.bin ~/Dropbox/NEWERsmbw/Summer\ Sun/SystemUS_2.bin +mv NewerASM/ntsc2_dlcode.bin ~/Dropbox/NEWERsmbw/Summer\ Sun/DLCodeUS_2.bin +mv NewerASM/ntsc2_dlrelocs.bin ~/Dropbox/NEWERsmbw/Summer\ Sun/DLRelocsUS_2.bin + +echo Built all! + diff --git a/src/bossCaptainBowser.cpp b/src/bossCaptainBowser.cpp index c894ecd..a8602c2 100644 --- a/src/bossCaptainBowser.cpp +++ b/src/bossCaptainBowser.cpp @@ -7,7 +7,7 @@ extern "C" void *BowserExitDemoState(void *, unsigned int); extern "C" void *ForceMarioExitDemoMode(void *, unsigned int); -extern "C" void *ShakeScreen(void *, unsigned int, unsigned int, unsigned int); +extern "C" void *ShakeScreen(void *, unsigned int, unsigned int, unsigned int, unsigned int); extern "C" void *StageScreen; @@ -419,16 +419,15 @@ int daCaptainBowser::onDraw() { this->chrAnimation.setCurrentFrame(0.0); } // Screen Rumble - // if ((this->timer > 180) && (this->timer < 420)) { - if (this->timer == 180) { + if ((this->timer > 180) && (this->timer < 420)) { + // if (this->timer == 180) { // Do Rumbly - 807CD3AC pos.x = ClassWithCameraInfo::instance->screenCentreX; pos.y = ClassWithCameraInfo::instance->screenCentreY; - ShakeScreen(StageScreen, 5, 1, 0); - OSReport("Shit Happens"); - PlaySound(this, SE_BOSS_KOOPA_RUMBLE1); // 0x5D4 + ShakeScreen(StageScreen, 2, 1, 0, 0); + PlaySoundAsync(this, SE_BOSS_KOOPA_RUMBLE1); // 0x5D4 // Stage80::instance->ShakeScreen(self, 5, 1, 0); } @@ -451,7 +450,8 @@ int daCaptainBowser::onDraw() { } if (this->chrAnimation.getCurrentFrame() > 53.0) { - effect.spawn("Wm_ko_shout", 0, &(Vec){pos.x-186.0, pos.y+144.0, pos.z}, &(S16Vec){0,0,0x7000}, &(Vec){1.0, 1.0, 1.0}); + ShakeScreen(StageScreen, 2, 2, 0, 0); + effect.spawn("Wm_ko_shout", 0, &(Vec){pos.x-182.0, pos.y+132.0, pos.z}, &(S16Vec){0,0,0x7000}, &(Vec){1.0, 1.0, 1.0}); } } diff --git a/src/summermodel.cpp b/src/summermodel.cpp new file mode 100644 index 0000000..ddbc2e5 --- /dev/null +++ b/src/summermodel.cpp @@ -0,0 +1,286 @@ +#include <common.h> +#include <game.h> +#include <g3dhax.h> + + +////////////////////////////////////////////////////////// +// +// How it works: +// +// 1) Skip down to line 70 - read the comments along the way if you like +// 2) Change the stuff inside " " to be what you want. +// 3) Copy paste an entire 'case' section of code, and change the number to change the setting it uses +// 4) give it back to Tempus to compile in +// + + + +// This is the class allocator, you don't need to touch this +class dMakeYourOwn : public dStageActor_c { + // Let's give ourselves a few functions + int onCreate(); + int onDelete(); + int onExecute(); + int onDraw(); + + static dMakeYourOwn *build(); + + // And a model and an anmChr + mHeapAllocator_c allocator; + m3d::mdl_c bodyModel; + nw4r::g3d::ResFile resFile; + m3d::anmChr_c chrAnimation; + + nw4r::g3d::ResMdl mdl; + + // Some variables to use + int model; + bool isAnimating; + float size; + + void setupAnim(const char* name, float rate); + void setupModel(const char* arcName, const char* brresName, const char* mdlName); +}; + +// This sets up how much space we have in memory +dMakeYourOwn *dMakeYourOwn::build() { + void *buffer = AllocFromGameHeap1(sizeof(dMakeYourOwn)); + return new(buffer) dMakeYourOwn; +} + + +// Saves space when we do it like this +void dMakeYourOwn::setupAnim(const char* name, float rate) { + if (isAnimating) { + nw4r::g3d::ResAnmChr anmChr; + + anmChr = this->resFile.GetResAnmChr(name); + this->chrAnimation.setup(this->mdl, anmChr, &this->allocator, 0); + this->chrAnimation.bind(&this->bodyModel, anmChr, 1); + this->bodyModel.bindAnim(&this->chrAnimation, 0.0); + this->chrAnimation.setUpdateRate(rate); + } +} + +void dMakeYourOwn::setupModel(const char* arcName, const char* brresName, const char* mdlName) { + this->resFile.data = getResource(arcName, brresName); + this->mdl = this->resFile.GetResMdl(mdlName); + + bodyModel.setup(mdl, &allocator, 0x224, 1, 0); +} + + +// This gets run when the sprite spawns! +int dMakeYourOwn::onCreate() { + + // Settings for your sprite! + + this->model = this->settings & 0xFF; // Sets nubble 12 to choose the model you want + this->isAnimating = this->settings & 0x100; // Sets nybble 11 to a checkbox for whether or not the model has an anmChr to use + this->size = (float)((this->settings >> 24) & 0xFF) / 4.0; // Sets nybbles 5-6 to size. Size equals value / 4. + + // Setup the models inside an allocator + allocator.link(-1, GameHeaps[0], 0, 0x20); + + + // Makes the code shorter and clearer to put these up here + + // A switch case, add extra models in here + switch (this->model) { + + // COPY FROM BELOW HERE + + case 0: // If nyb 12 is 0, it'll load this model + + setupModel("morton", "g3d/model0.brres", "model0"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = -3300.0; + + setupAnim("anim00", 1.0); // AnmChr name, animation speed + + break; // ends the case + + // TO HERE + // That is a 'block' of case code, which will run depending on your sprite setting + + case 1: // If nyb 12 is 1, it'll load this model. Add more cases for each model you'd like! + + setupModel("morton", "g3d/model0.brres", "model0"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim01", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 2: // If nyb 12 is 1, it'll load this model. Add more cases for each model you'd like! + + setupModel("morton", "g3d/model0.brres", "model0"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim02", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 3: // If nyb 12 is 1, it'll load this model. Add more cases for each model you'd like! + + setupModel("morton", "g3d/model0.brres", "model0"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim03", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 4: // If nyb 12 is 1, it'll load this model. Add more cases for each model you'd like! + + setupModel("morton", "g3d/model0.brres", "model0"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim04", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 5: // If nyb 12 is 1, it'll load this model. Add more cases for each model you'd like! + + setupModel("morton", "g3d/model0.brres", "model0"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim05", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 6: // If nyb 12 is 1, it'll load this model. Add more cases for each model you'd like! + + setupModel("morton", "g3d/model0.brres", "model0"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim06", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 7: // If nyb 12 is 1, it'll load this model. Add more cases for each model you'd like! + + setupModel("morton", "g3d/model0.brres", "model0"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim07", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 8: // If nyb 12 is 1, it'll load this model. Add more cases for each model you'd like! + + setupModel("morton", "g3d/model0.brres", "model0"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim08", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 9: // If nyb 12 is 1, it'll load this model. Add more cases for each model you'd like! + + setupModel("morton", "g3d/model0.brres", "model0"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim09", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 10: // If nyb 12 is 1, it'll load this model. Add more cases for each model you'd like! + + setupModel("morton", "g3d/model0.brres", "model0"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim10", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 11: // If nyb 12 is 1, it'll load this model. Add more cases for each model you'd like! + + setupModel("morton", "g3d/model0.brres", "model0"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim11", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 12: // If nyb 12 is 1, it'll load this model. Add more cases for each model you'd like! + + setupModel("morton", "g3d/model0.brres", "model0"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim12", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 13: // If nyb 12 is 1, it'll load this model. Add more cases for each model you'd like! + + setupModel("morton", "g3d/model0.brres", "model0"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim13", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 14: // If nyb 12 is 1, it'll load this model. Add more cases for each model you'd like! + + setupModel("morton", "g3d/model0.brres", "model0"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim14", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 15: // If nyb 12 is 1, it'll load this model. Add more cases for each model you'd like! + + setupModel("morton", "g3d/model0.brres", "model0"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim15", 1.0); // AnmChr name, animation speed + break; // ends the case + + } + + allocator.unlink(); + + if (size == 0.0) { // If the person has the size nybble at zero, make it normal sized + this->scale = (Vec){1.0,1.0,1.0}; + } + else { // Else, use our size + this->scale = (Vec){size,size,size}; + } + + this->onExecute(); + return true; +} + + +// YOU'RE DONE, no need to do anything below here. + + +int dMakeYourOwn::onDelete() { + return true; +} + +int dMakeYourOwn::onExecute() { + if (isAnimating) { + bodyModel._vf1C(); // Advances the animation one update + + if(this->chrAnimation.isAnimationDone()) { + this->chrAnimation.setCurrentFrame(0.0); // Resets the animation when it's done + } + } + + return true; +} + +int dMakeYourOwn::onDraw() { + matrix.translation(pos.x, pos.y, pos.z - 6500.0); // Set where to draw the model : -5500.0 is the official behind layer 2, while 5500.0 is in front of layer 0. + matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); // Set how to rotate the drawn model + + bodyModel.setDrawMatrix(matrix); // Apply matrix + bodyModel.setScale(&scale); // Apply scale + bodyModel.calcWorld(false); // Do some shit + + bodyModel.scheduleForDrawing(); // Add it to the draw list for the game + return true; +} diff --git a/summerhax.yaml b/summerhax.yaml new file mode 100644 index 0000000..b943cb4 --- /dev/null +++ b/summerhax.yaml @@ -0,0 +1,16 @@ +source_files: [../src/summermodel.cpp] +hooks: +- {name: RemoveTitleReplay, addr_pal: 0x80781FBC, type: patch, data: '60000000 60000000 60000000'} +- {name: RemoveToadHouseMsg1, addr_pal: 0x808FB974, type: patch, data: '60000000'} +- {name: RemoveToadHouseMsg2, addr_pal: 0x808FB968, type: patch, data: '60000000'} +- {name: UpdateChompModelInfo, addr_pal: 0x8030B998, type: patch, data: '0200BC0000000000100000001000000000000000000000080000000800000000000000000000080000'} + +- name: BuildYourOwnModel + type: add_func_pointer + src_addr_pal: 0x80988574 + target_func: 'dMakeYourOwn::build(void)' + +- name: UpdateModelSpriteInfo + type: patch + addr_pal: 0x8030A4F8 + data: '029E 0000 00000000 00000000 FFFFFC00 FFFFFC00 00000400 00000400 0400 0400 0000 0000 0008 0000' |