mirror of
https://github.com/pmret/papermario.git
synced 2024-11-09 20:42:41 +01:00
7cb1790789
* generate c includes for img segments * flatten battle/item/dusty_hammer.c needs custom splat * use .inc.c for c incbins * fixy * new stuff * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "6120d18600" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "6120d18600" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * remove dumb * git subrepo pull tools/splat subrepo: subdir: "tools/splat" merged: "8a179e74ba" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "8a179e74ba" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * yaml cleaning * Further yaml cleanup & battle item refactor * remove rawptr * git subrepo pull tools/splat subrepo: subdir: "tools/splat" merged: "fe30b60b75" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "fe30b60b75" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * further cleanup * Further cleanup & match gfx_draw_background * clean & wip Co-authored-by: Alex Bates <hi@imalex.xyz>
83 lines
2.3 KiB
C
83 lines
2.3 KiB
C
#ifndef _MACROS_H_
|
|
#define _MACROS_H_
|
|
|
|
#include "common.h"
|
|
#include "include_asm.h"
|
|
|
|
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
|
|
|
|
#define N(sym) NS(NAMESPACE, sym)
|
|
|
|
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
|
|
#define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0]))
|
|
|
|
#define PHYSICAL_TO_VIRTUAL(addr) (void*)((u32)(addr) + 0x80000000)
|
|
#define VIRTUAL_TO_PHYSICAL(addr) (u32)((u8*)(addr) - 0x80000000)
|
|
|
|
#define ASSERT(condition) if (!(condition)) { while (1) {} }
|
|
#define PANIC() ASSERT(0)
|
|
#define STATIC_ASSERT(condition) enum { static_assert_fail = 1/(!!(condition)) } // Causes division by zero ("not integer constant") if false
|
|
|
|
#define CAM(id) (&gCameras[id])
|
|
|
|
#define BADGE_MENU_PAGE(index) (&gBadgeMenuPages[index])
|
|
#define ITEM_MENU_PAGE(index) (&gItemMenuPages[index])
|
|
|
|
#define MAX_MAPVARS 16
|
|
#define MAX_MAPFLAGS 3
|
|
|
|
#define MAX_ANIMATED_MODELS 16
|
|
#define MAX_ANIMATED_MESHES 16
|
|
#define MAX_ENTITY_MODELS 256
|
|
#define MAX_MODELS 256
|
|
#define MAX_MODEL_TRANSFORM_GROUPS 4
|
|
#define MAX_SCRIPTS 128
|
|
#define MAX_NPCS 64
|
|
#define MAX_TRIGGERS 64
|
|
#define MAX_SHADOWS 60
|
|
#define MAX_ENTITIES 30
|
|
#define MAX_DYNAMIC_ENTITIES 16
|
|
#define MAX_TEX_PANNERS 16
|
|
#define MAX_ITEM_ENTITIES 256
|
|
|
|
// Alternative to libultra's M_PI: non-float version; more digits cause issues
|
|
#define PI 3.141592f
|
|
#define PI_D 3.141592
|
|
#define TAU 6.28318f
|
|
#define PI_S 3.14159f // Shorter PI
|
|
|
|
#define SPRITE_WORLD_SCALE 0.71428573f
|
|
|
|
#define PACK_FILL_COLOR(r, g, b, a) (GPACK_RGBA5551(r, g, b, a) << 0x10) | GPACK_RGBA5551(r, g, b, a)
|
|
|
|
//NOTE: SCRIPT_ALLOC is probably not quite correct, but this is the closest thing to matching for the functions its used in. Needs more work.
|
|
#define SCRIPT_ALLOC(new, index) \
|
|
{ \
|
|
(*gCurrentScriptListPtr)[index] = new = heap_malloc(sizeof(ScriptInstance)); \
|
|
gNumScripts++; \
|
|
ASSERT(new != NULL); \
|
|
}
|
|
|
|
#define SCRIPT_FREE(index) \
|
|
{ \
|
|
ScriptList** temp = &gCurrentScriptListPtr; \
|
|
s32 *numScripts = &gNumScripts; \
|
|
heap_free((**temp)[index]); \
|
|
(**temp)[index] = NULL; \
|
|
(*numScripts)--; \
|
|
}
|
|
|
|
#define SQ(x) (x*x)
|
|
#define CUBE(x) (x*x*x)
|
|
#define QUART(x) (x*x*x*x)
|
|
|
|
// Fixed-point short literal
|
|
#define F16(f) (s16)(f * 327.67f)
|
|
|
|
#define _NS(x, y) x ## _ ## y
|
|
#define NS(x, y) _NS(x, y)
|
|
|
|
#define ASCII_TO_U32(a, b, c, d) ((u32)((a << 24) | (b << 16) | (c << 8) | (d << 0)))
|
|
|
|
#endif
|