Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions config/cflags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3135,3 +3135,29 @@ src/levels/shared/L00_003A53E8-g16.c -O2 -G16 -Wa,-G16 -ffunction-sections -frac
src/levels/11_joba/L11_00420C88-state-g8.c -O2 -G8 -ffunction-sections -frac2-qcopy -frac2-qcopy-barrier
src/levels/shared/L00_002D7940.c -O2 -G0 -ffunction-sections -Wa,--r5900-unsigned32-mask=sn
src/levels/02_maktar_nebula/L02_003D0408-g8.c -O2 -G8 -ffunction-sections -frac2-hazard-labels
src/pal/levels/20_yeedil/L20_00449870.c -O2 -G0 -ffunction-sections -frac2-hazard-labels
src/pal/levels/shared/L00_003BFBD8-nointerblock-g8.c -O2 -G8 -ffunction-sections -fno-sched-interblock
src/pal/levels/shared/L02_00335678.c -O2 -G0 -ffunction-sections -mno-split-addresses
src/pal/levels/06_notak/L06_00405FA8-hz.c -O2 -G0 -ffunction-sections -g
src/pal/levels/shared/L04_0040B8B8-trail.c -O2 -G0 -ffunction-sections -g
src/pal/levels/11_joba/L11_00445BB8-g.c -O2 -G0 -ffunction-sections -g
src/pal/levels/shared/L02_0038CE70-hz.c -O2 -G0 -ffunction-sections -mno-split-addresses
src/pal/levels/shared/L00_002D5380-g8.c -O2 -G8 -ffunction-sections -frac2-hazard-labels
src/pal/levels/shared/L04_0033EB40-movement.c -O2 -G0 -g -ffunction-sections
src/pal/levels/shared/L18_003FDE80-switch-g8.c -O2 -G8 -ffunction-sections -frac2-keep-block-order
src/pal/levels/20_yeedil/L20_003A1940-g8-hz.c -O2 -G8 -ffunction-sections -mno-split-addresses
src/pal/levels/shared/L01_002A8B30.c -O2 -G0 -ffunction-sections
src/pal/levels/11_joba/L11_0043C288-g8.c -O2 -G8 -ffunction-sections -frac2-zero-ti-por -frac2-keep-block-order
src/pal/levels/01_oozla/L01_00414828-g8.c -O2 -G8 -ffunction-sections -mno-split-addresses
src/pal/levels/01_oozla/L01_003D5C30-g8.c -O2 -G8 -ffunction-sections -g
src/pal/levels/02_maktar_nebula/L02_00402030-g8.c -O2 -G8 -ffunction-sections
src/pal/levels/01_oozla/L01_00432438-g8.c -O2 -G8 -ffunction-sections -g -frac2-hazard-labels
src/pal/levels/00_aranos_tutorial/L00_004138A0-f7-g8.c -O2 -G8 -ffunction-sections -malign-loops=2
src/pal/levels/01_oozla/L01_00415E78-f7-g8.c -O2 -G8 -ffunction-sections -malign-loops=2
src/pal/levels/02_maktar_nebula/L02_0043F638-f7-g8.c -O2 -G8 -ffunction-sections -malign-loops=2
src/pal/levels/05_feltzin_system/L05_00419C60-f7-g8.c -O2 -G8 -ffunction-sections -malign-loops=2
src/pal/levels/06_notak/L06_0045ACC8-f7-g8.c -O2 -G8 -ffunction-sections -malign-loops=2
src/pal/levels/10_hrugis_cloud/L10_0041A730-f7-g8.c -O2 -G8 -ffunction-sections -malign-loops=2
src/pal/levels/11_joba/L11_00473908-f7-g8.c -O2 -G8 -ffunction-sections -malign-loops=2
src/pal/levels/12_todano/L12_0041C930-f7-g8.c -O2 -G8 -ffunction-sections -malign-loops=2
src/pal/levels/13_boldan/L13_00421C68-f7-g8.c -O2 -G8 -ffunction-sections -malign-loops=2
195 changes: 195 additions & 0 deletions src/pal/levels/00_aranos_tutorial/L00_004138A0-f7-g8.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
/* func_PAL_L00_004138A0, the PAL copy of func_L00_0040EAA0: the same C, where func_002F5CC8
becomes func_PAL_002F6C18; func_L00_002B9D60 becomes func_PAL_L00_002B9CD8; func_002AF0A8
becomes func_PAL_002AFC10. */
#include "common.h"

typedef struct {
int msg; /* 0x0 */
int link; /* 0x4 */
unsigned char idx; /* 0x8 */
signed char item; /* 0x9 */
unsigned char on; /* 0xA */
signed char count; /* 0xB */
union { int word; signed char low; struct { char pad[1]; unsigned char quiet; char pad2; unsigned char had; } b; } tail; /* 0xC */
} TriggerVars;

