Skip to content

Commit

Permalink
Add font rendering support for G1 & change default settings
Browse files Browse the repository at this point in the history
- Add font rendering support for G1
- Enable font rendering by default
- Disable normalmaps by default
  • Loading branch information
SaiyansKing committed Nov 24, 2022
1 parent a91e463 commit adb5caa
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 12 deletions.
4 changes: 2 additions & 2 deletions D3D11Engine/GothicGraphicsState.h
Expand Up @@ -658,11 +658,11 @@ struct GothicRendererSettings {
//DisableEverything();

LimitLightIntesity = false;
AllowNormalmaps = true;
AllowNormalmaps = false;

AllowNumpadKeys = false;
EnableDebugLog = true;
EnableCustomFontRendering = false;
EnableCustomFontRendering = true;

ForceFOV = false;

Expand Down
9 changes: 6 additions & 3 deletions D3D11Engine/GothicMemoryLocations1_08k.h
Expand Up @@ -19,6 +19,7 @@ struct GothicMemoryLocations {
static const unsigned int s_globFreePart = 0x00874374;
static const unsigned int zCOption = 0x00869694;
static const unsigned int zRenderer = 0x008C5ED0;
static const unsigned int screen = 0x008DE1BC;
static const unsigned int sysEvents = 0x004F6AC0;
};

Expand Down Expand Up @@ -467,9 +468,11 @@ struct GothicMemoryLocations {
static const unsigned int REPL_SetMode_ModechangeStart = 0x007021A9;
static const unsigned int REPL_SetMode_ModechangeEnd = 0x0007021B8;
static const unsigned int PrintTimed = 0x006FE1A0;

static const unsigned int PrintChars = 0x006fff80;
static const unsigned int CreateText = 0x007006e0;
static const unsigned int PrintChars = 0x006FFF80;
static const unsigned int CreateText = 0x007006E0;
static const unsigned int BlitText = 0x006FC7B0;
static const unsigned int Print = 0x006FFEB0;
static const unsigned int Blit = 0x006FC8C0;
};

struct zCVobLight {
Expand Down
4 changes: 2 additions & 2 deletions D3D11Engine/GothicMemoryLocations2_6_fix.h
Expand Up @@ -285,10 +285,10 @@ struct GothicMemoryLocations {
static const unsigned int DInput7DeviceKeyboard = 0x008D1D64;
static const unsigned int zCInput = 0x008D1650;
static const unsigned int zCOption = 0x008CD988;
static const unsigned int zCParser = 0xAB40C0;
static const unsigned int zCParser = 0x00AB40C0;
static const unsigned int zRenderer = 0x00982F08;
static const unsigned int zSound = 0x0099B03C;
static const unsigned int screen = 0x00ab6468;
static const unsigned int screen = 0x00AB6468;
static const unsigned int sysEvents = 0x005053E0;

static const unsigned int NOP_FreelookWindowedCheckStart = 0x004816D7;
Expand Down
6 changes: 3 additions & 3 deletions D3D11Engine/zCView.h
Expand Up @@ -34,7 +34,7 @@ class zCView {
REPLACE_RANGE( GothicMemoryLocations::zCView::REPL_SetMode_ModechangeStart, GothicMemoryLocations::zCView::REPL_SetMode_ModechangeEnd - 1, INST_NOP );
}

#if BUILD_GOTHIC_2_6_fix
#if (defined(BUILD_GOTHIC_1_08k) && !defined(BUILD_1_12F)) || defined(BUILD_GOTHIC_2_6_fix)
// .text:007A62A0; void __thiscall zCView::BlitText(zCView * __hidden this)
XHook( HookedFunctions::OriginalFunctions.original_zCViewBlitText, GothicMemoryLocations::zCView::BlitText, hooked_BlitText );
XHook( HookedFunctions::OriginalFunctions.original_zCViewPrint, GothicMemoryLocations::zCView::Print, hooked_Print );
Expand All @@ -52,7 +52,7 @@ class zCView {
( GothicMemoryLocations::zCView::SetMode )( x, y, bpp, nullptr );
}

#if BUILD_GOTHIC_2_6_fix
#if (defined(BUILD_GOTHIC_1_08k) && !defined(BUILD_1_12F)) || defined(BUILD_GOTHIC_2_6_fix)
/*
static void __fastcall hooked_Blit(_zCView* thisptr, void* unknwn) {
Expand Down Expand Up @@ -131,7 +131,7 @@ class zCView {
x = static_cast<float>(thisptr->pposx + thisptr->nax( text->posx ));
y = static_cast<float>(thisptr->pposy + thisptr->nay( text->posy ));

if ( !thisptr->font ) continue;
if ( !text->font ) continue;

Engine::GraphicsEngine->DrawString( text->text.ToChar(), x, y, text->font, fontColor );
}
Expand Down
12 changes: 10 additions & 2 deletions D3D11Engine/zViewTypes.h
Expand Up @@ -43,7 +43,9 @@ class _zCView {
VIEW_FX_MAX
} zTViewFX;

#ifdef BUILD_GOTHIC_2_6_fix
int m_bFillZ;
#endif
_zCView* next;
int viewID;
int flags;
Expand Down Expand Up @@ -123,12 +125,18 @@ class _zCView {
}

void _zCView::CheckAutoScroll() {
// TODO: G1 addresses!
#if defined(BUILD_GOTHIC_1_08k) && !defined(BUILD_1_12F)
reinterpret_cast<void( __fastcall* )( _zCView* )>( 0x006FC480 )( this );
#elif defined(BUILD_GOTHIC_2_6_fix)
reinterpret_cast<void( __fastcall* )( _zCView* )>( 0x007A5F60 )( this );
#endif
}
void _zCView::CheckTimedText() {
// TODO: G1 addresses!
#if defined(BUILD_GOTHIC_1_08k) && !defined(BUILD_1_12F)
reinterpret_cast<void( __fastcall* )( _zCView* )>( 0x006FE0E0 )( this );
#elif defined(BUILD_GOTHIC_2_6_fix)
reinterpret_cast<void( __fastcall* )( _zCView* )>( 0x007A7C50 )( this );
#endif
}

void _zCView::PrintChars( int x, int y, const zSTRING& str ) {
Expand Down

0 comments on commit adb5caa

Please sign in to comment.