Skip to content

Commit

Permalink
Merge pull request #113 from t895/setbinoczoom
Browse files Browse the repository at this point in the history
More Binoc funcs
  • Loading branch information
TheOnlyZac authored Nov 12, 2024
2 parents 1c4ec61 + 8d59898 commit d093a79
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 50 deletions.
6 changes: 3 additions & 3 deletions config/symbol_addrs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,12 @@ FUN_00136238 = 0x136238; // type:func
FUN_001363d0 = 0x1363D0; // type:func
SetBinocAchzDraw = 0x136408; // type:func
FDoneBinocAchz = 0x136530; // type:func
SetBinocLookat = 0x1365A0; // type:func
SetBinocZoom = 0x1365A8; // type:func
SetBinocLookat__FP5BINOCP3ALO = 0x1365A0; // type:func
SetBinocZoom__FP5BINOCf = 0x1365A8; // type:func
FUN_001365f0 = 0x1365F0; // type:func
FUN_00136648 = 0x136648; // type:func
DrawBinoc = 0x1366A0; // type:func
GetBinocReticleFocus = 0x136EC8; // type:func
GetBinocReticleFocus__FP5BINOCPfT1 = 0x136EC8; // type:func
FUN_00136ef8 = 0x136EF8; // type:func
FUN_00136fa8 = 0x136FA8; // type:func
binoc__static_initialization_and_destruction_0 = 0x136FE8; // type:func
Expand Down
15 changes: 13 additions & 2 deletions include/binoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,23 @@
#include "common.h"
#include <screen.h>

struct BINOC : public BLOT {
undefined1 padding[0x90];
struct BINOC : public BLOT
{
void *vtbinoc;
undefined1 padding_0[116];
float value0;
undefined4 value1;
undefined1 padding_1[4];
ALO *paloLookat;
float zoom;
float dxReticle;
float dyReticle;
undefined1 padding_2[8];
float uCompassBarOffset;
};

void SetBinocLookat(BINOC *binoc, ALO *paloLookat);

/**
* @brief Horizontal text justification.
*/
Expand Down
74 changes: 54 additions & 20 deletions include/screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,35 +50,59 @@ struct BLOTI
BLOTE blotePeg;
};

/**
* @brief User interface state.
*/
enum UIS
{
UIS_Nil = -1,
UIS_Splash = 0,
UIS_Attract = 1,
UIS_Playing = 2,
UIS_Pausing = 3,
UIS_Paused = 4,
UIS_Unpausing = 5,
UIS_WorldMap = 6,
// todo What is 7?
UIS_Wiping = 8,
UIS_Max = 9
};

