mirror of
https://github.com/zeldaret/tmc
synced 2026-06-20 08:13:24 -04:00
position.c tentative
This commit is contained in:
+2
-2
@@ -20,7 +20,7 @@ extern void (*gUnk_08124798[])(Entity*);
|
||||
extern void (*gUnk_081247A0[])(Entity*);
|
||||
extern void (*gUnk_081247AC[])(Entity*);
|
||||
extern Entity* CreateObject(u32, u32, u32);
|
||||
extern void sub_0806FA30(Entity*, Entity*);
|
||||
extern void PositionEntityOnTop(Entity*, Entity*);
|
||||
extern void sub_0807BB68(u32*, u32, u32);
|
||||
|
||||
extern u8 gUnk_02034490;
|
||||
@@ -164,7 +164,7 @@ Entity* sub_0809F770(Entity* this) {
|
||||
|
||||
cloud = CreateObject(163, 1, 0);
|
||||
if (cloud != NULL) {
|
||||
sub_0806FA30(this, cloud);
|
||||
PositionEntityOnTop(this, cloud);
|
||||
uVar1 = Random();
|
||||
cloud->x.HALF.HI = ((cloud->x.HALF.HI - 16) + (uVar1 >> 0)) & 31;
|
||||
cloud->y.HALF.HI = ((cloud->y.HALF.HI - 16) + (uVar1 >> 8)) & 31;
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern void PositionRelative();
|
||||
|
||||
void CopyPosition(Entity* param_1, Entity* param_2)
|
||||
|
||||
{
|
||||
PositionRelative(param_1, param_2, 0, 0);
|
||||
return;
|
||||
}
|
||||
+2
-2
@@ -81,13 +81,13 @@ void sub_08069428(Entity* this, s32 offsetX, bool32 createFx65) {
|
||||
Entity* fx = CreateFx(this, 4, 0);
|
||||
if (fx) {
|
||||
PositionRelative(this, fx, offsetX, 0xFFF00000);
|
||||
sub_0806FAB0(this, fx);
|
||||
ResolveEntityOnTop(this, fx);
|
||||
}
|
||||
if (createFx65 != 0) {
|
||||
fx = CreateFx(this, 65, 0);
|
||||
if (fx) {
|
||||
PositionRelative(this, fx, offsetX, 0xFFF00000);
|
||||
sub_0806FAB0(this, fx);
|
||||
ResolveEntityOnTop(this, fx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "position.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern u8 gUnk_08114F78[];
|
||||
extern u8 gUnk_08114F80[];
|
||||
|
||||
void CopyPosition(Entity* param_1, Entity* param_2)
|
||||
{
|
||||
PositionRelative(param_1, param_2, 0, 0);
|
||||
}
|
||||
|
||||
void PositionEntityOnTop(Entity* ent, Entity* ent2) {
|
||||
PositionRelative(ent, ent2, 0, 0);
|
||||
ResolveEntityOnTop(ent, ent2);
|
||||
}
|
||||
|
||||
void PositionRelative(Entity* source, Entity* target, s32 offsetX, s32 offsetY) { // r0, r1, r2, r3
|
||||
s32 x;
|
||||
s32 y;
|
||||
|
||||
x = source->x.WORD;
|
||||
target->x.WORD = x + offsetX;
|
||||
|
||||
y = source->y.WORD;
|
||||
target->y.WORD = y + offsetY;
|
||||
|
||||
target->height = source->height; // ldr
|
||||
target->collisionLayer = source->collisionLayer;
|
||||
UpdateSpriteOrderAndFlip(target);
|
||||
}
|
||||
|
||||
void CopyPositionAndSpriteOffset(Entity *param_1,Entity *param_2)
|
||||
{
|
||||
param_2->spriteOffsetX = param_1->spriteOffsetX;
|
||||
param_2->spriteOffsetY = param_1->spriteOffsetY;
|
||||
PositionRelative(param_1, param_2, 0, 0);
|
||||
}
|
||||
|
||||
void sub_0806FA90(Entity *param_1,Entity *param_2, s32 offsetX, s32 offsetY)
|
||||
{
|
||||
param_2->spriteOffsetX = param_1->spriteOffsetX;
|
||||
param_2->spriteOffsetY = param_1->spriteOffsetY;
|
||||
PositionRelative(param_1,param_2, offsetX * 64 * 32 * 32, offsetY * 64 * 32 * 32);
|
||||
}
|
||||
|
||||
void ResolveEntityOnTop(Entity *param_1,Entity *param_2)
|
||||
{
|
||||
param_2->ticks.b0 = gUnk_08114F78[param_1->ticks.b0];
|
||||
}
|
||||
|
||||
void sub_0806FAD8(Entity *param_1,Entity *param_2)
|
||||
{
|
||||
param_2->ticks.b0 = gUnk_08114F80[param_1->ticks.b0];
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern void UpdateSpriteOrderAndFlip(Entity*);
|
||||
|
||||
void PositionRelative(Entity* source, Entity* target, s32 offsetX, s32 offsetY) { // r0, r1, r2, r3
|
||||
s32 x;
|
||||
s32 y;
|
||||
|
||||
x = source->x.WORD;
|
||||
target->x.WORD = x + offsetX;
|
||||
|
||||
y = source->y.WORD;
|
||||
target->y.WORD = y + offsetY;
|
||||
|
||||
target->height = source->height; // ldr
|
||||
target->collisionLayer = source->collisionLayer;
|
||||
UpdateSpriteOrderAndFlip(target);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
extern void PositionRelative(Entity*, Entity*, s32, s32);
|
||||
extern void sub_0806FAB0(Entity*, Entity*);
|
||||
|
||||
void sub_0806FA30(Entity* ent, Entity* ent2) {
|
||||
PositionRelative(ent, ent2, 0, 0);
|
||||
sub_0806FAB0(ent, ent2);
|
||||
}
|
||||
/*
|
||||
thumb_func_start sub_0806FA30
|
||||
sub_0806FA30: @ 0x0806FA30
|
||||
push {r4, r5, lr}
|
||||
adds r4, r0, #0
|
||||
adds r5, r1, #0
|
||||
movs r2, #0
|
||||
movs r3, #0
|
||||
bl PositionRelative
|
||||
adds r0, r4, #0
|
||||
adds r1, r5, #0
|
||||
bl sub_0806FAB0
|
||||
pop {r4, r5, pc}
|
||||
*/
|
||||
+1
-1
@@ -59,7 +59,7 @@ void sub_0806A26C(Entity *this)
|
||||
Entity *pEVar1;
|
||||
pEVar1 = CreateObject(0xf,0x2f,0);
|
||||
if (pEVar1 != NULL) {
|
||||
sub_0806FA30(this, pEVar1);
|
||||
PositionEntityOnTop(this, pEVar1);
|
||||
if (uVar2 = Random(), uVar2)
|
||||
{
|
||||
unk = -unk; // wtf?!
|
||||
|
||||
Reference in New Issue
Block a user