extern void func_0026FEB8(const char *, ...);
extern int func_00288AA0(void *, int);
extern int func_00288BE8(void *); /* its result is tested elsewhere */
extern void func_00288CB0(int, int);
extern void func_0029B3E0(int, int);
extern void func_0029F338(void *);
extern void func_002A0430(int);
extern void func_002A7750(void *, int, int);
extern int func_002ACBC8(void *, int);
extern void func_002AD7B8(int);
extern void func_PAL_002AFC10(int);
extern int func_002B38B8(void *);
extern void func_002DF3F8(void *, void *);
extern void func_PAL_002F6C18(void);
extern int func_002F5D10(void);
extern void func_PAL_L00_002B9CD8(void *, void *, int, int);

extern unsigned int D_00139768[];
typedef struct {
char pad0[0x80]; char body[0x2294 - 0x80];
int mode; char pad2298[0x24CC - 0x2298];
int health;
} HeroView;
extern HeroView D_00189E20;
extern char D_00189EA0[];
extern unsigned char D_0019B2E8[];
extern int D_001A79F0;
extern unsigned char D_001A7BC8[] MACRO_ADDR;
extern int D_L06_001A8F00;
extern char D_L06_001B1810[];
extern int D_L06_001B2348;
extern char *D_L06_001B290C;
extern char D_L06_001BFA40[];
extern short **D_L06_002AA490[];
extern char D_L06_002E2210[];

typedef struct {
char pad00[0x10]; char pos[0x10];
unsigned char state; char pad21[0x47];
TriggerVars *vars; char pad6C[0x3E];
short id; char padAC[4];
unsigned char group; char padB1; short oclass; char padB4[8];
unsigned char hit; char padBD[0x33];
char dir[0x10];
} Thing;

void func_PAL_L00_004138A0(Thing *m)
{
TriggerVars *p = m->vars;
int notify, i, missing, fail;
int played;

switch (m->state) {
case 0:
if ((p->item != -1 && D_001A7BC8[p->item] != 0)
|| (m->group != 0xFF && (D_0019B2E8[m->group + D_001A79F0 * 16] & 0x80))) {
func_0029F338(m);
break;
}
func_002A7750(m, 1, -1);
case 1:
if (p->on == 0 && func_002B38B8(m) == 0 && m->hit == 0)
break;
p->on = 1;
func_002A7750(m, 2, -1);
case 2:
if (p->on == 0) {
func_002A7750(m, 1, -1);
break;
}
if (D_00189E20.mode == 0x1C)
break;
if (D_00189E20.health <= 0)
break;
if (D_L06_001A8F00 != 0)
break;
if (p->msg != -1 && func_002ACBC8(D_00189E20.body, p->msg) == 0)
break;
fail = 1;
missing = 1;
if (D_L06_002AA490[D_001A79F0] != 0 && D_L06_002AA490[D_001A79F0][p->idx] != 0) {
for (i = 0; D_L06_002AA490[D_001A79F0][p->idx][i] != -1; i++) {
int e = D_L06_002AA490[D_001A79F0][p->idx][i];

missing = 0;
if (p->tail.b.quiet == 0) {
int bit = 1 << (e & 0x1F);
if (D_00139768[(unsigned int)e >> 2] & bit)
continue;
}
if (func_00288AA0(D_L06_001BFA40, e) == 0 && i == 0) {
func_0026FEB8(D_L06_002E2210, m->id, m->oclass, D_001A79F0, p->idx, e);
return;
}
fail = 0;
}
}
/* Retail keeps missing in $s5 above fail: the test's do-while (a debug-print macro's
shape) counts it at loop depth, its fourth reference. Its loop label is not aligned
in retail, so the unit turns loop alignment off; the other loop's label is already
on an 8-byte boundary. */
do {
if (missing != 0)
func_0026FEB8(D_L06_001B1810, D_001A79F0, p->idx);
} while (0);
if (fail != 0) {
p->tail.b.had = 0;
func_002A7750(m, 4, -1);
break;
}
p->tail.b.had = 1;
func_00288BE8(D_L06_001BFA40);
if (D_L06_001B2348 < 5 || (D_001A79F0 == 6 && p->idx == 0))
func_PAL_002F6C18();
func_002A7750(m, 3, -1);
break;
case 3:
if (func_002F5D10() == 0) {
if (p->link != -1) {
char *o = D_L06_001B290C + (p->link << 7);
func_PAL_L00_002B9CD8(o + 0x30, o + 0x70, 0, 1);
}
func_002A7750(m, 4, -1);
}
if (D_001A79F0 != 0)
break;
if (p->item == -1)
break;
if (func_002F5D10() != 0)
break;
notify = 0;
if (p->item != -1) {
func_002AD7B8(p->item);
if (p->item != 0x18)
func_PAL_002AFC10(p->item);
notify = 1;
}
if (m->group != 0xFF && !(D_0019B2E8[m->group + D_001A79F0 * 16] & 0x80)) {
func_002A0430(m->group);
notify = 1;
}
if (p->count != 0 && (p->tail.word & 0xFFFF0000)) {
if (p->link != -1) {
char *o = D_L06_001B290C + (p->link << 7);
func_002DF3F8(o + 0x30, o + 0x70);
} else
func_002DF3F8(m->pos, m->dir);
}
if (p->tail.low != -1)
func_00288CB0(p->tail.low, 1);
else if (notify != 0 || p->tail.b.had != 0)
func_0029B3E0(0, -1);
break;
case 4:
played = 0;
if (p->item != -1) {
func_002AD7B8(p->item);
if (p->item != 0x18)
func_PAL_002AFC10(p->item);
played = 1;
}
if (m->group != 0xFF && !(D_0019B2E8[m->group + D_001A79F0 * 16] & 0x80)) {
func_002A0430(m->group);
played = 1;
}
if (p->count > 0 && (p->tail.word & 0xFFFF0000)) {
if (p->link != -1) {
char *o = D_L06_001B290C + (p->link << 7);
func_002DF3F8(o + 0x30, o + 0x70);
} else
func_002DF3F8(D_00189EA0, D_00189EA0 + 0x10);
}
if (p->tail.low != -1)
func_00288CB0(p->tail.low, 1);
else if ((played != 0 || p->tail.b.had != 0) && p->count != p->tail.low)
func_0029B3E0(0, -1);
func_0029F338(m);
break;
}
}
1 change: 0 additions & 1 deletion src/pal/levels/00_aranos_tutorial/L00_004138A0.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#include "include_asm.h"