struct BLOT
{
union {
union
{
VTBLOT *pvtblot;
VTNOTE *pvtnote;
};
CFont *pfont;
char achzDraw[512];
undefined1 achzDraw[512];
RGBA rgba;
float rFontScale;
CTextEdge *pte;
BLOTK blotk;
BLOTI *bloti;
float x, y;
float xOn, yOn;
float xOff, yOff;
float dx, dy;
float uOn;
float width, height;
float easing;
float dtAppear;
float dtVisible;
float dtDisappear;
float dtBlotsExtre;
float dtBlotsExtra;
BLOTS blots;
float tBlots;
float *ptNow;
int fActive;
UIS uis;
int blotMode;
int selectedIndex;
undefined4 unk_0;
float dgDisplayMax;
undefined4 unk_1;
undefined4 *pfnsmack;
};


// MARK: Timer

/**
Expand Down Expand Up @@ -123,13 +147,29 @@ struct CTR : public BLOT
void *pv;
};

struct TRUNKCTR : public CTR { };
struct CRUSHERCTR : public CTR { };
struct LIFECTR : public CTR { };
struct CLUECTR : public CTR { };
struct KEYCTR : public CTR { };
struct COINCTR : public CTR { };
struct TRUNKCTR : public CTR
{
};
struct CRUSHERCTR : public CTR
{
};
struct LIFECTR : public CTR
{
};
struct CLUECTR : public CTR
{
};
struct KEYCTR : public CTR
{
};
struct COINCTR : public CTR
{
};

extern LIFECTR g_lifectr;
extern CLUECTR g_cluectr;
extern KEYCTR g_keyctr;
extern COINCTR g_coinctr;

// MARK: Totals

Expand All @@ -145,13 +185,7 @@ extern TOTALS g_totals;

struct NOTE : public BLOT
{
u32 unk260;
u32 unk264;
u32 unk268;
u32 unk26C;
u32 unk270;
u32 unk274;
struct NOTE* unk278;
struct NOTE *unk278;
};

extern NOTE g_note;
Expand Down
18 changes: 0 additions & 18 deletions include/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,6 @@
#include "common.h"
#include <screen.h>

/**
* @brief User interface state.
*/
enum UIS
{
UIS_Nil = -1,
UIS_Splash = 0,
UIS_Attract = 1,
UIS_Playing = 2,
UIS_Pausing = 3,
UIS_Paused = 4,
UIS_Unpausing = 5,
UIS_WorldMap = 6,
//todo What is 7?
UIS_Wiping = 8,
UIS_Max = 9
};

/**
* @brief User interface.
*
Expand Down
45 changes: 38 additions & 7 deletions src/P2/binoc.c
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
#include <binoc.h>
#include <alo.h>

INCLUDE_ASM(const s32, "P2/binoc", InitBei);

INCLUDE_ASM(const s32, "P2/binoc", GEvaluateBei);

void InitBinoc(BINOC *binoc, BLOTK blotk) {
binoc->dx = 640.0f;
binoc->dy = 492.80001f;
void InitBinoc(BINOC *binoc, BLOTK blotk)
{
binoc->width = 640.0f;
binoc->height = 492.80001f;
binoc->value0 = 15.0f;
binoc->value1 = 0x80ffffff;
InitBlot(binoc, blotk);
}

INCLUDE_ASM(const s32, "P2/binoc", ResetBinoc__FP5BINOC);
void ResetBinoc(BINOC *binoc)
{
binoc->pvtblot->pfnSetBlotAchzDraw(binoc, 0);
SetBinocLookat(binoc, (ALO *)0);
binoc->dxReticle = 0.0f;
binoc->dyReticle = 0.0f;
binoc->uCompassBarOffset = 0.4f;
binoc->zoom = 0.0f;
}

INCLUDE_ASM(const s32, "P2/binoc", PostBinocLoad__FP5BINOC);

Expand Down Expand Up @@ -60,17 +70,38 @@ INCLUDE_ASM(const s32, "P2/binoc", SetBinocAchzDraw);

INCLUDE_ASM(const s32, "P2/binoc", FDoneBinocAchz);

INCLUDE_ASM(const s32, "P2/binoc", SetBinocLookat);
void SetBinocLookat(BINOC *binoc, ALO *paloLookat)
{
binoc->paloLookat = paloLookat;
}

INCLUDE_ASM(const s32, "P2/binoc", SetBinocZoom);
void SetBinocZoom(BINOC *binoc, float zoom)
{
float cappedZoom = zoom * 0.01f;
float one = 1.0f;
float zero = 0.0f;
if (cappedZoom < zero)
{
cappedZoom = zero;
}
else if (cappedZoom > one)
{
cappedZoom = one;
}
binoc->zoom = cappedZoom;
}

INCLUDE_ASM(const s32, "P2/binoc", FUN_001365f0);

INCLUDE_ASM(const s32, "P2/binoc", FUN_00136648);

INCLUDE_ASM(const s32, "P2/binoc", DrawBinoc);

INCLUDE_ASM(const s32, "P2/binoc", GetBinocReticleFocus);
void GetBinocReticleFocus(BINOC *binoc, float *dxReticle, float *dyReticle)
{
*dxReticle = binoc->dxReticle + 320.0f;
*dyReticle = binoc->dyReticle + 180.40001f;
}

INCLUDE_ASM(const s32, "P2/binoc", FUN_00136ef8);

Expand Down

0 comments on commit d093a79

Please sign in to comment.