mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
aee5626e5b
* monty mole AI pt 1 * monty mole AI #2 * enum values for evt priority and flags * enemy ai flags * done monty mole + partner enums * removed union for partner action state * missed parter action states + cam move flags + entity collision bit * basic ai * piranha plant stuff * attack ahead * consistent hitbox names * idk * organized piranha plant * delete matches * start fuzzy * naming * bzzap pt 1 * bzzap 2 * bzzap names done * rename bzzap to flyingAI * complete flying names * done for today * file reorganizing * world AI * starting clubba dedupe * suggested changes * bullet bills * sentinel start * dedupe sentinel complete * sentinel AI done * melee ai organization * piranha plant dedupe * resolved some bad dead syms * patrol start * patrol AI almost done * enough * more ai work * clean up clubba ai enum * dedupe all clubbae * started cleft extraction * ready to dedupe cleft * dedupe one cleft * iwa_04 * iwa_01 * iwa_02 * ai state file reorganization * enemy anim enum * extracted shy guy * dedupe shy guy ai * shy guy patrol ai * done shy guy ai dedupe * added NON_MATCHING wrap * ai etc * more dead ai * most dead ai merged with living * lakitu etc * paratroopas * fix warnings * fix other warning * ParatroopaAI * lakituAI parameter fix * dead_flo_13 debug strings * misc map matches * flying magikoopa start * name npc field * lungeAI renamed to tackleAI * magikoopa ai foothold * extrated one magikoopa * starting clubba dedupe * addressed PR comments * consolidated magikoopa helper funcs * misc map stuff * flying magikoopa dedupe * zipline funcs * delete matched * grind out another 0.05% * started letter delivery dedupe * more delivery dedupe * special delivery * rest of letter delivery * slight delivery reorg * delivery func names * cleft doc start * name enemy field * more renamins * unk_28.f * changed field names to facilitate renaming * done cleft cleanup * hopping ai * cleanup some ai * name field + patrol reorg * filled out NpcAISettings fields * assembling ai includes * elimated state files * remove X32 for alertOffsetDist * removed other NpcAISettings union * new NpcAISettings for UnkAI_4 * stationary AI cleanup * smalls * 0 new warnings Co-authored-by: HailSanta <Hail2Santa@gmail.com> Co-authored-by: Ethan Roseman <ethteck@gmail.com>
129 lines
3.5 KiB
C
129 lines
3.5 KiB
C
#ifndef _MACROS_H_
|
|
#define _MACROS_H_
|
|
|
|
#include "types.h"
|
|
#include "include_asm.h"
|
|
|
|
#ifndef M2CTX
|
|
#define BSS __attribute__ ((section (".bss")))
|
|
#define TRANSPARENT_UNION __attribute__ ((__transparent_union__))
|
|
#else
|
|
#define BSS static
|
|
#define TRANSPARENT_UNION
|
|
#endif
|
|
|
|
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
|
|
|
|
#define A(sym) NS(AREA, sym)
|
|
#define N(sym) NS(NAMESPACE, sym)
|
|
|
|
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
|
|
|
|
#define PHYSICAL_TO_VIRTUAL(addr) (void*)((u32)(addr) + 0x80000000)
|
|
#define VIRTUAL_TO_PHYSICAL(addr) (u32)((u8*)(addr) - 0x80000000)
|
|
|
|
#ifdef DEBUG
|
|
#define ASSERT(condition) \
|
|
if (!(condition)) { \
|
|
func_80025F44("Assertion failed: " #condition, __FILE__, __LINE__); \
|
|
while (TRUE) {} \
|
|
}
|
|
#define PANIC() \
|
|
func_80025F44("Panic!", __FILE__, __LINE__); \
|
|
while (TRUE) {}
|
|
#else
|
|
#define ASSERT(condition) if (!(condition)) { while (TRUE) {} }
|
|
#define PANIC() while (TRUE) {}
|
|
#endif
|
|
|
|
#define BADGE_MENU_PAGE(index) (&gPauseBadgesPages[index])
|
|
#define ITEM_MENU_PAGE(index) (&gPauseItemsPages[index])
|
|
|
|
#define MENU_PANEL_SELECTED_GRID_DATA(panel) \
|
|
(panel)->gridData[(panel)->page * (panel)->numCols * (panel)->numRows + \
|
|
(panel)->numCols * (panel)->row + \
|
|
(panel)->col]
|
|
|
|
#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
|
|
|
|
#define SCREEN_WIDTH 320
|
|
#define SCREEN_HEIGHT 240
|
|
|
|
// 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 BATTLE_ENTITY_ID_MASK 0x800
|
|
|
|
#define COLLISION_WITH_NPC_BIT 0x2000
|
|
#define COLLISION_WITH_ENTITY_BIT 0x4000
|
|
#define COLLISION_IGNORE_ENTITIES 0x40000
|
|
#define COLLISION_ONLY_ENTITIES 0x100000
|
|
|
|
#define PACK_FILL_COLOR(r, g, b, a) (GPACK_RGBA5551(r, g, b, a) << 0x10) | GPACK_RGBA5551(r, g, b, a)
|
|
|
|
#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)
|
|
|
|
/// X.10 fixed-point literal
|
|
#define X10(f) (s32)(f * 1024.0f)
|
|
|
|
#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)))
|
|
|
|
#define SPRITE_PIXEL_SCALE (5.0 / 7.0)
|
|
|
|
/* common AI function and script variables */
|
|
// ai script
|
|
#define AI_TEMP_STATE functionTemp[0]
|
|
#define AI_TEMP_STATE_AFTER_SUSPEND functionTemp[1]
|
|
#define AI_PATROL_GOAL_INDEX functionTemp[2]
|
|
// melee enemy
|
|
#define AI_VAR_ATTACK_STATE varTable[0]
|
|
#define AI_VAR_MELEE_PRE_TIME varTable[1]
|
|
#define AI_VAR_MELEE_HIT_TIME varTable[2]
|
|
#define AI_VAR_MELEE_MISS_TIME varTable[3]
|
|
#define AI_VAR_NEXT_STATE varTable[7]
|
|
// melee hitbox
|
|
#define AI_VAR_HITNPC_YOFFSET varTable[0]
|
|
#define AI_VAR_HITNPC_DIST varTable[1]
|
|
#define AI_VAR_HITNPC_2 varTable[2]
|
|
#define AI_VAR_HITNPC_3 varTable[3]
|
|
#define AI_VAR_HITNPC_4 varTable[4]
|
|
#define AI_VAR_HITNPC_SOUND varTable[15]
|
|
// projectile hitbox
|
|
#define VAR_PROJECTILE_HITBOX_STATE varTable[0]
|
|
#define AI_PROJECTILE_AMMO_COUNT varTable[3]
|
|
|
|
#ifdef PERMUTER
|
|
#undef SCRIPT
|
|
#define SCRIPT(...) {}
|
|
#endif
|
|
|
|
#endif
|