INCLUDE_ASM("asm/pal/levels", func_PAL_L00_004138A0);
1 change: 0 additions & 1 deletion src/pal/levels/01_oozla/L01_003D2EF0.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@

INCLUDE_ASM("asm/pal/levels", func_PAL_L01_003D2EF0);

INCLUDE_ASM("asm/pal/levels", func_PAL_L01_003D5C30);
133 changes: 133 additions & 0 deletions src/pal/levels/01_oozla/L01_003D5C30-g8.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/* func_PAL_L01_003D5C30, the PAL copy of func_L01_003D1A48: the same C, where 1.0f / 60.0f becomes
0.020000001f. */
#include "common.h"

typedef float Vec[4] __attribute__((aligned(16)));
typedef struct { Vec p[4]; int color[4]; float uv[4][2]; long gs[4]; } Quad;
extern long func_0027C878(int);
extern void func_00282F20(void *, void *, float);
extern void func_00282CC0(void *, void *, void *);
extern void func_00282CF0(void *, void *, void *);
extern u32 func_002AAE98(float, float, float, float);
extern float func_00283CC8(float *, float);
extern float func_00283198(float);
extern float func_002A7798(float);
extern int func_00283CF0(float);
extern void func_00280B90(void *, int, int);
extern float D_L01_001B04D4 __attribute__((sda));
extern float D_L01_001B04D8 __attribute__((sda));
extern float D_L01_001B04DC __attribute__((sda));
extern int D_L01_001B04E0 __attribute__((sda));
extern int D_L01_001B04E4 __attribute__((sda));
extern int D_L01_001B04E8 __attribute__((sda));
extern int D_L01_001B04EC __attribute__((sda));
extern int D_L01_001B04F0 __attribute__((sda));
extern float D_L01_001B04F4 __attribute__((sda));
extern float D_L01_001B04F8 __attribute__((sda));
extern float D_L01_001B04FC __attribute__((sda));
extern float D_L01_001B0500 __attribute__((sda));
extern float D_L01_001B0504 __attribute__((sda));
extern float D_L01_001B0508 __attribute__((sda));
extern float D_L01_001B050C __attribute__((sda));
extern float D_L01_001B0510 __attribute__((sda));
extern float D_L01_001B0514 __attribute__((sda));
extern float D_L01_001B0518 __attribute__((sda));
extern float D_L01_001B051C __attribute__((sda));
extern float D_L01_001B0520 __attribute__((sda));
extern float D_L01_001B0524 __attribute__((sda));
extern float D_L01_001B0528 __attribute__((sda));
extern float D_L01_001B052C __attribute__((sda));
extern float D_L01_001B0530 __attribute__((sda));
extern float D_L01_001B0534 __attribute__((sda));
extern float D_L01_001B0538 __attribute__((sda));
extern float D_L01_001B053C __attribute__((sda));

