Skip to content

Commit 0081b02

Browse files
authored
Implement parts shop (#151)
* Change type of last argument of TransBrPixelmapText from 'signed char*' to 'char*' * Implement parts shop
1 parent 561e369 commit 0081b02

File tree

6 files changed

+448
-56
lines changed

6 files changed

+448
-56
lines changed

src/DETHRACE/common/displays.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1541,7 +1541,7 @@ void OoerrIveGotTextInMeBoxMissus(int pFont_index, char* pText, br_pixelmap* pPi
15411541
}
15421542

15431543
// IDA: void __usercall TransBrPixelmapText(br_pixelmap *pPixelmap@<EAX>, int pX@<EDX>, int pY@<EBX>, br_uint_32 pColour@<ECX>, br_font *pFont, signed char *pText)
1544-
void TransBrPixelmapText(br_pixelmap* pPixelmap, int pX, int pY, br_uint_32 pColour, br_font* pFont, signed char* pText) {
1544+
void TransBrPixelmapText(br_pixelmap* pPixelmap, int pX, int pY, br_uint_32 pColour, br_font* pFont, char* pText) {
15451545
int len;
15461546
LOG_TRACE("(%p, %d, %d, %d, %p, %p)", pPixelmap, pX, pY, pColour, pFont, pText);
15471547

src/DETHRACE/common/displays.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void DrawRRectangle(br_pixelmap* pPixelmap, int pLeft, int pTop, int pRight, int
118118

119119
void OoerrIveGotTextInMeBoxMissus(int pFont_index, char* pText, br_pixelmap* pPixelmap, int pLeft, int pTop, int pRight, int pBottom, int pCentred);
120120

121-
void TransBrPixelmapText(br_pixelmap* pPixelmap, int pX, int pY, br_uint_32 pColour, br_font* pFont, signed char* pText);
121+
void TransBrPixelmapText(br_pixelmap* pPixelmap, int pX, int pY, br_uint_32 pColour, br_font* pFont, char* pText);
122122

123123
void TransDRPixelmapText(br_pixelmap* pPixelmap, int pX, int pY, tDR_font* pFont, char* pText, int pRight_edge);
124124

src/DETHRACE/common/init.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ void InitRace() {
529529
ResetRecoveryVouchers();
530530
gMap_mode = 0;
531531
gProgram_state.cockpit_image_index = 0;
532-
if (gNet_mode) {
532+
if (gNet_mode != eNet_mode_none) {
533533
gNet_cash_headup = NewTextHeadupSlot(13, 0, 0, -6, "");
534534
gNet_ped_headup = NewTextHeadupSlot(14, 0, 0, -6, "");
535535
} else {

src/DETHRACE/common/loading.c

+24-2
Original file line numberDiff line numberDiff line change
@@ -2748,15 +2748,37 @@ void LoadParts() {
27482748
int i;
27492749
int j;
27502750
LOG_TRACE("()");
2751-
NOT_IMPLEMENTED();
2751+
2752+
for (i = 0; i < eParts_count; i++) {
2753+
for (j = 0; j < gProgram_state.current_car.power_ups[i].number_of_parts; j++) {
2754+
if (gProgram_state.current_car.power_ups[i].info[j].data_ptr == NULL) {
2755+
PossibleService();
2756+
if (!LoadFlicData(
2757+
gProgram_state.current_car.power_ups[i].info[j].part_name,
2758+
&gProgram_state.current_car.power_ups[i].info[j].data_ptr,
2759+
&gProgram_state.current_car.power_ups[i].info[j].data_length)) {
2760+
FatalError(58);
2761+
}
2762+
} else {
2763+
MAMSLock((void**)&gProgram_state.current_car.power_ups[i].info[j].data_ptr);
2764+
}
2765+
}
2766+
}
27522767
}
27532768

27542769
// IDA: void __cdecl UnlockParts()
27552770
void UnlockParts() {
27562771
int i;
27572772
int j;
27582773
LOG_TRACE("()");
2759-
NOT_IMPLEMENTED();
2774+
2775+
for (i = 0; i < eParts_count; i++) {
2776+
for (j = 0; j < gProgram_state.current_car.power_ups[i].number_of_parts; j++) {
2777+
if (gProgram_state.current_car.power_ups[i].info[j].data_ptr != NULL) {
2778+
MAMSUnlock((void**)&gProgram_state.current_car.power_ups[i].info[j].data_ptr);
2779+
}
2780+
}
2781+
}
27602782
}
27612783

27622784
// IDA: br_pixelmap* __cdecl LoadChromeFont()

0 commit comments

Comments
 (0)