Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*.user
*.userosscache
*.sln.docstates
*.sh

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
10 changes: 3 additions & 7 deletions spm-rel-loader/rel/Makefile → Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif

ifeq ($(strip $(TTYDTOOLS)),)
$(error "Please set TTYDTOOLS in your environment. export TTYDTOOLS=<path to>ttyd-tools")
endif

include $(DEVKITPPC)/wii_rules

export ELF2REL := $(TTYDTOOLS)/bin/elf2rel
export ELF2REL := pyelf2rel

ifeq ($(VERSION),)
all: us0 us1 us2 jp0 jp1 eu0 eu1 kr0
Expand Down Expand Up @@ -55,7 +51,7 @@ else
#---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR)).$(VERSION)
BUILD := build.$(VERSION)
SOURCES := source $(wildcard source/*)
SOURCES := source $(wildcard source/*) vendor/EASTL/source $(wildcard vendor/EASTL/source/*)
DATA := data
INCLUDES := include spm-headers/include spm-headers/mod vendor/EABase/include/Common vendor/EABase/include/Common vendor/EASTL/include

Expand Down Expand Up @@ -200,7 +196,7 @@ $(OFILES_SOURCES) : $(HFILES)
# REL linking
%.rel: %.elf
@echo output ... $(notdir $@)
@$(ELF2REL) $< -s $(MAPFILE)
@$(ELF2REL) $< $(MAPFILE)

#---------------------------------------------------------------------------------
# This rule links in binary data with the .jpg extension
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
68 changes: 68 additions & 0 deletions include/consolewindow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
ConsoleWindow
Window that displays an on-screen console
*/

#pragma once

#include <common.h>
#include <msl/stdio.h>
#include <wii/gx.h>

#include "mod_ui_base/window.h"

namespace mod {

typedef void (ConsoleFreeCallback)(const char * line);

class ConsoleWindow final : public Window
{
protected:
struct ConsoleLine
{
const char * line;
wii::gx::GXColor colour;
u32 lifetime;
ConsoleLine * next;
ConsoleFreeCallback * freeCallback;
};
ConsoleLine * mLines;

static ConsoleWindow * sInstance;

virtual void disp() override;
void _push(const char * text, const wii::gx::GXColor * colour, ConsoleFreeCallback * cb);
ConsoleWindow();

public:
// Window::mPosX/Y are used for bottom left corner of window
f32 mScale;
u32 mFadeThreshhold;
u32 mLineLifetime;

#define CONSOLE_PUSH_FMT(format, ...) \
do \
{ \
size_t _fmt_size = msl::stdio::snprintf(nullptr, 0, format, __VA_ARGS__); \
char * _fmt_str = new char[_fmt_size + 1]; \
msl::stdio::sprintf(_fmt_str, format, __VA_ARGS__); \
mod::ConsoleWindow::push(_fmt_str, nullptr, mod::ConsoleWindow::autoFreeCb); \
} while (0)

#define CONSOLE_PUSH_FMT_CLR(colour, format, ...) \
do \
{ \
size_t _fmt_size = msl::stdio::snprintf(nullptr, 0, format, __VA_ARGS__); \
char * _fmt_str = new char[_fmt_size + 1]; \
msl::stdio::sprintf(_fmt_str, format, __VA_ARGS__); \
mod::ConsoleWindow::push(_fmt_str, colour, mod::ConsoleWindow::autoFreeCb); \
} while (0)

static void push(const char * text, const wii::gx::GXColor * colour = nullptr, ConsoleFreeCallback * cb = nullptr);
static void pushClone(const char * text, const wii::gx::GXColor * colour = nullptr);

static void autoFreeCb(const char * line);
static void init();
};

}
File renamed without changes.
66 changes: 66 additions & 0 deletions include/cutscene_helpers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#pragma once
#include <spm/evt_npc.h>

namespace mod::cutscene_helpers
{

#define SET_CHAR_ANIMS(instanceName, tribeAnimDef) \
USER_FUNC(spm::evt_npc::evt_npc_set_property, PTR(instanceName), spm::npcdrv::NPCProperty::ANIMS, PTR(tribeAnimDef))

#define SPAWN_CHARACTER(instanceName, modelName, initialAnimations) \
USER_FUNC(spm::evt_npc::evt_npc_entry, PTR(instanceName), PTR(modelName), 0) \
SET_CHAR_ANIMS(instanceName, initialAnimations)

#define NPC_SET_ANIM_WAIT(npcName, animId) \
USER_FUNC(spm::evt_npc::evt_npc_set_anim, PTR(npcName), animId, 1) \
USER_FUNC(spm::evt_npc::evt_wait_anim_end, PTR(npcName), 1)

#define NPC_SET_ANIMDEF_AND_ANIM(npcName, animDef, animId) \
USER_FUNC(spm::evt_npc::evt_npc_set_property, PTR(npcName), NPC_PROPERTY_ANIM_DEF, PTR(animDef)) \
USER_FUNC(spm::evt_npc::evt_npc_set_anim, PTR(npcName), animId, 1)

#define NPC_SET_ANIMDEF_AND_ANIM_WAIT(npcName, animDef, animId) \
NPC_SET_ANIMDEF_AND_ANIM(npcName, animDef, animId) \
USER_FUNC(spm::evt_npc::evt_wait_anim_end, PTR(npcName), 1)

#define NPC_SET_ANIMDEF_AND_ANIM_LOOP(npcName, animDef, animInId, animLoopId) \
NPC_SET_ANIMDEF_AND_ANIM_WAIT(npcName, animDef, animInId) \
USER_FUNC(spm::evt_npc::evt_npc_set_anim, PTR(npcName), animLoopId, 1)

#define NPC_FACEDIR_LEFT -1
#define NPC_FACEDIR_RIGHT 1
#define NPC_FACE_DIR(npcName, moveDir) \
USER_FUNC(spm::evt_npc::evt_npc_set_axis_movement_unit, PTR(npcName), moveDir) \
USER_FUNC(spm::evt_npc::evt_npc_wait_axis_movement_unit_end, PTR(npcName))


#define REACTION_EXCLAMATION 0
#define REACTION_QUESTION 1

#define MARIO_SPAWN_EXCLAMATION_MARK() \
USER_FUNC(spm::evt_eff::evt_eff_exclamation_question, 0, 0, 0, REACTION_EXCLAMATION, 0, 0, 0, 0, 0, 0, 0)
#define MARIO_SPAWN_QUESTION_MARK() \
USER_FUNC(spm::evt_eff::evt_eff_exclamation_question, 0, 0, 0, REACTION_QUESTION, 0, 0, 0, 0, 0, 0, 0)

#define NPC_SPAWN_EXCLAMATION_OR_QUESTION_MARK(npcName, exclamationOrQuestion, sfxName) \
USER_FUNC(spm::evt_npc::evt_npc_get_position, PTR(npcName), LW(0), LW(1), LW(2)) \
ADD(LW(1), 80) \
ADD(LW(2), 10) \
USER_FUNC(spm::evt_eff::evt_eff_exclamation_question, 2, 0, 0, exclamationOrQuestion, 0, LW(0), LW(1), LW(2), 0, 0, 0) \
USER_FUNC(spm::evt_snd::evt_snd_sfxon_npc, PTR(sfxName), PTR(npcName))

#define NPC_SPAWN_EXCLAMATION_MARK(npcName) \
NPC_SPAWN_EXCLAMATION_OR_QUESTION_MARK(npcName, REACTION_EXCLAMATION, "SFX_SYS_BIKKURI1")
#define NPC_SPAWN_QUESTION_MARK(npcName) \
NPC_SPAWN_EXCLAMATION_OR_QUESTION_MARK(npcName, REACTION_QUESTION, "SFX_SYS_HATENA1")

#define WAIT_FOR_EVT(lwId, lwRes) \
DO(0) \
CHK_EVT(lwId, lwRes) \
IF_EQUAL(LW(1), 0) \
DO_BREAK() \
END_IF() \
WAIT_FRM(1) \
WHILE()

}
File renamed without changes.
14 changes: 14 additions & 0 deletions include/exception.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
Exception
Patches to display exception information on screen
*/

#pragma once

#include <common.h>

namespace mod {

void exceptionPatch();

}
File renamed without changes.
11 changes: 11 additions & 0 deletions include/mod.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once
#include "evt_cmd.h"
namespace mod {

#define MOD_VERSION "SPM-Multi"

extern bool gIsDolphin;

void main();

}
29 changes: 29 additions & 0 deletions include/mod_ui_base/bgwindow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
BgWindow
Abstract window class that draws a background box
*/

#pragma once

#include <common.h>
#include <wii/gx.h>

#include "window.h"

namespace mod {

class BgWindow : public Window
{
protected:
virtual void disp() override;

public:
// Window::mPosX/Y are used for top left corner of window
f32 mHeight, mWidth;
f32 mCurve;
wii::gx::GXColor mColour; // note: if RGB are all the same, game forces it max white

BgWindow();
};

}
18 changes: 18 additions & 0 deletions include/mod_ui_base/colours.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
Colour
Common colours used in graphics code
*/

#include <common.h>
#include <wii/gx.h>

namespace colours {

extern const wii::gx::GXColor white; // ffffffff
extern const wii::gx::GXColor black; // 000000ff
extern const wii::gx::GXColor red; // ff0000ff
extern const wii::gx::GXColor green; // 00ff00ff
extern const wii::gx::GXColor yellow; // ffff00ff
extern const wii::gx::GXColor grey; // 7f7f7fff

}
58 changes: 58 additions & 0 deletions include/mod_ui_base/menubutton.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
MenuButton
Interactable text element of a window
*/

#pragma once

#include <common.h>

#include "menuwindow.h"

namespace mod {

enum
{
MENUDIR_UP = 0,
MENUDIR_DOWN,
MENUDIR_LEFT,
MENUDIR_RIGHT
};

// Return true if button still exists, false if it was deleted
typedef bool (MenuAction)(class MenuButton * button, void * param);

class MenuButton
{
protected:
friend class MenuWindow;
class MenuWindow * mWindow;
MenuButton * mNext;
MenuButton * mNeighbours[4];

virtual void handleInputs(u32 btn, u32 btnRpt);
virtual void handlePassiveInputs(u32 btn, u32 btnRpt);
virtual void disp(f32 centreX, f32 centreY, bool selected);

public:
const char * mMsg;
f32 mPosX, mPosY;
f32 mScale;
wii::gx::GXColor mColour;
wii::gx::GXColor mSelColour;
MenuAction * mAction;
void * mActionParam;
bool mAutoPress;
bool mDrawAsMessage;
MenuAction * mOnSelectAction;
void * mOnSelectActionParam;

MenuButton(class MenuWindow * parent, const char * msg, f32 x, f32 y,
MenuAction * action = nullptr, void * actionParam = nullptr,
bool autoPress = false, f32 scale = 1.0f,
const wii::gx::GXColor * colour = nullptr, const wii::gx::GXColor * selColour = nullptr,
bool drawAsMessage = false, MenuAction * onSelectAction = nullptr, void * onSelectActionParam = nullptr);
virtual ~MenuButton();
};

}
42 changes: 42 additions & 0 deletions include/mod_ui_base/menuwindow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
MenuWindow
Abstract menu window
*/

#pragma once

#include <common.h>

#include "bgwindow.h"
#include "menubutton.h"

namespace mod {

class MenuWindow : public BgWindow
{
protected:
friend class MenuButton;
const char * mTitle;
class MenuButton * mButtons;
class MenuButton * mCurButton;

virtual void close();
virtual void disp() override;
f32 getCentreAlignX(const char * msg, f32 scale);

static void buttonLinkVertical(class MenuButton * top, class MenuButton * bottom);
static void buttonLinkHorizontal(class MenuButton * left, class MenuButton * right);

public:
// Window::mPosX/Y are used for top left corner of window

static MenuWindow * sCurMenu;
virtual void fullClose();

MenuWindow();
~MenuWindow();
void drawStringCentre(const char * str, f32 y, const wii::gx::GXColor * colour = nullptr, f32 scale = 1.0f,
bool edge = false, bool noise = false, bool rainbow = false);
};

}
Loading