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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ if(REC2_MATCHING)

set(CMAKE_C_FLAGS "/W3 /GX /DWIN32 /D_WINDOWS")
set(CMAKE_C_FLAGS_DEBUG "/Gm /Od /D_DEBUG /MLd")
set(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /DNDEBUG /ML")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/O2 /Ob2 /DNDEBUG /ML")
set(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /G5 /DNDEBUG /ML")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/O2 /Ob2 /G5 /DNDEBUG /ML")
set(CMAKE_C_FLAGS_MINSIZEREL "/Os /DNDEBUG /ML")

set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
Expand Down
12 changes: 6 additions & 6 deletions src/carma2/common/frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -2410,7 +2410,7 @@ void C2_HOOK_FASTCALL KillAPOactor(br_actor* pActor) {
}

// FUNCTION: CARMA2_HW 0x00518fa0
void C2_HOOK_FASTCALL MungeMetaCharacters(char* pText, char pKey, char* pRepl) {
void C2_HOOK_FASTCALL MungeMetaCharacters(char* pText, char pMeta, const char* pRepl) {
size_t len_text;
size_t len_repl;
size_t i;
Expand All @@ -2419,7 +2419,7 @@ void C2_HOOK_FASTCALL MungeMetaCharacters(char* pText, char pKey, char* pRepl) {
len_repl = strlen(pRepl);

for (i = 0; i < len_text; i++) {
if (pText[i] == '@' && pText[i + 1] == pKey) {
if (pText[i] == '@' && pText[i + 1] == pMeta) {
memmove(&pText[i + len_repl], &pText[i + 2], len_text - i - 1);
memcpy(&pText[i], pRepl, len_repl);
i += len_repl;
Expand All @@ -2429,17 +2429,17 @@ void C2_HOOK_FASTCALL MungeMetaCharacters(char* pText, char pKey, char* pRepl) {
}

// FUNCTION: CARMA2_HW 0x00519040
void C2_HOOK_FASTCALL MungeMetaCharactersChar(char* pText, char pKey, char pChar) {
void C2_HOOK_FASTCALL MungeMetaCharactersChar(char* pText, char pMeta, char pChar) {

MungeMetaCharacters(pText, pKey, &pChar);
MungeMetaCharacters(pText, pMeta, &pChar);
}

// FUNCTION: CARMA2_HW 0x005190f0
void C2_HOOK_FASTCALL MungeMetaCharactersNum(char* pText, char pKey, int pNum) {
void C2_HOOK_FASTCALL MungeMetaCharactersNum(char* pText, char pMeta, int pNum) {
char text[16];

sprintf(text, "%d", pNum);
MungeMetaCharacters(pText, pKey, text);
MungeMetaCharacters(pText, pMeta, text);
}

void C2_HOOK_FASTCALL DrPixelmapRectangleCopyPossibleLock(br_pixelmap* dst, br_int_32 dx, br_int_32 dy, br_pixelmap* src, br_int_32 sx, br_int_32 sy, br_int_32 w, br_int_32 h) {
Expand Down
8 changes: 4 additions & 4 deletions src/carma2/common/frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ br_actor* C2_HOOK_FASTCALL CreateAPOactor(void);

void C2_HOOK_FASTCALL KillAPOactor(br_actor* pActor);

void C2_HOOK_FASTCALL MungeMetaCharacters(char* pText, char pKey, char* pRepl);
void C2_HOOK_FASTCALL MungeMetaCharacters(char* pText, char pMeta, const char* pRepl);

void C2_HOOK_FASTCALL MungeMetaCharactersChar(char* pText, char pKey, char pChar);
void C2_HOOK_FASTCALL MungeMetaCharactersChar(char* pText, char pMeta, char pChar);

void C2_HOOK_FASTCALL MungeMetaCharactersNum(char* pText, char pKey, int pNum);
void C2_HOOK_FASTCALL MungeMetaCharactersNum(char* pText, char pMeta, int pNum);

void C2_HOOK_FASTCALL DrPixelmapRectangleCopyPossibleLock(br_pixelmap* dst, br_int_32 dx, br_int_32 dy, br_pixelmap* src, br_int_32 sx, br_int_32 sy, br_int_32 w, br_int_32 h);

Expand Down Expand Up @@ -204,4 +204,4 @@ void C2_HOOK_FASTCALL SelectThisItemIn(tFrontend_spec* pFrontend, int pGroup, in

int C2_HOOK_FASTCALL WhichItemIsSelectedIn(tFrontend_spec* pFrontend, int pGroup);

#endif //REC2_FRONTEND_H
#endif //REC2_FRONTEND_H
2 changes: 1 addition & 1 deletion src/carma2/common/globvars.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ int gMap_view;


// GLOBAL: CARMA2_HW 0x0074cadc
int gScreen_lock_often;
int gLock_often;

// GLOBAL: CARMA2_HW 0x0074ca0c
int gShadow_workaround;
Expand Down
2 changes: 1 addition & 1 deletion src/carma2/common/globvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ extern char gQuick_time_movie_path_stub[256];
extern int gNet_last_game_type;
extern int gMap_view;

extern int gScreen_lock_often;
extern int gLock_often;
extern int gShadow_workaround;
extern int gEnable_texture_interpolation;
extern int gEnable_texture_antialiasing;
Expand Down
7 changes: 2 additions & 5 deletions src/carma2/newcommon/17-world2.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,9 @@ void C2_HOOK_FASTCALL RevealStoredTransparentTextures(tBrender_storage* pStorage
int i;

for (i = 0; i < pStorage->materials_count; i++) {
br_pixelmap* colour_map;

colour_map = pStorage->materialProps[i];

if (colour_map != NULL && DRPixelmapHasZeros(colour_map)) {
pStorage->materials[i]->colour_map = colour_map;
if (pStorage->materialProps[i] != NULL && DRPixelmapHasZeros(pStorage->materialProps[i])) {
pStorage->materials[i]->colour_map = pStorage->materialProps[i];
pStorage->materialProps[i] = NULL;
pStorage->materials[i]->flags |= BR_MATF_PRELIT;
BrMaterialUpdate(pStorage->materials[i], BR_MATU_ALL);
Expand Down
92 changes: 88 additions & 4 deletions src/carma2/newcommon/18-graphics2.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,97 @@ br_pixelmap* gPalette_0074a5fc;
// GLOBAL: CARMA2_HW 0x0074a670
br_pixelmap* gPalette_0074a670;

// DRSetPaletteEntries
// GLOBAL: CARMA2_HW 0x0074cf04
int gPalette_changed;

// GLOBAL: CARMA2_HW 0x006923c0
int gPalette_munged;

// GLOBAL: CARMA2_HW 0x0074a680
char* gCurrent_palette_pixels;

// GLOBAL: CARMA2_HW 0x006923c8
int gFaded_palette;

// GLOBAL: CARMA2_HW 0x0074a678
br_pixelmap* gCurrent_palette;

// GLOBAL: CARMA2_HW 0x006923ac
br_pixelmap* gOrig_render_palette;

// GLOBAL: CARMA2_HW 0x0074a67c
br_pixelmap* gFlic_palette;

// GLOBAL: CARMA2_HW 0x006923b8
br_colour* gScratch_pixels;

// GLOBAL: CARMA2_HW 0x006923a8
br_pixelmap* gScratch_palette;

// GLOBAL: CARMA2_HW 0x0074a660
br_pixelmap* gMini_map_glowing_line_palettes[3];

// GLOBAL: CARMA2_HW 0x0074a5fc
br_pixelmap* gPalette_0074a5fc;

// GLOBAL: CARMA2_HW 0x0074a600
br_pixelmap* gPalette_0074a600;

// GLOBAL: CARMA2_HW 0x0074a604
br_pixelmap* gPalette_0074a604;

// DRSetPalette3
// GLOBAL: CARMA2_HW 0x0074a66c
br_pixelmap* gPalette_0074a66c;

// GLOBAL: CARMA2_HW 0x0074a670
br_pixelmap* gPalette_0074a670;

// FUNCTION: CARMA2_HW 0x004b4fd0
void C2_HOOK_FASTCALL DRSetPaletteEntries(br_pixelmap* pThe_palette, int pFirst_colour, int pCount) {

if (!pFirst_colour) {
((br_int_32*)pThe_palette->pixels)[0] = 0;
}
memcpy(gCurrent_palette_pixels + 4 * pFirst_colour, (char*)pThe_palette->pixels + 4 * pFirst_colour, 4 * pCount);
gPalette_changed = 0;
if (!gFaded_palette) {
PDSetPaletteEntries(pThe_palette, pFirst_colour, pCount);
}
gPalette_munged = 1;
}

// DRSetPalette2
void C2_HOOK_FASTCALL DRSetPalette3(br_pixelmap* pThe_palette, int pSet_current_palette) {

// DRSetPalette
if (pSet_current_palette) {
memcpy(gCurrent_palette_pixels, pThe_palette->pixels, 256 * sizeof(br_colour));
}
gPalette_changed = 0;
if (!gFaded_palette) {
PDSetPalette(pThe_palette);
}
if (pThe_palette != gRender_palette) {
gPalette_munged |= 0x1;
}
}

void C2_HOOK_FASTCALL DRSetPalette2(br_pixelmap* pThe_palette, int pSet_current_palette) {

((br_int_32*)pThe_palette->pixels)[0] = 0;
if (pSet_current_palette) {
memcpy(gCurrent_palette_pixels, pThe_palette->pixels, 256 * sizeof(br_colour));
}
gPalette_changed = 0;
if (!gFaded_palette) {
PDSetPalette(pThe_palette);
}
gPalette_munged |= pThe_palette != gRender_palette;
}

// FUNCTION: CARMA2_HW 0x004b5030
void C2_HOOK_FASTCALL DRSetPalette(br_pixelmap* pThe_palette) {

DRSetPalette2(pThe_palette, 1);
}

// FUNCTION: CARMA2_HW 0x004b5090
void C2_HOOK_FASTCALL InitializePalettes(void) {
Expand Down
8 changes: 4 additions & 4 deletions src/carma2/newcommon/18-graphics2.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ extern int gNoTransients;
extern br_pixelmap* gRender_palette;
extern int gDim_amount;

// DRSetPaletteEntries
extern void C2_HOOK_FASTCALL DRSetPaletteEntries(br_pixelmap* pThe_palette, int pFirst_colour, int pCount);

// DRSetPalette3
extern void C2_HOOK_FASTCALL DRSetPalette3(br_pixelmap* pThe_palette, int pSet_current_palette);

// DRSetPalette2
extern void C2_HOOK_FASTCALL DRSetPalette2(br_pixelmap* pThe_palette, int pSet_current_palette);

// DRSetPalette
extern void C2_HOOK_FASTCALL DRSetPalette(br_pixelmap* pThe_palette);

extern void C2_HOOK_FASTCALL InitializePalettes(void);

Expand Down
Loading
Loading