mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
DrawTextToScreen takes STR16, a mutable wchar_t*, for a string it only
measures and prints. Quest Debug System.cpp picks its text with a conditional:
DrawTextToScreen( gubFact[ usLoop1 ] ? L"True" : L"False", ... );
which has type const wchar_t*. clang-cl's MSVC compatibility lets a bare
string literal decay to wchar_t*, but not a const wchar_t* expression, so it
reports
error: no matching function for call to 'DrawTextToScreen'
note: candidate function not viable: 1st argument ('const wchar_t *')
would lose const qualifier
The parameter is const-correct in every function DrawTextToScreen hands the
string on to, so the change follows the string down the call chain rather
than stopping at the top:
DrawTextToScreen, ShadowText Utils/WordWrap.h
WFStringPixLength Utils/Font Control.h
mprintf, StringPixLength, sgp/Font.h
VarFindFontCenterCoordinates,
VarFindFontRightCoordinates
WinFontStringPixLength sgp/WinFont.h
gprintfdirty TileEngine/Render Dirty.h
The varargs members of that list copy the format string into a local buffer
before doing anything with it, and the measuring ones walk it and return a
width; none of the nine assigns through the parameter. Where StringPixLength
casts the string to UINT16* to walk it, the cast and the local now carry the
const rather than dropping it.
Callers are unaffected: every one already passes something that converts to
const CHAR16*. Both configurations build with no new diagnostics, and the
parse sweep drops from 9 error sites in 7 files to 5 in 3.
To check the claim that nothing writes through these parameters, read the
nine bodies; each is short.
156 lines
4.4 KiB
C
156 lines
4.4 KiB
C
#ifndef __RENDER_DIRTY_H
|
|
#define __RENDER_DIRTY_H
|
|
|
|
//DEFINES
|
|
#define BGND_FLAG_PERMANENT 0x80000000
|
|
#define BGND_FLAG_SINGLE 0x40000000
|
|
#define BGND_FLAG_SAVE_Z 0x20000000
|
|
#define BGND_FLAG_MERC 0x10000000
|
|
#define BGND_FLAG_SAVERECT 0x08000000
|
|
#define BGND_FLAG_TOPMOST 0x04000000
|
|
#define BGND_FLAG_IGNORE_RAIN 0x00000002
|
|
#define BGND_FLAG_ANIMATED 0x00000001
|
|
|
|
#define VOVERLAY_DIRTYBYTEXT 0x00000001
|
|
#define VOVERLAY_STARTDISABLED 0x00000002
|
|
|
|
|
|
#define VOVERLAY_DESC_TEXT 0x00001000
|
|
#define VOVERLAY_DESC_DISABLED 0x00002000
|
|
#define VOVERLAY_DESC_POSITION 0x00004000
|
|
#define VOVERLAY_DESC_FONT 0x00008000
|
|
|
|
// STRUCTURES
|
|
|
|
// Callback for topmost blitters
|
|
typedef void (*OVERLAY_CALLBACK)(struct _VIDEO_OVERLAY * );
|
|
|
|
// Struct for backgrounds
|
|
typedef struct
|
|
{
|
|
BOOLEAN fAllocated;
|
|
BOOLEAN fFilled;
|
|
BOOLEAN fFreeMemory;
|
|
BOOLEAN fZBuffer;
|
|
UINT32 uiFlags;
|
|
INT16 *pSaveArea;
|
|
INT16 *pZSaveArea;
|
|
INT16 sLeft;
|
|
INT16 sTop;
|
|
INT16 sRight;
|
|
INT16 sBottom;
|
|
INT16 sWidth;
|
|
INT16 sHeight;
|
|
BOOLEAN fPendingDelete;
|
|
BOOLEAN fDisabled;
|
|
|
|
} BACKGROUND_SAVE;
|
|
|
|
// Struct for topmost blitters
|
|
typedef struct _VIDEO_OVERLAY
|
|
{
|
|
UINT32 uiFlags;
|
|
BOOLEAN fAllocated;
|
|
BOOLEAN fDisabled;
|
|
BOOLEAN fActivelySaving;
|
|
BOOLEAN fDeletionPending;
|
|
INT32 uiBackground;
|
|
BACKGROUND_SAVE *pBackground;
|
|
INT16 *pSaveArea;
|
|
UINT32 uiUserData[ 5 ];
|
|
UINT32 uiFontID;
|
|
INT16 sX;
|
|
INT16 sY;
|
|
UINT8 ubFontBack;
|
|
UINT8 ubFontFore;
|
|
CHAR16 zText[ 200 ];
|
|
UINT32 uiDestBuff;
|
|
OVERLAY_CALLBACK BltCallback;
|
|
|
|
|
|
} VIDEO_OVERLAY;
|
|
|
|
|
|
// Struct for init topmost blitter
|
|
typedef struct
|
|
{
|
|
UINT32 uiFlags;
|
|
BOOLEAN fDisabled;
|
|
INT16 sLeft;
|
|
INT16 sTop;
|
|
INT16 sRight;
|
|
INT16 sBottom;
|
|
UINT32 uiFontID;
|
|
INT16 sX;
|
|
INT16 sY;
|
|
UINT8 ubFontBack;
|
|
UINT8 ubFontFore;
|
|
CHAR16 pzText[ 200 ];
|
|
OVERLAY_CALLBACK BltCallback;
|
|
|
|
} VIDEO_OVERLAY_DESC;
|
|
|
|
|
|
// GLOBAL VARIABLES
|
|
extern SGPRect gDirtyClipRect;
|
|
|
|
|
|
|
|
// FUNCTIONS
|
|
////////////
|
|
|
|
|
|
// DIRTY QUEUE
|
|
BOOLEAN InitializeBaseDirtyRectQueue( );
|
|
void ShutdownBaseDirtyRectQueue( );
|
|
void AddBaseDirtyRect( INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom );
|
|
BOOLEAN ExecuteBaseDirtyRectQueue( );
|
|
BOOLEAN EmptyDirtyRectQueue( );
|
|
|
|
|
|
// BACKGROUND RECT BUFFERING STUFF
|
|
void DisableBackgroundRect( INT32 iIndex, BOOLEAN fDisabled );
|
|
BOOLEAN InitializeBackgroundRects(void);
|
|
BOOLEAN ShutdownBackgroundRects(void);
|
|
INT32 RegisterBackgroundRect(UINT32 uiFlags, INT16 *pSaveArea, INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom);
|
|
BOOLEAN FreeBackgroundRect(INT32 iIndex);
|
|
BOOLEAN FreeBackgroundRectPending(INT32 iIndex);
|
|
BOOLEAN FreeBackgroundRectType(UINT32 uiFlags);
|
|
BOOLEAN RestoreBackgroundRects(void);
|
|
BOOLEAN SaveBackgroundRects(void);
|
|
BOOLEAN InvalidateBackgroundRects(void);
|
|
BOOLEAN UpdateSaveBuffer(void);
|
|
BOOLEAN RestoreExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 sHeight );
|
|
BOOLEAN RestoreExternBackgroundRect(SGPRectangle rect);
|
|
void SetBackgroundRectFilled( UINT32 uiBackgroundID );
|
|
BOOLEAN EmptyBackgroundRects( void );
|
|
|
|
|
|
// GPRINTF DIRTY STUFF
|
|
UINT16 gprintfdirty(INT16 x, INT16 y, const CHAR16* pFontString, ...);
|
|
UINT16 gprintfinvalidate(INT16 x, INT16 y, STR16 pFontString, ...);
|
|
UINT16 gprintfRestore(INT16 x, INT16 y, STR16 pFontString, ...);
|
|
|
|
|
|
// VIDEO OVERLAY STUFF
|
|
INT32 GetFreeVideoOverlay(void);
|
|
void RecountVideoOverlays(void);
|
|
INT32 RegisterVideoOverlay( UINT32 uiFlags, VIDEO_OVERLAY_DESC *pTopmostDesc );
|
|
void ExecuteVideoOverlays( );
|
|
BOOLEAN UpdateVideoOverlay( VIDEO_OVERLAY_DESC *pTopmostDesc, UINT32 iBlitterIndex, BOOLEAN fForceAll );
|
|
void SaveVideoOverlaysArea( UINT32 uiSrcBuffer );
|
|
void DeleteVideoOverlaysArea( );
|
|
void AllocateVideoOverlaysArea( );
|
|
void ExecuteVideoOverlaysToAlternateBuffer( UINT32 uiNewDestBuffer );
|
|
void RemoveVideoOverlay( INT32 iVideoOverlay );
|
|
BOOLEAN RestoreShiftedVideoOverlays( INT16 sShiftX, INT16 sShiftY );
|
|
BOOLEAN SetOverlayUserData( INT32 iVideoOverlay, UINT8 ubNum, UINT32 uiData );
|
|
void EnableVideoOverlay( BOOLEAN fEnable, INT32 iOverlayIndex );
|
|
|
|
|
|
void BlitMFont( VIDEO_OVERLAY *pBlitter );
|
|
|
|
BOOLEAN BlitBufferToBuffer(UINT32 uiSrcBuffer, UINT32 uiDestBuffer, UINT16 usSrcX, UINT16 usSrcY, UINT16 usWidth, UINT16 usHeight);
|
|
|
|
#endif
|