mirror of
https://github.com/zeldaret/af.git
synced 2026-09-26 13:33:16 -04:00
fd05811213
* C file * trademark_init * trademark_cancel, trademark_move, trademark_main * trademark_draw * trademark_goto_demo_scene and func_80805360_jp * set_npc_4_title_demo * func_80804C40_jp * trademark_cleanup * func_808052B8_jp * func_80805104_jp * func_80804F78_jp * func_80804EE0_jp * fix warnings * small cleanup * fix build * some fixes * stuff * some cleanups * Fix rebase * Import data * Migrate bss * cleanup * Save substruct * format * TrademarkState and some other stuff * remove fake match * stuff I missed * whoops * Stupid `-Wtype-limits` * Update src/overlays/gamestates/ovl_trademark/m_trademark.c Co-authored-by: Prakxo <87568477+Prakxo@users.noreply.github.com> * Review * Update src/overlays/gamestates/ovl_trademark/m_trademark.c Co-authored-by: emilybrooks <emilybrooksemilybrooks@gmail.com> * Update src/overlays/gamestates/ovl_trademark/m_trademark.c Co-authored-by: Prakxo <87568477+Prakxo@users.noreply.github.com> * clang-tidy changes??? * review --------- Co-authored-by: Prakxo <87568477+Prakxo@users.noreply.github.com> Co-authored-by: emilybrooks <emilybrooksemilybrooks@gmail.com>
36 lines
1.1 KiB
C
36 lines
1.1 KiB
C
#ifndef MACROS_H
|
|
#define MACROS_H
|
|
|
|
#include "ultra64.h"
|
|
#include "code_variables.h"
|
|
|
|
#if defined(__GNUC__) || defined(__clang__)
|
|
#define UNREACHABLE __builtin_unreachable()
|
|
#else
|
|
#define UNREACHABLE
|
|
#endif
|
|
|
|
#define SCREEN_WIDTH 320
|
|
#define SCREEN_HEIGHT 240
|
|
|
|
#define PROJECTED_TO_SCREEN_X(projectedPos, invW) ((projectedPos).x * (invW) * (SCREEN_WIDTH / 2) + (SCREEN_WIDTH / 2))
|
|
#define PROJECTED_TO_SCREEN_Y(projectedPos, invW) ((projectedPos).y * (invW) * (-SCREEN_HEIGHT / 2) + (SCREEN_HEIGHT / 2))
|
|
|
|
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
|
|
#define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0]))
|
|
|
|
#define SEGMENTED_TO_K0(addr) (void*)((gSegments[SEGMENT_NUMBER(addr)] + K0BASE) + SEGMENT_OFFSET(addr))
|
|
|
|
#define ABS(x) (((x) >= 0) ? (x): -(x))
|
|
#define ABS_F(x) (((x) >= 0.0f) ? (x) : -(x))
|
|
|
|
#define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x))
|
|
#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x))
|
|
#define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x))
|
|
|
|
#define DECR(x) ((x) == 0 ? 0 : --(x))
|
|
|
|
#define CHECK_FLAG_ALL(flags, mask) (((flags) & (mask)) == (mask))
|
|
|
|
#endif
|