Add C mtx and vec functions
Include printfunc (lots of GX is missing for it)
This commit is contained in:
parent
a978d8d325
commit
e40e69e1d8
7 changed files with 240 additions and 136 deletions
|
|
@ -18,12 +18,16 @@ add_subdirectory(extern/musyx EXCLUDE_FROM_ALL)
|
|||
set(DOLPHIN_FILES
|
||||
src/dolphin/os/OSAlloc.c
|
||||
src/dolphin/os/OSArena.c
|
||||
src/dolphin/mtx/mtx.c
|
||||
src/dolphin/mtx/mtx44.c
|
||||
src/dolphin/mtx/vec.c
|
||||
)
|
||||
|
||||
set(GAME_FILES
|
||||
src/game/card.c
|
||||
src/game/fault.c
|
||||
src/game/flag.c
|
||||
src/game/font.c
|
||||
src/game/frand.c
|
||||
src/game/gamework.c
|
||||
src/game/main.c
|
||||
|
|
@ -31,6 +35,7 @@ set(GAME_FILES
|
|||
src/game/memory.c
|
||||
src/game/init.c
|
||||
src/game/pad.c
|
||||
src/game/printfunc.c
|
||||
src/game/process.c
|
||||
)
|
||||
|
||||
|
|
@ -50,5 +55,5 @@ source_group("Port" FILES ${PORT_FILES})
|
|||
add_executable(marioparty4 ${DOLPHIN_FILES} ${GAME_FILES} ${PORT_FILES})
|
||||
target_compile_definitions(marioparty4 PRIVATE TARGET_PC VERSION=0)
|
||||
target_compile_definitions(musyx PRIVATE MUSY_VERSION_MAJOR=1 MUSY_VERSION_MINOR=5 MUSY_VERSION_PATCH=4)
|
||||
target_include_directories(marioparty4 PRIVATE include)
|
||||
target_include_directories(marioparty4 PRIVATE include build/GMPE01_00/include)
|
||||
target_link_libraries(marioparty4 PRIVATE aurora::aurora aurora::main musyx)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,11 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__MWERKS__) && !defined(GEKKO)
|
||||
#define GEKKO
|
||||
#endif
|
||||
|
||||
#ifndef GEKKO
|
||||
#define MTX_USE_C
|
||||
#undef MTX_USE_PS
|
||||
|
|
|
|||
|
|
@ -74,9 +74,10 @@ void C_MTXOrtho(Mtx44 m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f)
|
|||
m[3][3] = 1.0f;
|
||||
}
|
||||
|
||||
#ifdef GEKKO
|
||||
asm void PSMTX44Copy(register Mtx44 src, register Mtx44 dest)
|
||||
{
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
// clang-format off
|
||||
nofralloc;
|
||||
psq_l fp1, 0(src), 0, 0;
|
||||
psq_st fp1, 0(dest), 0, 0;
|
||||
|
|
@ -95,5 +96,6 @@ asm void PSMTX44Copy(register Mtx44 src, register Mtx44 dest)
|
|||
psq_l fp1, 0x38(src), 0, 0;
|
||||
psq_st fp1, 0x38(dest), 0, 0;
|
||||
blr;
|
||||
#endif // clang-format on
|
||||
// clang-format on
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include "dolphin/mtx.h"
|
||||
#include "dolphin/gx/GXPriv.h"
|
||||
#include "math.h"
|
||||
|
||||
#define R_RET fp1
|
||||
|
|
@ -15,9 +16,19 @@
|
|||
#define FP12 fp12
|
||||
#define FP13 fp13
|
||||
|
||||
void C_VECAdd(const Vec *a, const Vec *b, Vec *c) {
|
||||
ASSERTMSGLINE(0x57, a, "VECAdd(): NULL VecPtr 'a' ");
|
||||
ASSERTMSGLINE(0x58, b, "VECAdd(): NULL VecPtr 'b' ");
|
||||
ASSERTMSGLINE(0x59, c, "VECAdd(): NULL VecPtr 'ab' ");
|
||||
c->x = a->x + b->x;
|
||||
c->y = a->y + b->y;
|
||||
c->z = a->z + b->z;
|
||||
}
|
||||
|
||||
#ifdef GEKKO
|
||||
asm void PSVECAdd(const register Vec *vec1, const register Vec *vec2, register Vec *ret)
|
||||
{
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
// clang-format off
|
||||
nofralloc;
|
||||
psq_l FP2, 0(vec1), 0, 0;
|
||||
psq_l FP4, 0(vec2), 0, 0;
|
||||
|
|
@ -28,12 +39,23 @@ asm void PSVECAdd(const register Vec *vec1, const register Vec *vec2, register V
|
|||
ps_add FP7, FP3, FP5;
|
||||
psq_st FP7, 8(ret), 1, 0;
|
||||
blr
|
||||
#endif // clang-format on
|
||||
// clang-format on
|
||||
}
|
||||
#endif
|
||||
|
||||
void C_VECSubtract(const Vec *a, const Vec *b, Vec *c) {
|
||||
ASSERTMSGLINE(0x9C, a, "VECSubtract(): NULL VecPtr 'a' ");
|
||||
ASSERTMSGLINE(0x9D, b, "VECSubtract(): NULL VecPtr 'b' ");
|
||||
ASSERTMSGLINE(0x9E, c, "VECSubtract(): NULL VecPtr 'a_b' ");
|
||||
c->x = a->x - b->x;
|
||||
c->y = a->y - b->y;
|
||||
c->z = a->z - b->z;
|
||||
}
|
||||
|
||||
#ifdef GEKKO
|
||||
asm void PSVECSubtract(const register Vec *vec1, const register Vec *vec2, register Vec *ret)
|
||||
{
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
// clang-format off
|
||||
nofralloc;
|
||||
psq_l FP2, 0(vec1), 0, 0;
|
||||
psq_l FP4, 0(vec2), 0, 0;
|
||||
|
|
@ -44,22 +66,9 @@ asm void PSVECSubtract(const register Vec *vec1, const register Vec *vec2, regis
|
|||
ps_sub FP7, FP3, FP5;
|
||||
psq_st FP7, 8(ret), 1, 0;
|
||||
blr
|
||||
#endif // clang-format on
|
||||
}
|
||||
|
||||
asm void PSVECScale(register const Vec *src, register Vec *dst, register f32 scale)
|
||||
{
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
nofralloc
|
||||
psq_l f0, 0(src), 0, 0
|
||||
psq_l f2, 8(src), 1, 0
|
||||
ps_muls0 f0, f0, f1
|
||||
psq_st f0, 0(dst), 0, 0
|
||||
ps_muls0 f0, f2, f1
|
||||
psq_st f0, 8(dst), 1, 0
|
||||
blr
|
||||
#endif // clang-format on
|
||||
// clang-format on
|
||||
}
|
||||
#endif
|
||||
|
||||
void C_VECScale(const Vec *src, Vec *dst, f32 scale)
|
||||
{
|
||||
|
|
@ -71,9 +80,39 @@ void C_VECScale(const Vec *src, Vec *dst, f32 scale)
|
|||
dst->z = src->z * s;
|
||||
}
|
||||
|
||||
#ifdef GEKKO
|
||||
asm void PSVECScale(register const Vec *src, register Vec *dst, register f32 scale)
|
||||
{
|
||||
#// clang-format off
|
||||
nofralloc
|
||||
psq_l f0, 0(src), 0, 0
|
||||
psq_l f2, 8(src), 1, 0
|
||||
ps_muls0 f0, f0, f1
|
||||
psq_st f0, 0(dst), 0, 0
|
||||
ps_muls0 f0, f2, f1
|
||||
psq_st f0, 8(dst), 1, 0
|
||||
blr
|
||||
// clang-format on
|
||||
}
|
||||
#endif
|
||||
|
||||
void C_VECNormalize(const Vec *src, Vec *unit) {
|
||||
f32 mag;
|
||||
|
||||
ASSERTMSGLINE(0x127, src, "VECNormalize(): NULL VecPtr 'src' ");
|
||||
ASSERTMSGLINE(0x128, unit, "VECNormalize(): NULL VecPtr 'unit' ");
|
||||
mag = (src->z * src->z) + ((src->x * src->x) + (src->y * src->y));
|
||||
ASSERTMSGLINE(0x12D, 0.0f != mag, "VECNormalize(): zero magnitude vector ");
|
||||
mag = 1.0f/ sqrtf(mag);
|
||||
unit->x = src->x * mag;
|
||||
unit->y = src->y * mag;
|
||||
unit->z = src->z * mag;
|
||||
}
|
||||
|
||||
#ifdef GEKKO
|
||||
void PSVECNormalize(const register Vec *vec1, register Vec *ret)
|
||||
{
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
// clang-format off
|
||||
register f32 half = 0.5f;
|
||||
register f32 three = 3.0f;
|
||||
register f32 xx_zz, xx_yy;
|
||||
|
|
@ -96,43 +135,60 @@ void PSVECNormalize(const register Vec *vec1, register Vec *ret)
|
|||
ps_muls0 FP3, FP3, ret_sqrt;
|
||||
psq_st FP3, 8(ret), 1, 0;
|
||||
}
|
||||
#endif // clang-format on
|
||||
// clang-format on
|
||||
}
|
||||
#endif
|
||||
|
||||
f32 C_VECSquareMag(const Vec *v) {
|
||||
f32 sqmag;
|
||||
|
||||
ASSERTMSGLINE(0x182, v, "VECMag(): NULL VecPtr 'v' ");
|
||||
|
||||
sqmag = v->z * v->z + ((v->x * v->x) + (v->y * v->y));
|
||||
return sqmag;
|
||||
}
|
||||
|
||||
#ifdef GEKKO
|
||||
asm f32 PSVECSquareMag(register const Vec *v) {
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
// clang-format off
|
||||
nofralloc
|
||||
psq_l f0, 0(v), 0, 0
|
||||
ps_mul f0, f0, f0
|
||||
lfs f1, 8(v)
|
||||
ps_madd f1, f1, f1, f0
|
||||
ps_sum0 f1, f1, f0, f0
|
||||
blr
|
||||
#endif // clang-format on
|
||||
blr
|
||||
// clang-format on
|
||||
}
|
||||
#endif
|
||||
|
||||
f32 C_VECMag(const Vec *v) {
|
||||
return sqrtf(C_VECSquareMag(v));
|
||||
}
|
||||
|
||||
#ifdef GEKKO
|
||||
f32 PSVECMag(const register Vec *v)
|
||||
{
|
||||
register f32 v_xy, v_zz, square_mag;
|
||||
register f32 ret_mag, n_0, n_1;
|
||||
register f32 three, half, zero;
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
// clang-format off
|
||||
asm {
|
||||
psq_l v_xy, 0(v), 0, 0
|
||||
ps_mul v_xy, v_xy, v_xy
|
||||
lfs v_zz, 8(v)
|
||||
ps_madd square_mag, v_zz, v_zz, v_xy
|
||||
}
|
||||
#endif // clang-format on
|
||||
// clang-format on
|
||||
half = 0.5f;
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
// clang-format off
|
||||
asm {
|
||||
ps_sum0 square_mag, square_mag, v_xy, v_xy
|
||||
frsqrte ret_mag, square_mag
|
||||
}
|
||||
#endif // clang-format on
|
||||
// clang-format on
|
||||
three = 3.0f;
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
// clang-format off
|
||||
asm {
|
||||
fmuls n_0, ret_mag, ret_mag
|
||||
fmuls n_1, ret_mag, half
|
||||
|
|
@ -141,13 +197,24 @@ asm {
|
|||
fsel ret_mag, ret_mag, ret_mag, square_mag
|
||||
fmuls square_mag, square_mag, ret_mag
|
||||
}
|
||||
#endif // clang-format on
|
||||
// clang-format on
|
||||
return square_mag;
|
||||
}
|
||||
#endif
|
||||
|
||||
f32 C_VECDotProduct(const Vec *a, const Vec *b) {
|
||||
f32 dot;
|
||||
|
||||
ASSERTMSGLINE(0x1D1, a, "VECDotProduct(): NULL VecPtr 'a' ");
|
||||
ASSERTMSGLINE(0x1D2, b, "VECDotProduct(): NULL VecPtr 'b' ");
|
||||
dot = (a->z * b->z) + ((a->x * b->x) + (a->y * b->y));
|
||||
return dot;
|
||||
}
|
||||
|
||||
#ifdef GEKKO
|
||||
asm f32 PSVECDotProduct(const register Vec *vec1, const register Vec *vec2)
|
||||
{
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
// clang-format off
|
||||
nofralloc;
|
||||
psq_l f2, 4(r3), 0, 0 /* qr0 */
|
||||
psq_l f3, 4(r4), 0, 0 /* qr0 */
|
||||
|
|
@ -156,13 +223,30 @@ asm f32 PSVECDotProduct(const register Vec *vec1, const register Vec *vec2)
|
|||
psq_l f4, 0(r4), 0, 0 /* qr0 */
|
||||
ps_madd f3, f5, f4, f2
|
||||
ps_sum0 f1, f3, f2, f2
|
||||
blr
|
||||
#endif // clang-format on
|
||||
blr
|
||||
// clang-format on
|
||||
}
|
||||
#endif
|
||||
|
||||
void C_VECCrossProduct(const Vec *a, const Vec *b, Vec *axb) {
|
||||
Vec vTmp;
|
||||
|
||||
ASSERTMSGLINE(0x20F, a, "VECCrossProduct(): NULL VecPtr 'a' ");
|
||||
ASSERTMSGLINE(0x210, b, "VECCrossProduct(): NULL VecPtr 'b' ");
|
||||
ASSERTMSGLINE(0x211, axb, "VECCrossProduct(): NULL VecPtr 'axb' ");
|
||||
|
||||
vTmp.x = (a->y * b->z) - (a->z * b->y);
|
||||
vTmp.y = (a->z * b->x) - (a->x * b->z);
|
||||
vTmp.z = (a->x * b->y) - (a->y * b->x);
|
||||
axb->x = vTmp.x;
|
||||
axb->y = vTmp.y;
|
||||
axb->z = vTmp.z;
|
||||
}
|
||||
|
||||
#ifdef GEKKO
|
||||
asm void PSVECCrossProduct(register const Vec *a, register const Vec *b, register Vec *axb)
|
||||
{
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
// clang-format off
|
||||
nofralloc
|
||||
psq_l f1, 0(b), 0, 0
|
||||
lfs f2, 8(a)
|
||||
|
|
@ -178,9 +262,10 @@ asm void PSVECCrossProduct(register const Vec *a, register const Vec *b, registe
|
|||
psq_st f9, 0(axb), 1, 0
|
||||
ps_neg f10, f10
|
||||
psq_st f10, 4(axb), 0, 0
|
||||
blr
|
||||
#endif // clang-format on
|
||||
blr
|
||||
// clang-format on
|
||||
}
|
||||
#endif
|
||||
|
||||
void C_VECHalfAngle(const Vec *a, const Vec *b, Vec *half)
|
||||
{
|
||||
|
|
@ -229,8 +314,18 @@ void C_VECReflect(const Vec *src, const Vec *normal, Vec *dst)
|
|||
VECNormalize(dst, dst);
|
||||
}
|
||||
|
||||
f32 C_VECSquareDistance(const Vec *a, const Vec *b) {
|
||||
Vec diff;
|
||||
|
||||
diff.x = a->x - b->x;
|
||||
diff.y = a->y - b->y;
|
||||
diff.z = a->z - b->z;
|
||||
return (diff.z * diff.z) + ((diff.x * diff.x) + (diff.y * diff.y));
|
||||
}
|
||||
|
||||
#ifdef GEKKO
|
||||
asm f32 PSVECSquareDistance(register const Vec *a, register const Vec *b) {
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
// clang-format off
|
||||
nofralloc
|
||||
psq_l f0, 4(a), 0, 0
|
||||
psq_l f1, 4(b), 0, 0
|
||||
|
|
@ -241,10 +336,16 @@ asm f32 PSVECSquareDistance(register const Vec *a, register const Vec *b) {
|
|||
ps_sub f0, f0, f1
|
||||
ps_madd f1, f0, f0, f2
|
||||
ps_sum0 f1, f1, f2, f2
|
||||
blr
|
||||
#endif // clang-format on
|
||||
blr
|
||||
// clang-format on
|
||||
}
|
||||
#endif
|
||||
|
||||
f32 C_VECDistance(const Vec *a, const Vec *b) {
|
||||
return sqrtf(C_VECSquareDistance(a, b));
|
||||
}
|
||||
|
||||
#ifdef GEKKO
|
||||
f32 PSVECDistance(register const Vec *a, register const Vec *b)
|
||||
{
|
||||
|
||||
|
|
@ -252,7 +353,7 @@ f32 PSVECDistance(register const Vec *a, register const Vec *b)
|
|||
register f32 three_c;
|
||||
register f32 dist;
|
||||
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
// clang-format off
|
||||
asm {
|
||||
psq_l f0, 4(a), 0, 0 /* qr0 */
|
||||
psq_l f1, 4(b), 0, 0 /* qr0 */
|
||||
|
|
@ -283,5 +384,6 @@ f32 PSVECDistance(register const Vec *a, register const Vec *b)
|
|||
}
|
||||
|
||||
return dist;
|
||||
#endif // clang-format on
|
||||
// clang-format on
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -109,10 +109,10 @@ void main(void)
|
|||
HuSysInit(&GXPal528IntDf);
|
||||
#endif
|
||||
HuPrcInit();
|
||||
// HuPadInit();
|
||||
// GWInit();
|
||||
// pfInit();
|
||||
// GlobalCounter = 0;
|
||||
HuPadInit();
|
||||
GWInit();
|
||||
pfInit();
|
||||
GlobalCounter = 0;
|
||||
// HuSprInit();
|
||||
// Hu3DInit();
|
||||
// HuDataInit();
|
||||
|
|
@ -125,7 +125,7 @@ void main(void)
|
|||
// GWPlayerCfg[i].character = -1;
|
||||
}
|
||||
|
||||
//omMasterInit(0, _ovltbl, OVL_COUNT, OVL_BOOT);
|
||||
// omMasterInit(0, _ovltbl, OVL_COUNT, OVL_BOOT);
|
||||
VIWaitForRetrace();
|
||||
|
||||
if (VIGetNextField() == 0) {
|
||||
|
|
@ -170,7 +170,7 @@ void main(void)
|
|||
HuPadRead();
|
||||
pfClsScr();*/
|
||||
|
||||
HuPrcCall(1);
|
||||
HuPrcCall(1);
|
||||
/* MGSeqMain();
|
||||
HuPerfBegin(1);
|
||||
Hu3DExec();
|
||||
|
|
@ -213,7 +213,7 @@ void HuSysVWaitSet(s16 vcount)
|
|||
|
||||
s16 HuSysVWaitGet(s16 param)
|
||||
{
|
||||
return (s16) minimumVcount;
|
||||
return (s16)minimumVcount;
|
||||
}
|
||||
|
||||
s32 rnd_seed = 0x0000D9ED;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#include "dolphin.h"
|
||||
#include "game/printfunc.h"
|
||||
#include "game/init.h"
|
||||
#include "dolphin.h"
|
||||
#include "game/disp.h"
|
||||
#include "game/init.h"
|
||||
|
||||
#include "stdio.h"
|
||||
#include "stdarg.h"
|
||||
#include "stdio.h"
|
||||
|
||||
extern u8 ank8x8_4b[];
|
||||
|
||||
|
|
@ -31,31 +31,16 @@ BOOL saftyFrameF;
|
|||
|
||||
static void WireDraw(void);
|
||||
|
||||
static GXColor ATTRIBUTE_ALIGN(32) fcoltbl[16] = {
|
||||
{ 0, 0, 0, 255 },
|
||||
{ 0, 0, 128, 255 },
|
||||
{ 128, 0, 0, 255 },
|
||||
{ 128, 0, 128, 255 },
|
||||
{ 0, 128, 0, 255 },
|
||||
{ 0, 128, 128, 255 },
|
||||
{ 128, 128, 0, 255 },
|
||||
{ 128, 128, 128, 255 },
|
||||
{ 128, 128, 128, 128 },
|
||||
{ 0, 0, 255, 255 },
|
||||
{ 255, 0, 0, 255 },
|
||||
{ 255, 0, 255, 255 },
|
||||
{ 0, 255, 0, 255 },
|
||||
{ 0, 255, 255, 255 },
|
||||
{ 255, 255, 0, 255 },
|
||||
{ 255, 255, 255, 255 }
|
||||
};
|
||||
static GXColor ATTRIBUTE_ALIGN(32) fcoltbl[16] = { { 0, 0, 0, 255 }, { 0, 0, 128, 255 }, { 128, 0, 0, 255 }, { 128, 0, 128, 255 }, { 0, 128, 0, 255 },
|
||||
{ 0, 128, 128, 255 }, { 128, 128, 0, 255 }, { 128, 128, 128, 255 }, { 128, 128, 128, 128 }, { 0, 0, 255, 255 }, { 255, 0, 0, 255 },
|
||||
{ 255, 0, 255, 255 }, { 0, 255, 0, 255 }, { 0, 255, 255, 255 }, { 255, 255, 0, 255 }, { 255, 255, 255, 255 } };
|
||||
|
||||
void pfInit(void)
|
||||
{
|
||||
int i;
|
||||
fontcolor = 15;
|
||||
empstrline = 0;
|
||||
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
strline[i].str[0] = 0;
|
||||
}
|
||||
|
|
@ -68,7 +53,7 @@ void pfClsScr(void)
|
|||
empstrline = 0;
|
||||
strlinecnt = 0;
|
||||
for (i = 0; i < 256; i++) {
|
||||
strline[i].empstrline_next = i+1;
|
||||
strline[i].empstrline_next = i + 1;
|
||||
strline[i].type = 0;
|
||||
if (strline[i].str[0] != 0) {
|
||||
strline[i].str[0] = 0;
|
||||
|
|
@ -84,7 +69,7 @@ s16 print8(s16 x, s16 y, float scale, char *str, ...)
|
|||
s16 ret;
|
||||
va_list list;
|
||||
strline_curr = &strline[empstrline];
|
||||
if(strlinecnt >= 256) {
|
||||
if (strlinecnt >= 256) {
|
||||
return -1;
|
||||
}
|
||||
va_start(list, str);
|
||||
|
|
@ -98,7 +83,7 @@ s16 print8(s16 x, s16 y, float scale, char *str, ...)
|
|||
strline_curr->y = y;
|
||||
strline_curr->scale = scale;
|
||||
dst = strline_curr->str;
|
||||
while(*src) {
|
||||
while (*src) {
|
||||
*dst++ = *src++;
|
||||
}
|
||||
*dst = 0;
|
||||
|
|
@ -112,7 +97,7 @@ s16 printWin(s16 x, s16 y, s16 w, s16 h, GXColor *color)
|
|||
s16 ret;
|
||||
char *src = pfStrBuf;
|
||||
strline_curr = &strline[empstrline];
|
||||
if(strlinecnt >= 256) {
|
||||
if (strlinecnt >= 256) {
|
||||
return -1;
|
||||
}
|
||||
strlinecnt++;
|
||||
|
|
@ -137,9 +122,9 @@ void pfDrawFonts(void)
|
|||
Mtx modelview;
|
||||
int i;
|
||||
s16 x, y, w, h;
|
||||
|
||||
|
||||
u16 strline_count = strlinecnt;
|
||||
if(saftyFrameF) {
|
||||
if (saftyFrameF) {
|
||||
WireDraw();
|
||||
}
|
||||
MTXOrtho(proj, 0, HU_FB_HEIGHT, 0, HU_FB_WIDTH, 0, 10);
|
||||
|
|
@ -173,10 +158,10 @@ void pfDrawFonts(void)
|
|||
GXSetAlphaCompare(GX_GEQUAL, 1, GX_AOP_AND, GX_GEQUAL, 1);
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_NOOP);
|
||||
GXSetAlphaUpdate(GX_TRUE);
|
||||
for(i=0; i<256; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
x = strline[i].x;
|
||||
y = strline[i].y;
|
||||
if(strline[i].type == 1) {
|
||||
if (strline[i].type == 1) {
|
||||
w = strline[i].w;
|
||||
h = strline[i].h;
|
||||
GXClearVtxDesc();
|
||||
|
|
@ -191,10 +176,13 @@ void pfDrawFonts(void)
|
|||
GXSetNumTevStages(1);
|
||||
GXSetNumTexGens(0);
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
#ifdef __MWERKS__
|
||||
// TODO PC
|
||||
GXPosition2s16(x, y);
|
||||
GXPosition2s16(x+w, y);
|
||||
GXPosition2s16(x+w, y+h);
|
||||
GXPosition2s16(x, y+h);
|
||||
GXPosition2s16(x + w, y);
|
||||
GXPosition2s16(x + w, y + h);
|
||||
GXPosition2s16(x, y + h);
|
||||
#endif
|
||||
GXEnd();
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
|
|
@ -209,8 +197,9 @@ void pfDrawFonts(void)
|
|||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
|
||||
GXSetTevOp(GX_TEVSTAGE0, GX_MODULATE);
|
||||
} else {
|
||||
if(strline[i].str[0] != '\0') {
|
||||
}
|
||||
else {
|
||||
if (strline[i].str[0] != '\0') {
|
||||
float shadow_ofs_x, shadow_ofs_y;
|
||||
float char_w;
|
||||
float char_h;
|
||||
|
|
@ -219,79 +208,83 @@ void pfDrawFonts(void)
|
|||
u16 color;
|
||||
s16 shadow_color;
|
||||
float scale;
|
||||
char_w = char_h = 8.0f*strline[i].scale;
|
||||
char_w = char_h = 8.0f * strline[i].scale;
|
||||
str = strline[i].str;
|
||||
color = strline[i].color;
|
||||
shadow_color = -1;
|
||||
scale = 1.0f;
|
||||
while(*str) {
|
||||
while (*str) {
|
||||
char c = *str++;
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
case 255:
|
||||
c = *str++;
|
||||
scale = c/16.0f;
|
||||
char_w = 8.0f*strline[i].scale*scale;
|
||||
char_h = 8.0f*strline[i].scale*scale;
|
||||
scale = c / 16.0f;
|
||||
char_w = 8.0f * strline[i].scale * scale;
|
||||
char_h = 8.0f * strline[i].scale * scale;
|
||||
break;
|
||||
|
||||
|
||||
case 254:
|
||||
color = (*str++)-1;
|
||||
color = (*str++) - 1;
|
||||
break;
|
||||
|
||||
|
||||
case 253:
|
||||
shadow_color = (*str++)-1;
|
||||
shadow_ofs_x = 1.3333333f*strline[i].scale*scale;
|
||||
shadow_ofs_y = 1.3333333f*strline[i].scale*scale;
|
||||
shadow_color = (*str++) - 1;
|
||||
shadow_ofs_x = 1.3333333f * strline[i].scale * scale;
|
||||
shadow_ofs_y = 1.3333333f * strline[i].scale * scale;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
texcoord_x = (c%16)/16.0f;
|
||||
texcoord_y = ((c/16)/16.0f)+(1/128.0f);
|
||||
if(shadow_color < 0) {
|
||||
texcoord_x = (c % 16) / 16.0f;
|
||||
texcoord_y = ((c / 16) / 16.0f) + (1 / 128.0f);
|
||||
#ifdef __MWERKS__
|
||||
// TODO PC
|
||||
if (shadow_color < 0) {
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
GXPosition3s16(x, y, 0);
|
||||
GXColor1x8(color);
|
||||
GXTexCoord2f32(texcoord_x, texcoord_y);
|
||||
GXPosition3s16(x+char_w, y, 0);
|
||||
GXPosition3s16(x + char_w, y, 0);
|
||||
GXColor1x8(color);
|
||||
GXTexCoord2f32(texcoord_x+(1/16.0f), texcoord_y);
|
||||
GXPosition3s16(x+char_w, y+char_h, 0);
|
||||
GXTexCoord2f32(texcoord_x + (1 / 16.0f), texcoord_y);
|
||||
GXPosition3s16(x + char_w, y + char_h, 0);
|
||||
GXColor1x8(color);
|
||||
GXTexCoord2f32(texcoord_x+(1/16.0f), texcoord_y+(1/16.0f));
|
||||
GXPosition3s16(x, y+char_h, 0);
|
||||
GXTexCoord2f32(texcoord_x + (1 / 16.0f), texcoord_y + (1 / 16.0f));
|
||||
GXPosition3s16(x, y + char_h, 0);
|
||||
GXColor1x8(color);
|
||||
GXTexCoord2f32(texcoord_x, texcoord_y+(1/16.0f));
|
||||
GXTexCoord2f32(texcoord_x, texcoord_y + (1 / 16.0f));
|
||||
GXEnd();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 8);
|
||||
GXPosition3s16(x+shadow_ofs_x, y+shadow_ofs_y, 0);
|
||||
GXPosition3s16(x + shadow_ofs_x, y + shadow_ofs_y, 0);
|
||||
GXColor1x8(shadow_color);
|
||||
GXTexCoord2f32(texcoord_x, texcoord_y);
|
||||
GXPosition3s16(x+char_w+shadow_ofs_x, y+shadow_ofs_y, 0);
|
||||
GXPosition3s16(x + char_w + shadow_ofs_x, y + shadow_ofs_y, 0);
|
||||
GXColor1x8(shadow_color);
|
||||
GXTexCoord2f32(texcoord_x+(1/16.0f), texcoord_y);
|
||||
GXPosition3s16(x+char_w+shadow_ofs_x, y+char_h+shadow_ofs_y, 0);
|
||||
GXTexCoord2f32(texcoord_x + (1 / 16.0f), texcoord_y);
|
||||
GXPosition3s16(x + char_w + shadow_ofs_x, y + char_h + shadow_ofs_y, 0);
|
||||
GXColor1x8(shadow_color);
|
||||
GXTexCoord2f32(texcoord_x+(1/16.0f), texcoord_y+(1/16.0f));
|
||||
GXPosition3s16(x+shadow_ofs_x, y+char_h+shadow_ofs_y, 0);
|
||||
GXTexCoord2f32(texcoord_x + (1 / 16.0f), texcoord_y + (1 / 16.0f));
|
||||
GXPosition3s16(x + shadow_ofs_x, y + char_h + shadow_ofs_y, 0);
|
||||
GXColor1x8(shadow_color);
|
||||
GXTexCoord2f32(texcoord_x, texcoord_y+(1/16.0f));
|
||||
GXTexCoord2f32(texcoord_x, texcoord_y + (1 / 16.0f));
|
||||
GXPosition3s16(x, y, 0);
|
||||
GXColor1x8(color);
|
||||
GXTexCoord2f32(texcoord_x, texcoord_y);
|
||||
GXPosition3s16(x+char_w, y, 0);
|
||||
GXPosition3s16(x + char_w, y, 0);
|
||||
GXColor1x8(color);
|
||||
GXTexCoord2f32(texcoord_x+(1/16.0f), texcoord_y);
|
||||
GXPosition3s16(x+char_w, y+char_h, 0);
|
||||
GXTexCoord2f32(texcoord_x + (1 / 16.0f), texcoord_y);
|
||||
GXPosition3s16(x + char_w, y + char_h, 0);
|
||||
GXColor1x8(color);
|
||||
GXTexCoord2f32(texcoord_x+(1/16.0f), texcoord_y+(1/16.0f));
|
||||
GXPosition3s16(x, y+char_h, 0);
|
||||
GXTexCoord2f32(texcoord_x + (1 / 16.0f), texcoord_y + (1 / 16.0f));
|
||||
GXPosition3s16(x, y + char_h, 0);
|
||||
GXColor1x8(color);
|
||||
GXTexCoord2f32(texcoord_x, texcoord_y+(1/16.0f));
|
||||
GXTexCoord2f32(texcoord_x, texcoord_y + (1 / 16.0f));
|
||||
GXEnd();
|
||||
}
|
||||
#endif
|
||||
x += char_w;
|
||||
if(x > HU_FB_WIDTH) {
|
||||
if (x > HU_FB_WIDTH) {
|
||||
x = 0;
|
||||
y += char_h;
|
||||
}
|
||||
|
|
@ -312,9 +305,10 @@ static void WireDraw(void)
|
|||
Mtx modelview;
|
||||
MTXOrtho(proj, 0, HU_DISP_HEIGHT, 0, HU_DISP_WIDTH, 0, 10);
|
||||
GXSetProjection(proj, GX_ORTHOGRAPHIC);
|
||||
if(RenderMode->field_rendering) {
|
||||
if (RenderMode->field_rendering) {
|
||||
GXSetViewportJitter(0, 0, HU_FB_WIDTH, HU_FB_HEIGHT, 0, 1, VIGetNextField());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
GXSetViewport(0, 0, HU_FB_WIDTH, HU_FB_HEIGHT, 0, 1);
|
||||
}
|
||||
GXSetScissor(0, 0, HU_FB_WIDTH, HU_FB_HEIGHT);
|
||||
|
|
@ -336,21 +330,24 @@ static void WireDraw(void)
|
|||
MTXIdentity(modelview);
|
||||
GXLoadPosMtxImm(modelview, GX_PNMTX0);
|
||||
GXBegin(GX_LINES, 0, 8);
|
||||
#ifdef __MWERKS__
|
||||
// TODO PC
|
||||
GXPosition2f32(SAFETY_W, SAFETY_H);
|
||||
GXColor3u8(255, 0, 0);
|
||||
GXPosition2f32(SAFETY_W, HU_DISP_HEIGHT-SAFETY_H);
|
||||
GXPosition2f32(SAFETY_W, HU_DISP_HEIGHT - SAFETY_H);
|
||||
GXColor3u8(255, 0, 0);
|
||||
GXPosition2f32(SAFETY_W, SAFETY_H);
|
||||
GXColor3u8(255, 0, 0);
|
||||
GXPosition2f32(HU_DISP_WIDTH-SAFETY_W, SAFETY_H);
|
||||
GXPosition2f32(HU_DISP_WIDTH - SAFETY_W, SAFETY_H);
|
||||
GXColor3u8(255, 0, 0);
|
||||
GXPosition2f32(HU_DISP_WIDTH-SAFETY_W, HU_DISP_HEIGHT-SAFETY_H);
|
||||
GXPosition2f32(HU_DISP_WIDTH - SAFETY_W, HU_DISP_HEIGHT - SAFETY_H);
|
||||
GXColor3u8(255, 0, 0);
|
||||
GXPosition2f32(HU_DISP_WIDTH-SAFETY_W, SAFETY_H);
|
||||
GXPosition2f32(HU_DISP_WIDTH - SAFETY_W, SAFETY_H);
|
||||
GXColor3u8(255, 0, 0);
|
||||
GXPosition2f32(HU_DISP_WIDTH-SAFETY_W, HU_DISP_HEIGHT-SAFETY_H);
|
||||
GXPosition2f32(HU_DISP_WIDTH - SAFETY_W, HU_DISP_HEIGHT - SAFETY_H);
|
||||
GXColor3u8(255, 0, 0);
|
||||
GXPosition2f32(SAFETY_W, HU_DISP_HEIGHT-SAFETY_H);
|
||||
GXPosition2f32(SAFETY_W, HU_DISP_HEIGHT - SAFETY_H);
|
||||
GXColor3u8(255, 0, 0);
|
||||
#endif
|
||||
GXEnd();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,12 +185,6 @@ s32 CARDWriteAsync(CARDFileInfo *fileInfo, const void *addr, s32 length, s32 off
|
|||
return 0;
|
||||
}
|
||||
|
||||
void C_MTXScale(Mtx m, f32 xS, f32 yS, f32 zS)
|
||||
{
|
||||
*(volatile int *)0 = 0;
|
||||
puts("C_MTXScale is a stub");
|
||||
}
|
||||
|
||||
void DCFlushRange(void *addr, u32 nBytes)
|
||||
{
|
||||
puts("DCFlushRange is a stub");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue