Alchemy
Loading...
Searching...
No Matches

transform.h

Go to the documentation of this file.
1#ifndef ALCHEMY_TRANSFORM_H
2#define ALCHEMY_TRANSFORM_H
3
4/// @file
5/// The 3D transform and its stack.
6
7#include "edition.h"
8#include "types.h"
9
10extern s32 gTransform[12];
11
14
16
17static __inline__ void Transform_SetIdentity(void *matrix) {
18 CAMELOT_ASM("three stmia no C store or copy compiles to")
19 __asm__ volatile("mov r0, %0\n\tmov r1, #128\n\tmov r2, #0\n\tmov r3, #0\n\t"
20 "mov r4, #0\n\tlsl r1, r1, #9\n\t"
21 "stmia r0!, {r1, r2, r3, r4}\n\t"
22 "stmia r0!, {r1, r2, r3, r4}\n\t"
23 "stmia r0!, {r1, r2, r3, r4}"
24 :
25 : "r"(matrix)
26 : "r0", "r1", "r2", "r3", "r4", "memory");
27}
28
29/// The games order the identity-register setup differently before the same
30/// stores.
31#define TRANSFORM_IDENTITY_REGISTER_SETUP \
32 "mov r0, %1\n\tmov r1, #128\n\tmov r2, #0\n\tmov %0, #0\n\t" \
33 "mov r4, #0\n\tlsl r1, r1, #9\n\t"
34
35/// Resets the current matrix to identity.
36static __inline__ void Transform_ResetCurrent(void) {
37 s32 zero;
38
40 "Transform_SetIdentity's three stmia, applied to the current matrix")
42 "stmia r0!, {r1, r2, %0, r4}\n\t"
43 "stmia r0!, {r1, r2, %0, r4}\n\t"
44 "stmia r0!, {r1, r2, %0, r4}"
45 : "=l"(zero)
46 : "r"(gTransform)
47 : "r0", "r1", "r2", "r4", "memory");
48}
49
50#undef TRANSFORM_IDENTITY_REGISTER_SETUP
51
52#endif
The edition's language, for C to compare (LANGUAGE == LANGUAGE_GERMAN).
#define TRANSFORM_IDENTITY_REGISTER_SETUP
The games order the identity-register setup differently before the same stores.
Definition transform.h:31
static __inline__ void Transform_SetIdentity(void *matrix)
Definition transform.h:17
void SceneTransform_RewindStack(void)
s32 gTransform[12]
u8 * gTransformStackTop
static __inline__ void Transform_ResetCurrent(void)
Resets the current matrix to identity.
Definition transform.h:36
s32 gTransformStackDepth
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
unsigned char u8
Definition types.h:11
#define CAMELOT_ASM(proof)
Definition types.h:46