port InitColours

This commit is contained in:
rr- 2021-03-01 21:20:44 +01:00
parent 844a812074
commit 6b3104ec6b
9 changed files with 62 additions and 12 deletions

View file

@ -289,7 +289,7 @@
<rect width="12.00" height="12.00" x="504.00" y="87.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="518.00" y="87.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="532.00" y="87.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="546.00" y="87.00" fill="lightpink"/>
<rect width="12.00" height="12.00" x="546.00" y="87.00" fill="forestgreen"/>
<rect width="12.00" height="12.00" x="560.00" y="87.00" fill="lightpink"/>
<rect width="12.00" height="12.00" x="574.00" y="87.00" fill="lightpink"/>
<rect width="12.00" height="12.00" x="588.00" y="87.00" fill="lightpink"/>
@ -1004,7 +1004,7 @@
<rect width="11.98" height="12.55" x="670.05" y="337.58" fill="lightpink"/>
<rect width="11.98" height="12.55" x="684.02" y="337.58" fill="lightpink"/>
<rect width="11.59" height="12.86" x="511.85" y="352.13" fill="lightpink"/>
<rect width="11.59" height="12.64" x="511.85" y="366.99" fill="lightpink"/>
<rect width="11.59" height="12.64" x="511.85" y="366.99" fill="forestgreen"/>
<rect width="11.59" height="12.53" x="511.85" y="381.62" fill="lightpink"/>
<rect width="11.59" height="12.47" x="511.85" y="396.15" fill="forestgreen"/>
<rect width="11.59" height="12.47" x="511.85" y="410.62" fill="forestgreen"/>
@ -1463,10 +1463,10 @@
<rect width="-0.06" height="-0.07" x="694.51" y="536.07" fill="mistyrose"/>
<rect width="-0.45" height="-0.55" x="696.45" y="536.07" fill="mistyrose"/>
<rect width="-0.45" height="-1.52" x="696.45" y="537.52" fill="lightpink"/>
<rect width="12.00" height="12.00" x="0.00" y="564.50" fill="forestgreen"/><text alignment-baseline="central" x="17.00" y="570.50" style="font-family: sans-serif; font-size: 15px">Functions decompiled (count): 41.86%</text>
<rect width="12.00" height="12.00" x="0.00" y="582.50" fill="forestgreen"/><text alignment-baseline="central" x="17.00" y="588.50" style="font-family: sans-serif; font-size: 15px">Functions decompiled (bytesize): 41.38%</text>
<rect width="12.00" height="12.00" x="0.00" y="600.50" fill="lightpink"/><text alignment-baseline="central" x="17.00" y="606.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, but with known names (count): 44.05%</text>
<rect width="12.00" height="12.00" x="0.00" y="618.50" fill="lightpink"/><text alignment-baseline="central" x="17.00" y="624.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, but with known names (bytesize): 42.80%</text>
<rect width="12.00" height="12.00" x="0.00" y="564.50" fill="forestgreen"/><text alignment-baseline="central" x="17.00" y="570.50" style="font-family: sans-serif; font-size: 15px">Functions decompiled (count): 42.00%</text>
<rect width="12.00" height="12.00" x="0.00" y="582.50" fill="forestgreen"/><text alignment-baseline="central" x="17.00" y="588.50" style="font-family: sans-serif; font-size: 15px">Functions decompiled (bytesize): 41.48%</text>
<rect width="12.00" height="12.00" x="0.00" y="600.50" fill="lightpink"/><text alignment-baseline="central" x="17.00" y="606.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, but with known names (count): 43.91%</text>
<rect width="12.00" height="12.00" x="0.00" y="618.50" fill="lightpink"/><text alignment-baseline="central" x="17.00" y="624.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, but with known names (bytesize): 42.69%</text>
<rect width="12.00" height="12.00" x="0.00" y="636.50" fill="mistyrose"/><text alignment-baseline="central" x="17.00" y="642.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, with unknown names (count): 14.09%</text>
<rect width="12.00" height="12.00" x="0.00" y="654.50" fill="mistyrose"/><text alignment-baseline="central" x="17.00" y="660.50" style="font-family: sans-serif; font-size: 15px">Functions not decompiled, with unknown names (bytesize): 15.83%</text>
</svg>

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 110 KiB

Before After
Before After

View file

@ -339,7 +339,7 @@ GetFullPath 0x0041BFC0 0x00000053 +
FindCdDrive 0x0041C020 0x000000C7 +
# ???
S_Colour 0x0041C0F0 0x00000089 -
S_Colour 0x0041C0F0 0x00000089 *
S_DrawScreenSprite2d 0x0041C180 0x00000150 -
S_DrawScreenSprite 0x0041C2D0 0x00000163 *
S_DrawScreenLine 0x0041C440 0x000000D3 *
@ -403,7 +403,7 @@ DrawInventoryItem 0x0041FB40 0x000003A0 +
GetDebouncedInput ---------- ---------- +
# invfunc.cpp
InitColours 0x0041FEF0 0x0000010A *
InitColours 0x0041FEF0 0x0000010A +
RingIsOpen 0x00420000 0x0000014D *
RingIsNotOpen 0x00420150 0x00000076 *
RingNotActive 0x004201D0 0x0000069E *

View file

