94 viewZ = mapWork->
viewY & 0xffff0000;
96 viewCoordinates = &mapWork->
viewX;
97 viewX = viewCoordinates[0] & 0xffff0000;
98 viewZ = viewCoordinates[1] & 0xffff0000;
111 objectIndex++,
object++) {
116 if (object->
x != 0 || object->
z != 0) {
117 kind =
object->kind & 15;
129 frozen->
dirty = kind;
132 dx =
object->x - viewX;
133 dz =
object->z - viewZ;
134 screenTop = dz -
object->y;
135 sprite =
object->sprite;
138 if (dx > -0x200000 && dx < 0x1100000 && screenTop > -0x200000 &&
139 screenTop < 0xe00000) {
142 .
cells)[(object->
x >> 20) + ((
object->z >> 20) << 7)];
143 if (object->
flags & 1) {
150 layerPlusOne = tile->
layer;
151 if (layerPlusOne != 0)
152 object->layer = layerPlusOne - 1;
156 drawPosition.
height =
object->y;
161 if (object->
flags & 2) {
162 drawPosition.
height += 0xfec00000;
163 drawPosition.
y += 0xfec00000;
166 if (object->
flags & 4) {
167 drawPosition.
height += 0x1400000;
168 drawPosition.
y += 0x1400000;
177 if (object->
held == 0) {
184 kind =
object->kind & 15;
186 sprite =
object->sprite;
189 sprite->
dirty = kind;
214 s32 spritesRemaining;
244 angle = (
s16)
ArcTan2((eye->
x - target->
x) >> 16, (eye->
z - target->
z) >> 16);
258 fixedScale = 0x10000;
262 kind =
object->kind & 15;
265 objectPosition = &
object->x;
266 scale[0] =
object->scaleX;
267 scale[1] =
object->scaleY;
270 scale[0] = fixedScale;
271 scale[1] = fixedScale;
277 groupScale[0] =
object->scaleX;
278 groupScale[1] =
object->scaleY;
280 groupScale[0] = fixedScale;
281 groupScale[1] = fixedScale;
285 sprites =
object->sprite;
286 for (spritesRemaining = 3; spritesRemaining >= 0; spritesRemaining--) {
struct BattleCamera * gCameraWork
const s32 gCamera_FixedViewMatrix[12]
The fixed camera's view matrix (Q16): identity with a -0.8 shear of y by x.
s32 GameFlag_TestFar(s32 flag)
u8 Render_DecodeFrameCodeSize[]
What every part of the field object shares: its includes and the few names more than one part uses.
#define FLAG_CHOOSING_COMMANDS
set while the commands are chosen
@ HEAP_SLOT_FRAME_SCRATCH
Lives for one frame: WaitFrames builds the OAM list in it, and the field sprite decoder keeps its cod...
#define Iwram_MulQ16(left, right)
static void Iwram_TransformMatrix(const s32 *matrix)
s32 ArcTan2(s32 x, s32 y)
Returns the angle of the vector (x, y), in 1/65536 turns, measured from the y axis: 0 along +y,...
void Runtime_ReleaseHeapBlock(s32 slot)
UNUSED s32 ObjectCamera_ReturnTrue(void)
void ObjectSystem_UpdateCamera(void)
Each frame, with the scrolling camera: places every object's sprite on the screen.
void ObjectSystem_UpdateCameraFixed(void)
Each frame, with the fixed camera: places every object's sprite, from the 64th object down,...
#define RamCode_LoadSlot(slot, code, bytes)
Allocates a work-slot copy; release it with Runtime_ReleaseHeapBlock.
void Render_ApplyProjectedPlacement(struct AnimationObject *sprite, const struct SpritePlacement *position, const struct SpriteScale *scale, s32 facing)
Places a sprite for the scrolling camera and queues it for drawing.
void Render_PlaceProjectedSprite(struct AnimationObject *sprite, s32 *point, s32 *scale, s32 facing, s32 depth)
Places a sprite at 3D point for the fixed camera and queues it for drawing: projected to the screen a...
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
struct AnimationSpritePart shadow
struct AnimationSpritePart image
u8 slot
VRAM cache entry holding its tiles.
s32 scale
16.16 fixed point, 0x10000 full size
u8 retainCacheEntry
Keeps the VRAM cache entry when it is released or off screen.
u8 dirty
nonzero redraws its pixels into VRAM when next drawn
u16 priority
2 when created
struct ObjectCameraPoint * targetOverride
when set, used as the target
struct ObjectCameraPoint * eyeOverride
when set, used as the eye
struct ObjectCameraPoint eye
struct ObjectCameraPoint target
A field object, as the camera reads it.
u16 angle
the sprite's facing, before the camera's angle is added
u8 held
nonzero keeps the sprite and its VRAM off screen or suspended
void * sprite
a sprite, or for kind 2 an array of four sprite pointers
s32 height
the ground height under the object
u8 flags
bits: 2 draw 320 pixels down | 1 up | 0 priority from cell
u8 layer
the map layer it stands on; the cell under it may change it
u8 kind
1: one sprite, 2: up to four
s32 y
up; the on-screen test uses z - y
u32 active
zero for a free slot
A point the fixed camera looks from or at.
s32 x
16.16 fixed-point pixels
s32 z
16.16 fixed-point pixels
s32 y
16.16 fixed-point pixels
A map cell's word, as the camera reads it.
u32 priority
if not 0, the priority of an object standing on it
u32 layer
if not 0, the layer of an object standing on it, + 1
u32 block
the block (metatile) number
The object system's work: the flag that suspends sprite projection, the outline's edge and fill colou...
u16 used
sprite pixel bytes composed since the camera reset it
s16 suspended
nonzero while a menu has suspended sprite projection
A sprite's screen position and its two vertical offsets, in 16.16 pixels.
s32 x
screen x of the sprite's centre
s32 y
screen y at the ground; sets the depth slot
s32 groundHeight
how far the shadow is raised above y
s32 height
how far the image is raised above y
Horizontal and vertical sprite scale; 0x10000 is the original size.
struct ScriptMotionObject * gObjectSlots
s32 VramCache_ReleaseVram(u32 no)
Gives back entry no's blocks but keeps the entry taken, with size 1, so a later VramCache_Load can re...