void func_PAL_L01_003D5C30(u8 *m)
{
Quad q;
Vec a,b,c,d,e;
float phase;
u8 *s = *(u8 **)(m+0x68);
float width, step, t, v, angle, halfWidth, scroll;
long blend;
int color;
int i;
q.gs[1] = func_0027C878(*(int *)(s+0xB4)+0x3F);
width = D_L01_001B04D4 / D_L01_001B04D8;
scroll = (D_L01_001B053C * (0.020000001f)) / width;
halfWidth = -(D_L01_001B04D4*0.5f);
q.gs[2] = 0xFF9000000260ULL;
blend = (long)D_L01_001B04E0 | ((long)D_L01_001B04E4 << 2);
blend |= (long)D_L01_001B04E8 << 4;
blend |= (long)D_L01_001B04EC << 6;
blend |= (long)D_L01_001B04F0 << 32;
q.gs[3] = blend;
q.gs[0] = 0;
*(float *)(s+0xB8) -= scroll;
func_00282F20(a,m+0xC0,halfWidth);
func_00282CC0(a,a,s+0x60);
func_00282F20(b,m+0xC0,width);
func_00282F20(d,m+0xD0,-(D_L01_001B04DC*0.5f));
func_00282F20(e,m+0xD0,D_L01_001B04DC*((1.0f-D_L01_001B0530)*0.5f));
step = 1.0f / D_L01_001B04D8;
for(i=0;i<5;i++) {
v=0.0f;
switch(i) {
case 0:
a[2]+=D_L01_001B0528;
qcopy(c,a);
color=func_002AAE98(D_L01_001B04F8,D_L01_001B04FC,D_L01_001B0500,0.0f);
q.color[2]=q.color[3]=color;
v=func_00283CC8(&phase,*(float *)(s+0xB8));
break;
case 1:
qcopy(c,a);
color=func_002AAE98(D_L01_001B0504,D_L01_001B0508,D_L01_001B050C,0.0f);
q.color[2]=q.color[3]=color;
v=func_00283CC8(&phase,*(float *)(s+0xB8)+0.5f);
break;
case 2:
a[2]+=D_L01_001B0528;
qcopy(c,a);
color=func_002AAE98(D_L01_001B0510,D_L01_001B0514,D_L01_001B0518,0.0f);
q.color[2]=q.color[3]=color;
func_00282F20(d,d,D_L01_001B04DC*(D_L01_001B052C*0.5f));
width*=D_L01_001B0530;
step*=D_L01_001B0530;
func_00282F20(b,m+0xC0,width);
v=func_00283CC8(&phase,(D_L01_001B0534 * *(float *)(s+0xB8))/D_L01_001B0530);
break;
case 3:
v=func_00283CC8(&phase,(D_L01_001B0538 * *(float *)(s+0xB8))/D_L01_001B0530);
color=func_002AAE98(D_L01_001B051C,D_L01_001B0520,D_L01_001B0524,0.0f);
q.color[2]=q.color[3]=color;
func_00282CC0(c,a,e);
break;
case 4:
func_00282CF0(c,a,e);
break;
}
func_00282CF0(q.p[2],c,d);
t=step;
func_00282CC0(q.p[3],c,d);
func_00282CC0(c,c,b);
q.uv[2][0]=q.uv[0][0]=0.0f;
q.uv[3][0]=q.uv[1][0]=1.0f;
q.uv[1][1]=q.uv[0][1]=v;
q.uv[3][1]=q.uv[2][1]=v+1.0f;
while(t<1.0f) {
int rgb = 0xFFFFFF;
angle=func_002A7798(func_00283198(t*3.14159274f))*128.0f;
q.color[0]=q.color[1]=q.color[2];
color=func_00283CF0((D_L01_001B04F4*angle)* *(float *)(s+0xAC));
q.color[2]=q.color[3]=(q.color[0]&rgb)|(color<<24);
qcopy(q.p[0],q.p[2]);
qcopy(q.p[1],q.p[3]);
func_00282CF0(q.p[2],c,d);
t+=step;
func_00282CC0(q.p[3],c,d);
func_00282CC0(c,c,b);
func_00280B90(&q,0,1);
}
}
}
2 changes: 0 additions & 2 deletions src/pal/levels/01_oozla/L01_004145E0.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "include_asm.h"


INCLUDE_ASM("asm/pal/levels", func_PAL_L01_00414828);


INCLUDE_ASM("asm/pal/levels", func_PAL_L01_00415E78);
Loading
Loading