@ -5,7 +5,6 @@
#include <stdint.h>
// clang-format off
#define InitColours ((void (*)())0x0041FEF0)
#define RingIsOpen ((void (*)(RING_INFO* ring))0x00420000)
#define RingIsNotOpen ((void (*)(RING_INFO* ring))0x00420150)
#define RingNotActive ((void (*)(INVENTORY_ITEM* inv_item))0x004201D0)
@ -37,7 +36,9 @@ void SelectMeshes(INVENTORY_ITEM* inv_item);
int32_t AnimateInventoryItem(INVENTORY_ITEM* inv_item);
void DrawInventoryItem(INVENTORY_ITEM* inv_item);
int32_t GetDebouncedInput(int32_t input);
void InitColours();
void T1MInjectGameInvEntry();
void T1MInjectGameInvFunc();
#endif

View file

@ -849,9 +849,11 @@ void DrawInventoryItem(INVENTORY_ITEM* inv_item)
phd_RotYXZpack(*packed_rotation++);
if (inv_item->object_number == O_MAP_OPTION && i == 1) {
CompassSpeed = CompassSpeed * 19 / 20 +
(int16_t)(-inv_item->y_rot - LaraItem->pos.y_rot - CompassNeedle)
/ 50;
CompassSpeed = CompassSpeed * 19 / 20
+ (int16_t)(
-inv_item->y_rot - LaraItem->pos.y_rot
- CompassNeedle)
/ 50;
CompassNeedle += CompassSpeed;
phd_RotY(CompassNeedle);
}

23
src/game/invfunc.c Normal file
View file

@ -0,0 +1,23 @@
#include "game/vars.h"
#include "specific/shed.h"
#include "util.h"
void InitColours()
{
InvColours[IC_BLACK] = S_Colour(0, 0, 0);
InvColours[IC_GREY] = S_Colour(64, 64, 64);
InvColours[IC_WHITE] = S_Colour(255, 255, 255);
InvColours[IC_RED] = S_Colour(255, 0, 0);
InvColours[IC_ORANGE] = S_Colour(255, 128, 0);
InvColours[IC_YELLOW] = S_Colour(255, 255, 0);
InvColours[IC_DARKGREEN] = S_Colour(0, 128, 0);
InvColours[IC_GREEN] = S_Colour(0, 255, 0);
InvColours[IC_CYAN] = S_Colour(0, 255, 255);
InvColours[IC_BLUE] = S_Colour(0, 0, 255);
InvColours[IC_MAGENTA] = S_Colour(255, 0, 255);
}
void T1MInjectGameInvFunc()
{
INJECT(0x0041FEF0, InitColours);
}

View file

@ -724,6 +724,27 @@ typedef enum {
SHAPE_FBOX = 4
} SHAPE;
typedef enum {
IC_BLACK = 0,
IC_GREY = 1,
IC_WHITE = 2,
IC_RED = 3,
IC_ORANGE = 4,
IC_YELLOW = 5,
IC_GREEN1 = 6,
IC_GREEN2 = 7,
IC_GREEN3 = 8,
IC_GREEN4 = 9,
IC_GREEN5 = 10,
IC_GREEN6 = 11,
IC_DARKGREEN = 12,
IC_GREEN = 13,
IC_CYAN = 14,
IC_BLUE = 15,
IC_MAGENTA = 16,
IC_NUMBER_OF = 17,
} INV_COLOUR;
#pragma pack(push, 1)
typedef struct {

View file

@ -197,6 +197,7 @@ extern char TextStrings[MAX_TEXT_STRINGS][MAX_STRING_SIZE];
#define Inv_UpArrow2 VAR_U_(0x0045A060, TEXTSTRING*)
#define InventoryMode VAR_I_(0x0045632C, int16_t, INV_TITLE_MODE)
#define InventoryDisplaying VAR_U_(0x0045A078, int16_t)
#define InvColours ARRAY_(0x0045EE80, int16_t, [IC_NUMBER_OF])
#define CompassStatus VAR_U_(0x0045A0A4, int16_t)
#define CompassSpeed VAR_U_(0x0045A0A8, int16_t)
#define CompassNeedle VAR_U_(0x0045A0AC, int16_t)

View file

@ -47,6 +47,7 @@ void T1MInject()
T1MInjectGameGame();
T1MInjectGameHealth();
T1MInjectGameInvEntry();
T1MInjectGameInvFunc();
T1MInjectGameItems();
T1MInjectGameLOT();
T1MInjectGameLara();

View file

@ -24,6 +24,7 @@
#define S_DrawSpriteRel ((void (*)(int32_t x, int32_t y, int32_t z, int16_t sprnum, int16_t shade))0x00435B70)
#define S_DrawScreenSprite ((void (*)(int32_t sx, int32_t sy, int32_t z, int32_t scale_h, int32_t scale_v, int16_t sprnum, int16_t shade, uint16_t flags))0x0041C2D0)
#define S_DrawScreenLine ((void (*)(int32_t sx, int32_t sy, int32_t z, int32_t w, int32_t h, int32_t col, SG_COL* grdptr, uint16_t flags))0x0041C440)
#define S_Colour ((SG_COL (*)(int32_t red, int32_t green, int32_t blue))0x0041C0F0)
// clang-format on
#endif