Fix all "no-write-strings" warnings

This commit is contained in:
Gleb Mazovetskiy
2019-09-29 19:00:44 +01:00
committed by Anders Jenbo
parent d22d223ba9
commit ec329e645c
62 changed files with 187 additions and 185 deletions

View File

@@ -5,7 +5,7 @@
#define rVoid { return; }
#define rInt { return 0; }
BOOL STORMAPI SNetCreateGame(const char *pszGameName, const char *pszGamePassword, const char *pszGameStatString, DWORD dwGameType, char *GameTemplateData, int GameTemplateSize, int playerCount, char *creatorName, char *a11, int *playerID) rBool;
BOOL STORMAPI SNetCreateGame(const char *pszGameName, const char *pszGamePassword, const char *pszGameStatString, DWORD dwGameType, char *GameTemplateData, int GameTemplateSize, int playerCount, const char *creatorName, const char *a11, int *playerID) rBool;
BOOL STORMAPI SNetDestroy() rBool;
BOOL STORMAPI SNetDropPlayer(int playerid, DWORD flags) rBool;
@@ -134,11 +134,11 @@ BOOL STORMAPI SGdiSetPitch(int pitch) rBool;
BOOL STORMAPI Ordinal393(char *string, int, int) rBool;
void *STORMAPI SMemAlloc(size_t amount, char *logfilename, int logline, int defaultValue) rPVoid;
void *STORMAPI SMemAlloc(size_t amount, const char *logfilename, int logline, int defaultValue) rPVoid;
BOOL STORMAPI SMemFree(void *location, char *logfilename, int logline, char defaultValue) rBool;
BOOL STORMAPI SMemFree(void *location, const char *logfilename, int logline, char defaultValue) rBool;
void* STORMAPI SMemReAlloc(void *location, size_t amount, char *logfilename, int logline, char defaultValue) rPVoid;
void* STORMAPI SMemReAlloc(void *location, size_t amount, const char *logfilename, int logline, char defaultValue) rPVoid;
BOOL STORMAPI SRegLoadData(const char *keyname, const char *valuename, int size, LPBYTE lpData, BYTE flags, LPDWORD lpcbData) rBool;
BOOL STORMAPI SRegLoadString(const char *keyname, const char *valuename, BYTE flags, char *buffer, size_t buffersize) rBool;
@@ -169,7 +169,7 @@ BOOL STORMAPI STransCreateI(void *pBuffer, int width, int height, int bpp, int a
BOOL STORMAPI SVidDestroy() rBool;
BOOL STORMAPI SVidGetSize(HANDLE video, int width, int height, int zero) rBool;
BOOL STORMAPI SVidInitialize(HANDLE video) rBool;
BOOL STORMAPI SVidPlayBegin(char *filename, int a2, int a3, int a4, int a5, int flags, HANDLE *video) rBool;
BOOL STORMAPI SVidPlayBegin(const char *filename, int a2, int a3, int a4, int a5, int flags, HANDLE *video) rBool;
BOOL STORMAPI SVidPlayContinueSingle(HANDLE video, int a2, int a3) rBool;
BOOL STORMAPI SVidPlayEnd(HANDLE video) rBool;
@@ -224,7 +224,7 @@ int STORMAPI SBigPowMod(void *buffer1, void *buffer2, int a3, int a4) rInt;
int STORMAPI SBigToBinaryBuffer(void *buffer, int length, int a3, int a4) rInt;
//
void __stdcall SDrawMessageBox(char *,char *,int) rVoid;
void __stdcall SDrawMessageBox(const char *,const char *,int) rVoid;
void __cdecl SDrawDestroy(void) rVoid;
BOOLEAN __cdecl StormDestroy(void) rBool;
BOOL __stdcall SFileSetBasePath(char *) rBool;

View File

@@ -97,7 +97,7 @@ struct CCritSect {
extern "C" {
#endif
BOOL STORMAPI SNetCreateGame(const char *pszGameName, const char *pszGamePassword, const char *pszGameStatString, DWORD dwGameType, char *GameTemplateData, int GameTemplateSize, int playerCount, char *creatorName, char *a11, int *playerID);
BOOL STORMAPI SNetCreateGame(const char *pszGameName, const char *pszGamePassword, const char *pszGameStatString, DWORD dwGameType, char *GameTemplateData, int GameTemplateSize, int playerCount, const char *creatorName, const char *a11, int *playerID);
BOOL STORMAPI SNetDestroy();
/* SNetDropPlayer @ 106
@@ -828,7 +828,7 @@ void *
STORMAPI
SMemAlloc(
unsigned int amount,
char *logfilename,
const char *logfilename,
int logline,
int defaultValue);
@@ -851,7 +851,7 @@ BOOL
STORMAPI
SMemFree(
void *location,
char *logfilename,
const char *logfilename,
int logline,
char defaultValue);
@@ -878,7 +878,7 @@ STORMAPI
SMemReAlloc(
void *location,
unsigned int amount,
char *logfilename,
const char *logfilename,
int logline,
char defaultValue);
@@ -932,7 +932,7 @@ BOOL STORMAPI STransCreateI(void *pBuffer, int width, int height, int bpp, int a
BOOL STORMAPI SVidDestroy();
BOOL STORMAPI SVidGetSize(HANDLE video, int width, int height, int zero);
BOOL STORMAPI SVidInitialize(HANDLE video);
BOOL STORMAPI SVidPlayBegin(char *filename, int a2, int a3, int a4, int a5, int flags, HANDLE *video);
BOOL STORMAPI SVidPlayBegin(const char *filename, int a2, int a3, int a4, int a5, int flags, HANDLE *video);
BOOL STORMAPI SVidPlayContinueSingle(HANDLE video, int a2, int a3);
BOOL STORMAPI SVidPlayEnd(HANDLE video);
@@ -1320,7 +1320,7 @@ int STORMAPI SBigPowMod(void *buffer1, void *buffer2, int a3, int a4);
int STORMAPI SBigToBinaryBuffer(void *buffer, int length, int a3, int a4);
void __stdcall SDrawMessageBox(char *,char *,int);
void __stdcall SDrawMessageBox(const char *,const char *,int);
void __cdecl SDrawDestroy(void);
BOOLEAN __cdecl StormDestroy(void);
BOOL __stdcall SFileSetBasePath(char *);

View File

@@ -369,4 +369,4 @@ HANDLE titlePHTrans[30];
int Title_cpp_float; // weak
int titleTransIdx; // weak
int titlesnd_cpp_float; // weak
void(__stdcall *gfnSoundFunction)(char *file);
void(__stdcall *gfnSoundFunction)(const char *file);

View File

@@ -423,10 +423,10 @@ void __cdecl SelHero_cpp_init();
void __fastcall SelHero_SetStaticBMP(HWND hWnd, int adjust_size);
void __fastcall SelHero_PrintHeroInfo(HWND hWnd, _uiheroinfo *pInfo);
void __fastcall SelHero_SetStringWithMsg(HWND hWnd, const char *str);
BOOL __fastcall SelHero_IsNameReserved(char *name);
BOOL __fastcall SelHero_IsNameReserved(const char *name);
void __fastcall SelHero_SetLastNamePos(char *name);
BOOL __fastcall SelHero_NameHasChar(char *name, char *illegalchrs);
BOOL __fastcall UiValidPlayerName(char *name);
BOOL __fastcall SelHero_NameHasChar(const char *name, char *illegalchrs);
BOOL __fastcall UiValidPlayerName(const char *name);
BOOL __stdcall UiSelHeroMultDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninfofunc)(_uiheroinfo *)), BOOL(__stdcall *fncreate)(_uiheroinfo *), BOOL(__stdcall *fnremove)(_uiheroinfo *), BOOL(__stdcall *fnstats)(int, _uidefaultstats *), int *dlgresult, int *a6, char *name);
LRESULT __stdcall SelHero_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
void __fastcall SelHero_DoStuffWithStrings(HWND hWnd);
@@ -595,7 +595,7 @@ void __fastcall Title_KillTimerAndFree(HWND hWnd);
void __fastcall Title_LoadAllTitleImgs(HWND hWnd, int time);
void __fastcall Title_KillAndFadeDlg(HWND hWnd);
void __fastcall TitleSnd_SetSoundFunction(void(__stdcall *func)(char *file));
void __fastcall TitleSnd_SetSoundFunction(void(__stdcall *func)(const char *file));
void __cdecl TitleSnd_InitSoundFunc();
void __cdecl TitleSnd_PlayMoveSound();
void __cdecl TitleSnd_PlaySelectSound();

View File

@@ -13,7 +13,7 @@ struct FontStruct {
};
struct ProfileStruct {
char *name;
const char *name;
char field_4;
int msg;
int field_C;
@@ -21,7 +21,7 @@ struct ProfileStruct {
struct ProfFntStruct {
int size;
char *fontname;
const char *fontname;
int field_8;
};
@@ -31,12 +31,12 @@ void __stdcall UiSetSpawned(BOOL bSpawned);
void __stdcall UiInitialize();
BOOL __stdcall UiCopyProtError(int *pdwResult);
void __stdcall UiAppActivate(BOOL bActive);
BOOL __fastcall UiValidPlayerName(char *name); /* check __stdcall */
BOOL __fastcall UiValidPlayerName(const char *name); /* check __stdcall */
BOOL __stdcall UiSelHeroMultDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninfofunc)(_uiheroinfo *)), BOOL(__stdcall *fncreate)(_uiheroinfo *), BOOL(__stdcall *fnremove)(_uiheroinfo *), BOOL(__stdcall *fnstats)(unsigned int, _uidefaultstats *), int *dlgresult, BOOL *hero_is_created, char *name);
BOOL __stdcall UiSelHeroSingDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninfofunc)(_uiheroinfo *)), BOOL(__stdcall *fncreate)(_uiheroinfo *), BOOL(__stdcall *fnremove)(_uiheroinfo *), BOOL(__stdcall *fnstats)(unsigned int, _uidefaultstats *), int *dlgresult, char *name, int *difficulty);
BOOL __stdcall UiCreditsDialog(int a1);
BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void(__stdcall *fnSound)(char *file), int attractTimeOut);
BOOL __stdcall UiProgressDialog(HWND window, char *msg, int enable, int(*fnfunc)(), int rate);
BOOL __stdcall UiMainMenuDialog(const char *name, int *pdwResult, void(__stdcall *fnSound)(const char *file), int attractTimeOut);
BOOL __stdcall UiProgressDialog(HWND window, const char *msg, int enable, int(*fnfunc)(), int rate);
const char **__stdcall UiProfileGetString();
void __cdecl UiProfileCallback();
void __cdecl UiProfileDraw();

View File

@@ -7,7 +7,7 @@ void __cdecl MainMenu_cpp_init()
// 1002A0D4: using guessed type int mainmenu_cpp_float;
// ref: 0x1000816F
BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void(__stdcall *fnSound)(char *file), int attractTimeOut)
BOOL __stdcall UiMainMenuDialog(const char *name, int *pdwResult, void(__stdcall *fnSound)(const char *file), int attractTimeOut)
{
int v4; // eax
int v5; // esi

View File

@@ -10,7 +10,7 @@ signed int Progress_10009480() { return 0; }
// 1002A2EC: using guessed type int dword_1002A2EC;
// ref: 0x1000948B
BOOL __stdcall UiProgressDialog(HWND window, char *msg, int enable, int(*fnfunc)(), int rate) { return 0; }
BOOL __stdcall UiProgressDialog(HWND window, const char *msg, int enable, int(*fnfunc)(), int rate) { return 0; }
/* {
HWND v5; // eax
BOOL result; // eax

View File

@@ -151,7 +151,7 @@ void __fastcall SelHero_SetStringWithMsg(HWND hWnd, const char *str)
}
// ref: 0x1000BAB4
BOOL __fastcall SelHero_IsNameReserved(char *name)
BOOL __fastcall SelHero_IsNameReserved(const char *name)
{
UINT v1; // esi
BOOL result; // eax
@@ -182,7 +182,7 @@ void __fastcall SelHero_SetLastNamePos(char *name)
}
// ref: 0x1000BB34
BOOL __fastcall SelHero_NameHasChar(char *name, char *illegalchrs)
BOOL __fastcall SelHero_NameHasChar(const char *name, char *illegalchrs)
{
char v5; // al
@@ -200,7 +200,7 @@ BOOL __fastcall SelHero_NameHasChar(char *name, char *illegalchrs)
}
// ref: 0x1000BB75
BOOL __fastcall UiValidPlayerName(char *name)
BOOL __fastcall UiValidPlayerName(const char *name)
{
BOOL v2; // edi

View File

@@ -1,5 +1,5 @@
// ref: 0x10010306
void __fastcall TitleSnd_SetSoundFunction(void(__stdcall *func)(char *file))
void __fastcall TitleSnd_SetSoundFunction(void(__stdcall *func)(const char *file))
{
gfnSoundFunction = func;
}

View File

@@ -14,7 +14,7 @@ endif
# static_cast<NEW_TYPE>(reinterpret_cast<uintptr_t>(ptr))
# instead of
# (NEW_TYPE)(ptr)
CXXFLAGS=-fpermissive -Wno-write-strings
CXXFLAGS=-fpermissive
CPPFLAGS=-MMD -MF $*.d
LDLIBS=-lgdi32 -lversion -ldiabloui -lstorm
LDFLAGS=-L./ -static-libgcc -mwindows

View File

@@ -542,7 +542,7 @@ void FreeDlg()
* @param pszFmt Error message format
* @param ... Additional parameters for message format
*/
void __cdecl DrawDlg(char *pszFmt, ...)
void __cdecl DrawDlg(const char *pszFmt, ...)
{
char text[256];
va_list arglist;
@@ -569,7 +569,7 @@ void assert_fail(int nLineNo, const char *pszFile, const char *pszFail)
/**
* @brief Terminates the game with a DirectDraw assertion message box.
*/
void DDErrMsg(DWORD error_code, int log_line_nr, char *log_file_path)
void DDErrMsg(DWORD error_code, int log_line_nr, const char *log_file_path)
{
char *msg;
@@ -582,7 +582,7 @@ void DDErrMsg(DWORD error_code, int log_line_nr, char *log_file_path)
/**
* @brief Terminates the game with a DirectSound assertion message box.
*/
void DSErrMsg(DWORD error_code, int log_line_nr, char *log_file_path)
void DSErrMsg(DWORD error_code, int log_line_nr, const char *log_file_path)
{
char *msg;
@@ -641,9 +641,9 @@ static BOOL CALLBACK FuncDlg(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
/**
* @brief Terminates the game and displays an error dialog box based on the given dialog_id.
*/
void ErrDlg(int dialog_id, DWORD error_code, char *log_file_path, int log_line_nr)
void ErrDlg(int dialog_id, DWORD error_code, const char *log_file_path, int log_line_nr)
{
char *size;
const char *size;
LPARAM dwInitParam[128];
FreeDlg();
@@ -662,7 +662,7 @@ void ErrDlg(int dialog_id, DWORD error_code, char *log_file_path, int log_line_n
/**
* @brief Sets the text of the given dialog.
*/
static void TextDlg(HWND hDlg, char *text)
static void TextDlg(HWND hDlg, const char *text)
{
center_window(hDlg);
@@ -673,9 +673,9 @@ static void TextDlg(HWND hDlg, char *text)
/**
* @brief Displays a warning dialog box based on the given dialog_id and error code.
*/
void ErrOkDlg(int dialog_id, DWORD error_code, char *log_file_path, int log_line_nr)
void ErrOkDlg(int dialog_id, DWORD error_code, const char *log_file_path, int log_line_nr)
{
char *size;
const char *size;
LPARAM dwInitParam[128];
size = strrchr(log_file_path, '\\');
@@ -705,7 +705,7 @@ void FileErrDlg(const char *error)
/**
* @brief Terminates the game with an out of disk space error dialog.
*/
void DiskFreeDlg(char *error)
void DiskFreeDlg(const char *error)
{
FreeDlg();
@@ -736,7 +736,7 @@ BOOL InsertCDDlg()
/**
* @brief Terminates the game with a read-only directory error dialog.
*/
void DirErrorDlg(char *error)
void DirErrorDlg(const char *error)
{
FreeDlg();

View File

@@ -21,19 +21,19 @@ char *TraceLastError();
void __cdecl app_fatal(const char *pszFmt, ...);
void MsgBox(const char *pszFmt, va_list va);
void FreeDlg();
void __cdecl DrawDlg(char *pszFmt, ...);
void __cdecl DrawDlg(const char *pszFmt, ...);
#ifdef _DEBUG
void assert_fail(int nLineNo, const char *pszFile, const char *pszFail);
#endif
void DDErrMsg(DWORD error_code, int log_line_nr, char *log_file_path);
void DSErrMsg(DWORD error_code, int log_line_nr, char *log_file_path);
void DDErrMsg(DWORD error_code, int log_line_nr, const char *log_file_path);
void DSErrMsg(DWORD error_code, int log_line_nr, const char *log_file_path);
void center_window(HWND hDlg);
void ErrDlg(int template_id, DWORD error_code, char *log_file_path, int log_line_nr);
void TextDlg(HWND hDlg, char *text);
void ErrOkDlg(int template_id, DWORD error_code, char *log_file_path, int log_line_nr);
void ErrDlg(int template_id, DWORD error_code, const char *log_file_path, int log_line_nr);
void TextDlg(HWND hDlg, const char *text);
void ErrOkDlg(int template_id, DWORD error_code, const char *log_file_path, int log_line_nr);
void FileErrDlg(const char *error);
void DiskFreeDlg(char *error);
void DiskFreeDlg(const char *error);
BOOL InsertCDDlg();
void DirErrorDlg(char *error);
void DirErrorDlg(const char *error);
#endif /* __APPFAT_H__ */

View File

@@ -233,9 +233,9 @@ int PanBtnPos[8][5] = {
// clang-format on
};
/** Maps from panel_button_id to hotkey name. */
char *PanBtnHotKey[8] = { "'c'", "'q'", "Tab", "Esc", "'i'", "'b'", "Enter", NULL };
const char *const PanBtnHotKey[8] = { "'c'", "'q'", "Tab", "Esc", "'i'", "'b'", "Enter", NULL };
/** Maps from panel_button_id to panel button description. */
char *PanBtnStr[8] = {
const char *const PanBtnStr[8] = {
"Character Information",
"Quests log",
"Automap",
@@ -978,7 +978,7 @@ void PrintChar(int nOffset, int nCel, char col)
#endif
}
void AddPanelString(char *str, BOOL just)
void AddPanelString(const char *str, BOOL just)
{
strcpy(panelstr[pnumlines], str);
pstrjust[pnumlines] = just;
@@ -1851,10 +1851,10 @@ void PrintInfo()
}
}
void CPrintString(int y, char *str, BOOL center, int lines)
void CPrintString(int y, const char *str, BOOL center, int lines)
{
BYTE c;
char *tmp;
const char *tmp;
int strWidth, lineOffset, lineStart;
lineOffset = 0;
@@ -1883,7 +1883,7 @@ void CPrintString(int y, char *str, BOOL center, int lines)
}
}
void PrintGameStr(int x, int y, char *str, int color)
void PrintGameStr(int x, int y, const char *str, int color)
{
BYTE c;
int off;
@@ -2124,10 +2124,10 @@ void DrawChr()
/**
* @brief Identical to MY_PlrStringXY(x, y, width, pszStr, col, 1)
*/
void ADD_PlrStringXY(int x, int y, int width, char *pszStr, char col)
void ADD_PlrStringXY(int x, int y, int width, const char *pszStr, char col)
{
BYTE c;
char *tmp;
const char *tmp;
int nOffset, screen_x, line, widthOffset;
nOffset = x + PitchTbl[y + SCREEN_Y] + SCREEN_X;
@@ -2163,10 +2163,10 @@ void ADD_PlrStringXY(int x, int y, int width, char *pszStr, char col)
* @param col text_color color value
* @param base Letter spacing
*/
void MY_PlrStringXY(int x, int y, int endX, char *pszStr, char col, int base)
void MY_PlrStringXY(int x, int y, int endX, const char *pszStr, char col, int base)
{
BYTE c;
char *tmp;
const char *tmp;
int nOffset, screen_x, line, widthOffset;
nOffset = x + PitchTbl[y + SCREEN_Y] + SCREEN_X;
@@ -2520,10 +2520,10 @@ void DrawSpellBook()
}
}
void PrintSBookStr(int x, int y, BOOL cjustflag, char *pszStr, char col)
void PrintSBookStr(int x, int y, BOOL cjustflag, const char *pszStr, char col)
{
BYTE c;
char *tmp;
const char *tmp;
int screen_x, line, width;
width = PitchTbl[y] + x + RIGHT_PANEL_X + SPLICONLENGTH;
@@ -2584,9 +2584,9 @@ void CheckSBook()
#endif
}
char *get_pieces_str(int nGold)
const char *get_pieces_str(int nGold)
{
char *result;
const char *result;
result = "piece";
if (nGold != 1)

View File

@@ -65,7 +65,7 @@ void SetSpell();
void SetSpeedSpell(int slot);
void ToggleSpell(int slot);
void PrintChar(int nOffset, int nCel, char col);
void AddPanelString(char *str, BOOL just);
void AddPanelString(const char *str, BOOL just);
void ClearPanel();
void DrawPanelBox(int x, int y, int w, int h, int sx, int sy);
void InitPanelStr();
@@ -90,11 +90,11 @@ void FreeControlPan();
BOOL control_WriteStringToBuffer(BYTE *str);
void DrawInfoBox();
void PrintInfo();
void CPrintString(int y, char *str, BOOL center, int lines);
void PrintGameStr(int x, int y, char *str, int color);
void CPrintString(int y, const char *str, BOOL center, int lines);
void PrintGameStr(int x, int y, const char *str, int color);
void DrawChr();
void ADD_PlrStringXY(int x, int y, int width, char *pszStr, char col);
void MY_PlrStringXY(int x, int y, int width, char *pszStr, char col, int base);
void ADD_PlrStringXY(int x, int y, int width, const char *pszStr, char col);
void MY_PlrStringXY(int x, int y, int width, const char *pszStr, char col, int base);
void CheckLvlBtn();
void ReleaseLvlBtn();
void DrawLevelUpIcon();
@@ -105,9 +105,9 @@ int DrawDurIcon4Item(ItemStruct *pItem, int x, int c);
void RedBack();
char GetSBookTrans(int ii, BOOL townok);
void DrawSpellBook();
void PrintSBookStr(int x, int y, BOOL cjustflag, char *pszStr, char col);
void PrintSBookStr(int x, int y, BOOL cjustflag, const char *pszStr, char col);
void CheckSBook();
char *get_pieces_str(int nGold);
const char *get_pieces_str(int nGold);
void DrawGoldSplit(int amount);
void control_drop_gold(char vkey);
void control_remove_gold(int pnum, int gold_index);
@@ -134,8 +134,8 @@ extern const BYTE gbFontTransTbl[256];
extern char SpellITbl[MAX_SPELLS];
extern int PanBtnPos[8][5];
extern char *PanBtnHotKey[8];
extern char *PanBtnStr[8];
extern const char *const PanBtnHotKey[8];
extern const char *const PanBtnStr[8];
extern RECT32 ChrBtnsRect[4];
extern int SpellPages[6][7];

View File

@@ -84,14 +84,14 @@ int framestart;
/** Specifies whether players are in non-PvP mode. */
BOOL FriendlyMode = TRUE;
/** Default quick messages */
char *spszMsgTbl[4] = {
const char *const spszMsgTbl[4] = {
"I need help! Come Here!",
"Follow me.",
"Here's something for you.",
"Now you DIE!"
};
/** INI files variable names for quick message keys */
char *spszMsgHotKeyTbl[4] = { "F9", "F10", "F11", "F12" };
const char *const spszMsgHotKeyTbl[4] = { "F9", "F10", "F11", "F12" };
void FreeGameMem()
{

View File

@@ -120,7 +120,7 @@ extern int framerate;
extern int framestart;
#endif
extern BOOL FriendlyMode;
extern char *spszMsgTbl[4];
extern char *spszMsgHotKeyTbl[4];
extern const char *const spszMsgTbl[4];
extern const char *const spszMsgHotKeyTbl[4];
#endif /* __DIABLO_H__ */

View File

@@ -1252,7 +1252,7 @@ static void DRLG_InitL1Vals()
}
#ifndef SPAWN
void LoadL1Dungeon(char *sFileName, int vx, int vy)
void LoadL1Dungeon(const char *sFileName, int vx, int vy)
{
int i, j, rw, rh;
BYTE *pLevelMap, *lm;
@@ -1304,7 +1304,7 @@ void LoadL1Dungeon(char *sFileName, int vx, int vy)
mem_free_dbg(pLevelMap);
}
void LoadPreL1Dungeon(char *sFileName, int vx, int vy)
void LoadPreL1Dungeon(const char *sFileName, int vx, int vy)
{
int i, j, rw, rh;
BYTE *pLevelMap, *lm;

View File

@@ -28,8 +28,8 @@ extern int VR3;
extern BYTE *L5pSetPiece;
void DRLG_Init_Globals();
void LoadL1Dungeon(char *sFileName, int vx, int vy);
void LoadPreL1Dungeon(char *sFileName, int vx, int vy);
void LoadL1Dungeon(const char *sFileName, int vx, int vy);
void LoadPreL1Dungeon(const char *sFileName, int vx, int vy);
void CreateL5Dungeon(DWORD rseed, int entry);
#ifdef HELLFIRE
void DRLG_InitL5Vals();

View File

@@ -3364,7 +3364,7 @@ static void DRLG_InitL2Vals()
}
}
void LoadL2Dungeon(char *sFileName, int vx, int vy)
void LoadL2Dungeon(const char *sFileName, int vx, int vy)
{
int i, j, rw, rh, pc;
BYTE *pLevelMap, *lm;
@@ -3454,7 +3454,7 @@ void LoadL2Dungeon(char *sFileName, int vx, int vy)
mem_free_dbg(pLevelMap);
}
void LoadPreL2Dungeon(char *sFileName, int vx, int vy)
void LoadPreL2Dungeon(const char *sFileName, int vx, int vy)
{
int i, j, rw, rh;
BYTE *pLevelMap, *lm;

View File

@@ -18,8 +18,8 @@ extern HALLNODE *pHallList;
void InitDungeon();
void L2LockoutFix();
void L2DoorFix();
void LoadL2Dungeon(char *sFileName, int vx, int vy);
void LoadPreL2Dungeon(char *sFileName, int vx, int vy);
void LoadL2Dungeon(const char *sFileName, int vx, int vy);
void LoadPreL2Dungeon(const char *sFileName, int vx, int vy);
void CreateL2Dungeon(DWORD rseed, int entry);
/* rdata */

View File

@@ -2754,7 +2754,7 @@ void CreateL3Dungeon(DWORD rseed, int entry)
DRLG_SetPC();
}
void LoadL3Dungeon(char *sFileName, int vx, int vy)
void LoadL3Dungeon(const char *sFileName, int vx, int vy)
{
int i, j, rw, rh;
BYTE *pLevelMap, *lm;
@@ -2816,7 +2816,7 @@ void LoadL3Dungeon(char *sFileName, int vx, int vy)
mem_free_dbg(pLevelMap);
}
void LoadPreL3Dungeon(char *sFileName, int vx, int vy)
void LoadPreL3Dungeon(const char *sFileName, int vx, int vy)
{
int i, j, rw, rh;
BYTE *pLevelMap, *lm;

View File

@@ -22,8 +22,8 @@ void CreateL3Dungeon(DWORD rseed, int entry);
#ifdef HELLFIRE
BOOLEAN drlg_l3_hive_rnd_piece(const BYTE *miniset, int rndper);
#endif
void LoadL3Dungeon(char *sFileName, int vx, int vy);
void LoadPreL3Dungeon(char *sFileName, int vx, int vy);
void LoadL3Dungeon(const char *sFileName, int vx, int vy);
void LoadPreL3Dungeon(const char *sFileName, int vx, int vy);
/* rdata */
extern const BYTE L3ConvTbl[16];

View File

@@ -1152,7 +1152,7 @@ void InitMonsterSND(int monst)
void FreeMonsterSnd()
{
int mtype, i, j, k;
char *file;
const char *file;
TSnd *pSnd;
for (i = 0; i < nummtypes; i++) {
@@ -1165,7 +1165,9 @@ void FreeMonsterSnd()
file = pSnd->sound_path;
pSnd->sound_path = NULL;
sound_file_cleanup(pSnd);
mem_free_dbg(file);
// pSnd->sound_path is malloc'd (but only for monsters).
mem_free_dbg(const_cast<char *>(file));
}
}
}
@@ -1474,7 +1476,7 @@ void ui_sound_init()
priv_sound_init(sfx_UI);
}
void __stdcall effects_play_sound(char *snd_file)
void __stdcall effects_play_sound(const char *snd_file)
{
DWORD i;

View File

@@ -30,7 +30,7 @@ void effects_cleanup_sfx();
void sound_init();
void priv_sound_init(BYTE bLoadMask);
void ui_sound_init();
void __stdcall effects_play_sound(char *snd_file);
void __stdcall effects_play_sound(const char *snd_file);
/* rdata */

View File

@@ -2629,7 +2629,7 @@ void mem_free_dbg(void *p)
* @param pdwFileLen Will be set to file size if non-NULL
* @return Buffer with content of file
*/
BYTE *LoadFileInMem(char *pszName, DWORD *pdwFileLen)
BYTE *LoadFileInMem(const char *pszName, DWORD *pdwFileLen)
{
HANDLE file;
BYTE *buf;
@@ -4132,7 +4132,7 @@ void Cl2DrawLightSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int
* @brief Fade to black and play a video
* @param pszMovie file path of movie
*/
void PlayInGameMovie(char *pszMovie)
void PlayInGameMovie(const char *pszMovie)
{
PaletteFadeOut(8);
play_movie(pszMovie, FALSE);

View File

@@ -61,7 +61,7 @@ int random_(BYTE idx, int v);
void engine_debug_trap(BOOL show_cursor);
BYTE *DiabloAllocPtr(DWORD dwBytes);
void mem_free_dbg(void *p);
BYTE *LoadFileInMem(char *pszName, DWORD *pdwFileLen);
BYTE *LoadFileInMem(const char *pszName, DWORD *pdwFileLen);
DWORD LoadFileWithMem(const char *pszName, BYTE *p);
void Cl2ApplyTrans(BYTE *p, BYTE *ttbl, int nCel);
void Cl2Draw(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap);
@@ -78,7 +78,7 @@ void Cl2BlitOutlineSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi
void Cl2DrawLightTblSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap, char light);
void Cl2BlitLightSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, BYTE *pTable);
void Cl2DrawLightSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap);
void PlayInGameMovie(char *pszMovie);
void PlayInGameMovie(const char *pszMovie);
/* rdata */

View File

@@ -11,7 +11,7 @@ char msgflag;
char msgcnt;
/** Maps from error_id to error message. */
char *MsgStrings[] = {
const char *const MsgStrings[] = {
"",
"No automap available in town",
"No multiplayer functions in demo",

View File

@@ -16,6 +16,6 @@ void ClrDiabloMsg();
void DrawDiabloMsg();
/* data */
extern char *MsgStrings[];
extern const char *const MsgStrings[];
#endif /* __ERROR_H__ */

View File

@@ -58,12 +58,12 @@ TMenuItem sgOptionsMenu[] = {
// clang-format on
};
/** Specifies the menu names for music enabled and disabled. */
char *music_toggle_names[] = {
const char *const music_toggle_names[] = {
"Music",
"Music Disabled",
};
/** Specifies the menu names for sound enabled and disabled. */
char *sound_toggle_names[] = {
const char *const sound_toggle_names[] = {
"Sound",
"Sound Disabled",
};
@@ -76,7 +76,7 @@ char *jogging_title = "Fast Walk";
#endif
#ifndef HELLFIRE
/** Specifies the menu names for colour cycling disabled and enabled. */
char *color_cycling_toggle_names[] = { "Color Cycling Off", "Color Cycling On" };
const char *const color_cycling_toggle_names[] = { "Color Cycling Off", "Color Cycling On" };
#endif
void gamemenu_on()
@@ -227,7 +227,7 @@ void gamemenu_get_music()
gamemenu_sound_music_toggle(music_toggle_names, sgOptionsMenu, sound_get_or_set_music_volume(1));
}
void gamemenu_sound_music_toggle(char **names, TMenuItem *menu_item, int volume)
void gamemenu_sound_music_toggle(const char *const *names, TMenuItem *menu_item, int volume)
{
if (gbSndInited) {
menu_item->dwFlags |= GMENU_ENABLED | GMENU_SLIDER;

View File

@@ -24,7 +24,7 @@ void gamemenu_save_game(BOOL bActivate);
void gamemenu_restart_town(BOOL bActivate);
void gamemenu_options(BOOL bActivate);
void gamemenu_get_music();
void gamemenu_sound_music_toggle(char **names, TMenuItem *menu_item, int gamma);
void gamemenu_sound_music_toggle(const char *const *names, TMenuItem *menu_item, int gamma);
void gamemenu_get_sound();
#ifdef HELLFIRE
void gamemenu_jogging();
@@ -46,10 +46,10 @@ void gamemenu_color_cycling(BOOL bActivate);
#endif
/* rdata */
extern char *music_toggle_names[];
extern char *sound_toggle_names[];
extern const char *const music_toggle_names[];
extern const char *const sound_toggle_names[];
#ifndef HELLFIRE
extern char *color_cycling_toggle_names[];
extern const char *const color_cycling_toggle_names[];
#endif
#endif /* __GAMEMENU_H__ */

View File

@@ -59,7 +59,7 @@ void gmenu_draw_pause()
}
}
void gmenu_print_text(int x, int y, char *pszStr)
void gmenu_print_text(int x, int y, const char *pszStr)
{
BYTE c;
@@ -252,7 +252,7 @@ void gmenu_clear_buffer(int x, int y, int width, int height)
int gmenu_get_lfont(TMenuItem *pItem)
{
char *text;
const char *text;
int i;
BYTE c;

View File

@@ -18,7 +18,7 @@ extern BYTE *option_cel;
extern int sgCurrentMenuIdx;
void gmenu_draw_pause();
void gmenu_print_text(int x, int y, char *pszStr);
void gmenu_print_text(int x, int y, const char *pszStr);
void FreeGMenu();
void gmenu_init_menu();
BOOL gmenu_is_active();

View File

@@ -339,7 +339,7 @@ void init_archives()
#endif
}
HANDLE init_test_access(char *mpq_path, char *mpq_name, char *reg_loc, int dwPriority, int fs)
HANDLE init_test_access(char *mpq_path, const char *mpq_name, const char *reg_loc, int dwPriority, int fs)
{
char *last_slash_pos;
char Filename[MAX_PATH];
@@ -396,7 +396,7 @@ void init_strip_trailing_slash(char *path)
}
}
BOOL init_read_test_file(char *pszPath, char *pszArchive, int dwPriority, HANDLE *phArchive)
BOOL init_read_test_file(char *pszPath, const char *pszArchive, int dwPriority, HANDLE *phArchive)
{
DWORD dwSize;
char *pszDrive, *pszRoot;

View File

@@ -44,9 +44,9 @@ void init_kill_mom_parent();
HWND init_find_mom_parent();
void init_await_mom_parent_exit();
void init_archives();
HANDLE init_test_access(char *mpq_path, char *mpq_name, char *reg_loc, int flags, int fs);
HANDLE init_test_access(char *mpq_path, const char *mpq_name, const char *reg_loc, int flags, int fs);
void init_strip_trailing_slash(char *path);
BOOL init_read_test_file(char *pszPath, char *pszArchive, int flags, HANDLE *phArchive);
BOOL init_read_test_file(char *pszPath, const char *pszArchive, int flags, HANDLE *phArchive);
void init_get_file_info();
LRESULT __stdcall MainWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
void init_activate_window(HWND hWnd, BOOL bActive);

View File

@@ -2375,7 +2375,7 @@ BOOL TryInvPut()
return CanPut(plr[myplr]._px, plr[myplr]._py);
}
void DrawInvMsg(char *msg)
void DrawInvMsg(const char *msg)
{
DWORD dwTicks;

View File

@@ -39,7 +39,7 @@ int FindGetItem(int idx, WORD ci, int iseed);
void SyncGetItem(int x, int y, int idx, WORD ci, int iseed);
BOOL CanPut(int x, int y);
BOOL TryInvPut();
void DrawInvMsg(char *msg);
void DrawInvMsg(const char *msg);
int InvPutItem(int pnum, int x, int y);
int SyncPutItem(int pnum, int x, int y, int idx, WORD icreateinfo, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, DWORD ibuff
#ifdef HELLFIRE

View File

@@ -106,7 +106,7 @@ BYTE ItemCAnimTbl[] = {
#endif
};
/** Map of item type .cel file names. */
char *ItemDropNames[] = {
const char *const ItemDropNames[] = {
"Armor2",
"Axe",
"FBttle",
@@ -4240,7 +4240,7 @@ void DrawUTextBack()
#include "asm_trans_rect.inc"
}
void PrintUString(int x, int y, BOOL cjustflag, char *str, int col)
void PrintUString(int x, int y, BOOL cjustflag, const char *str, int col)
{
int len, width, off, i, k;
BYTE c;

View File

@@ -127,7 +127,7 @@ void RechargeItem(ItemStruct *i, int r);
void PrintItemOil(char IDidx);
void PrintItemPower(char plidx, ItemStruct *x);
void DrawUTextBack();
void PrintUString(int x, int y, BOOL cjustflag, char *str, int col);
void PrintUString(int x, int y, BOOL cjustflag, const char *str, int col);
void DrawULine(int y);
void DrawUniqueInfo();
void PrintItemMisc(ItemStruct *x);
@@ -190,7 +190,7 @@ extern int MaxGold;
#endif
extern BYTE ItemCAnimTbl[];
extern char *ItemDropNames[];
extern const char *const ItemDropNames[];
extern BYTE ItemAnimLs[];
extern int ItemDropSnds[];
extern int ItemInvSnds[];

View File

@@ -6,7 +6,7 @@
#include "all.h"
int qtexty;
char *qtextptr;
const char *qtextptr;
int sgLastScroll;
BOOLEAN qtextflag;
int qtextDelay;
@@ -211,7 +211,7 @@ void DrawQText()
{
int i, l, w, tx, ty;
BYTE c;
char *p, *pnl, *s;
const char *p, *pnl, *s;
char tempstr[128];
BOOL doneflag;
DWORD currTime;

View File

@@ -7,7 +7,7 @@
#define __MINITEXT_H__
extern int qtexty;
extern char *qtextptr;
extern const char *qtextptr;
extern BOOLEAN qtextflag;
extern BYTE *pMedTextCels;
extern BYTE *pTextBoxCels;

View File

@@ -16,7 +16,7 @@ BOOL loop_movie;
* @param pszMovie The file name of the video
* @param user_can_close Set to false to make the video unskippable.
*/
void play_movie(char *pszMovie, BOOL user_can_close)
void play_movie(const char *pszMovie, BOOL user_can_close)
{
WNDPROC saveProc;
HANDLE video_stream;

View File

@@ -9,7 +9,7 @@
extern BYTE movie_playing;
extern BOOL loop_movie;
void play_movie(char *pszMovie, BOOL user_can_close);
void play_movie(const char *pszMovie, BOOL user_can_close);
LRESULT __stdcall MovieWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
/* rdata */

View File

@@ -279,7 +279,7 @@ void multi_clear_left_tbl()
void multi_player_left_msg(int pnum, int left)
{
char *pszFmt;
const char *pszFmt;
if (plr[pnum].plractive) {
RemovePlrFromMap(pnum);
@@ -945,7 +945,7 @@ BOOL multi_upgrade(BOOL *pfExitProgram)
void recv_plrinfo(int pnum, TCmdPlrInfoHdr *p, BOOL recv)
{
char *szEvent;
const char *szEvent;
if (myplr == pnum) {
return;

View File

@@ -233,7 +233,7 @@ ObjDataStruct AllObjects[] = {
};
/** Maps from object_graphic_id to object CEL name. */
char *ObjMasterLoadList[] = { // might be const
const char *const ObjMasterLoadList[] = {
"L1Braz",
"L1Doors",
"Lever",

View File

@@ -8,7 +8,7 @@
extern int ObjTypeConv[];
extern ObjDataStruct AllObjects[];
extern char *ObjMasterLoadList[];
extern const char *const ObjMasterLoadList[];
#ifdef HELLFIRE
extern char *ObjCryptLoadList[];
extern char *ObjHiveLoadList[];

View File

@@ -26,7 +26,7 @@ int bxadd[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
/** Specifies the Y-coordinate delta between barrels. */
int byadd[8] = { -1, -1, -1, 0, 0, 1, 1, 1 };
/** Maps from shrine_id to shrine name. */
char *shrinestrs[NUM_SHRINETYPE] = {
const char *const shrinestrs[NUM_SHRINETYPE] = {
"Mysterious",
"Hidden",
"Gloomy",
@@ -188,7 +188,7 @@ BYTE shrineavail[NUM_SHRINETYPE] = {
#endif
};
/** Maps from book_id to book name. */
char *StoryBookName[] = {
const char *const StoryBookName[] = {
"The Great Conflict",
"The Wages of Sin are War",
"The Tale of the Horadrim",

View File

@@ -178,11 +178,11 @@ DIABOOL objects_lv_24_454B04(int s);
extern int bxadd[8];
extern int byadd[8];
extern char *shrinestrs[NUM_SHRINETYPE];
extern const char *const shrinestrs[NUM_SHRINETYPE];
extern char shrinemin[NUM_SHRINETYPE];
extern char shrinemax[NUM_SHRINETYPE];
extern BYTE shrineavail[NUM_SHRINETYPE];
extern char *StoryBookName[];
extern const char *const StoryBookName[];
extern int StoryText[3][3];
#endif /* __OBJECTS_H__ */

View File

@@ -135,7 +135,7 @@ void palette_init()
#endif
}
void LoadPalette(char *pszFileName)
void LoadPalette(const char *pszFileName)
{
int i;
void *pBuf;

View File

@@ -13,7 +13,7 @@ extern int gdwPalEntries;
void SaveGamma();
void palette_init();
void LoadPalette(char *pszFileName);
void LoadPalette(const char *pszFileName);
void LoadRndLvlPal(int l);
void ResetPal();
void IncreaseGamma();

View File

@@ -150,7 +150,7 @@ int ToBlkTbl[NUM_CLASSES] = {
30,
#endif
};
char *ClassStrTblOld[] = {
const char *const ClassStrTblOld[] = {
"Warrior",
"Rogue",
"Sorceror",
@@ -225,7 +225,7 @@ int ExpLvlsTbl[MAXCHARLEVEL] = {
1310707109,
1583495809
};
char *ClassStrTbl[NUM_CLASSES] = {
const char *const ClassStrTbl[NUM_CLASSES] = {
"Warrior",
"Rogue",
"Sorceror",
@@ -251,9 +251,9 @@ void LoadPlrGFX(int pnum, player_graphic gfxflag)
{
char prefix[16];
char pszName[256];
char *szCel;
const char *szCel;
PlayerStruct *p;
char *cs;
const char *cs;
BYTE *pData, *pAnim;
DWORD i;
@@ -454,7 +454,7 @@ void InitPlrGFXMem(int pnum)
plr[pnum]._pGFXLoad = 0;
}
DWORD GetPlrGFXSize(char *szCel)
DWORD GetPlrGFXSize(const char *szCel)
{
DWORD c;
const char *a, *w;

View File

@@ -30,7 +30,7 @@ void SetPlayerGPtrs(BYTE *pData, BYTE **pAnim);
void LoadPlrGFX(int pnum, player_graphic gfxflag);
void InitPlayerGFX(int pnum);
void InitPlrGFXMem(int pnum);
DWORD GetPlrGFXSize(char *szCel);
DWORD GetPlrGFXSize(const char *szCel);
void FreePlayerGFX(int pnum);
void NewPlrAnim(int pnum, BYTE *Peq, int numFrames, int Delay, int width);
void ClearPlrPVars(int pnum);
@@ -145,10 +145,10 @@ extern int MagicTbl[NUM_CLASSES];
extern int DexterityTbl[NUM_CLASSES];
extern int VitalityTbl[NUM_CLASSES];
extern int ToBlkTbl[NUM_CLASSES];
extern char *ClassStrTblOld[];
extern const char *const ClassStrTblOld[];
extern int MaxStats[NUM_CLASSES][4];
extern int ExpLvlsTbl[MAXCHARLEVEL];
extern char *ClassStrTbl[NUM_CLASSES];
extern const char *const ClassStrTbl[NUM_CLASSES];
extern BYTE fix[9];
#endif /* __PLAYER_H__ */

View File

@@ -63,7 +63,7 @@ char questxoff[7] = { 0, -1, 0, -1, -2, -1, -2 };
* which the hover text of the cursor will be visible.
*/
char questyoff[7] = { 0, 0, -1, -1, -1, -2, -2 };
char *questtrigstr[5] = {
const char *const questtrigstr[5] = {
"King Leoric's Tomb",
"The Chamber of Bone",
"Maze",
@@ -823,7 +823,7 @@ void ResyncQuests()
#endif
}
void PrintQLString(int x, int y, BOOL cjustflag, char *str, int col)
void PrintQLString(int x, int y, BOOL cjustflag, const char *str, int col)
{
int len, width, off, i, k, s;
BYTE c;

View File

@@ -37,7 +37,7 @@ void SetReturnLvlPos();
void GetReturnLvlPos();
void ResyncMPQuests();
void ResyncQuests();
void PrintQLString(int x, int y, BOOL cjustflag, char *str, int col);
void PrintQLString(int x, int y, BOOL cjustflag, const char *str, int col);
void DrawQuestLog();
void StartQuestlog();
void QuestlogUp();
@@ -50,7 +50,7 @@ void SetMultiQuest(int q, int s, int l, int v1);
extern QuestData questlist[MAXQUESTS];
extern char questxoff[7];
extern char questyoff[7];
extern char *questtrigstr[5];
extern const char *constquesttrigstr[5];
extern int QuestGroup1[3];
extern int QuestGroup2[3];
extern int QuestGroup3[3];

View File

@@ -60,7 +60,7 @@ DWORD sgdwCursHgtOld;
/* data */
/* used in 1.00 debug */
char *szMonModeAssert[18] = {
const char *const szMonModeAssert[18] = {
"standing",
"walking (1)",
"walking (2)",
@@ -81,7 +81,7 @@ char *szMonModeAssert[18] = {
"talking"
};
char *szPlrModeAssert[12] = {
const char *const szPlrModeAssert[12] = {
"standing",
"walking (1)",
"walking (2)",

View File

@@ -38,7 +38,7 @@ void DrawAndBlit();
/* data */
/** used in 1.00 debug */
extern char *szMonModeAssert[18];
extern char *szPlrModeAssert[12];
extern const char *const szMonModeAssert[18];
extern const char *const szPlrModeAssert[12];
#endif /* __SCROLLRT_H__ */

View File

@@ -60,7 +60,7 @@ BYTE SkelChamTrans3[] = {
};
/** Maps from quest level to quest level names. */
char *quest_level_names[] = {
const char *const quest_level_names[] = {
"",
"Skeleton King's Lair",
"Bone Chamber",
@@ -107,7 +107,7 @@ void AddVileObjs()
SetObjMapRange(ObjIndex(35, 36), 7, 11, 13, 18, 3);
}
void DRLG_SetMapTrans(char *sFileName)
void DRLG_SetMapTrans(const char *sFileName)
{
int x, y;
int i, j;

View File

@@ -10,7 +10,7 @@ int ObjIndex(int x, int y);
void AddSKingObjs();
void AddSChamObjs();
void AddVileObjs();
void DRLG_SetMapTrans(char *sFileName);
void DRLG_SetMapTrans(const char *sFileName);
void LoadSetMap();
/* rdata */
@@ -21,6 +21,6 @@ extern BYTE SkelKingTrans4[28];
extern BYTE SkelChamTrans1[20];
extern BYTE SkelChamTrans2[8];
extern BYTE SkelChamTrans3[36];
extern char *quest_level_names[];
extern const char *const quest_level_names[];
#endif /* __SETMAPS_H__ */

View File

@@ -28,7 +28,7 @@ BOOLEAN gbDupSounds = TRUE;
/** Specifies the active background music track id. */
int sgnMusicTrack = NUM_MUSIC;
/** Maps from track ID to track name. */
char *sgszMusicTracks[NUM_MUSIC] = {
const char *const sgszMusicTracks[NUM_MUSIC] = {
#ifdef SPAWN
"Music\\sTowne.wav",
"Music\\sLvlA.wav",
@@ -197,7 +197,7 @@ BOOL sound_file_reload(TSnd *sound_file, LPDIRECTSOUNDBUFFER DSB)
return rv;
}
TSnd *sound_file_load(char *path)
TSnd *sound_file_load(const char *path)
{
HANDLE file;
BYTE *wave_file;
@@ -287,7 +287,7 @@ void snd_init(HWND hWnd)
gbSndInited = sglpDS != NULL;
}
void snd_get_volume(char *value_name, int *value)
void snd_get_volume(const char *value_name, int *value)
{
int v = *value;
if (!SRegLoadValue(APP_NAME, value_name, 0, &v)) {
@@ -380,7 +380,7 @@ void sound_cleanup()
}
}
void snd_set_volume(char *key, int value)
void snd_set_volume(const char *key, int value)
{
SRegSaveValue(APP_NAME, key, 0, value);
}

View File

@@ -16,15 +16,15 @@ BOOL snd_playing(TSnd *pSnd);
void snd_play_snd(TSnd *pSnd, int lVolume, int lPan);
IDirectSoundBuffer *sound_dup_channel(IDirectSoundBuffer *DSB);
BOOL sound_file_reload(TSnd *sound_file, IDirectSoundBuffer *DSB);
TSnd *sound_file_load(char *path);
TSnd *sound_file_load(const char *path);
void sound_CreateSoundBuffer(TSnd *sound_file);
void sound_file_cleanup(TSnd *sound_file);
void snd_init(HWND hWnd);
void snd_get_volume(char *value_name, int *value);
void snd_get_volume(const char *value_name, int *value);
void sound_create_primary_buffer(HANDLE music_track);
HRESULT sound_DirectSoundCreate(LPGUID lpGuid, LPDIRECTSOUND *ppDS, LPUNKNOWN pUnkOuter);
void sound_cleanup();
void snd_set_volume(char *key, int value);
void snd_set_volume(const char *key, int value);
void music_stop();
void music_start(int nTrack);
void sound_disable_music(BOOL disable);

View File

@@ -71,7 +71,7 @@ int SStringY[24] = {
276
};
/** Maps from towner IDs to NPC names. */
char *talkname[9] = {
const char *const talkname[9] = {
"Griswold",
"Pepin",
"",
@@ -154,7 +154,7 @@ void DrawSTextBack()
#include "asm_trans_rect.inc"
}
void PrintSString(int x, int y, BOOL cjustflag, char *str, char col, int val)
void PrintSString(int x, int y, BOOL cjustflag, const char *str, char col, int val)
{
int xx, yy;
int len, width, off, i, k, s;
@@ -325,7 +325,7 @@ void OffsetSTextY(int y, int yo)
stext[y]._syoff = yo;
}
void AddSText(int x, int y, BOOL j, char *str, char clr, BOOL sel)
void AddSText(int x, int y, BOOL j, const char *str, char clr, BOOL sel)
{
stext[y]._sx = x;
stext[y]._syoff = 0;

View File

@@ -48,7 +48,7 @@ void InitStores();
void SetupTownStores();
void FreeStoreMem();
void DrawSTextBack();
void PrintSString(int x, int y, BOOL cjustflag, char *str, char col, int val);
void PrintSString(int x, int y, BOOL cjustflag, const char *str, char col, int val);
void DrawSLine(int y);
void DrawSSlider(int y1, int y2);
void DrawSTextHelp();
@@ -56,7 +56,7 @@ void ClearSText(int s, int e);
void AddSLine(int y);
void AddSTextVal(int y, int val);
void OffsetSTextY(int y, int yo);
void AddSText(int x, int y, BOOL j, char *str, char clr, BOOL sel);
void AddSText(int x, int y, BOOL j, const char *str, char clr, BOOL sel);
void StoreAutoPlace();
void S_StartSmith();
void S_ScrollSBuy(int idx);
@@ -143,6 +143,6 @@ void ReleaseStoreBtn();
/* rdata */
extern int SStringY[24];
extern char *talkname[9];
extern const char *const talkname[9];
#endif /* __STORES_H__ */

View File

@@ -35,7 +35,7 @@ typedef struct PLStruct {
} PLStruct;
typedef struct UItemStruct {
char *UIName;
const char *UIName;
char UIItemId;
char UIMinLvl;
char UINumPL;
@@ -67,8 +67,8 @@ typedef struct ItemDataStruct {
int iCurs;
char itype;
char iItemId;
char *iName;
char *iSName;
const char *iName;
const char *iSName;
char iMinMLvl;
int iDurability;
int iMinDam;
@@ -371,7 +371,7 @@ typedef struct PlayerStruct {
//////////////////////////////////////////////////
typedef struct TextDataStruct {
char *txtstr;
const char *txtstr;
int scrlltxt;
int txtspd;
int sfxnr;
@@ -399,7 +399,7 @@ typedef struct MissileData {
typedef struct MisFileData {
unsigned char mAnimName;
unsigned char mAnimFAmt;
char *mName;
const char *mName;
int mFlags;
unsigned char *mAnimData[16];
unsigned char mAnimDelay[16];
@@ -473,7 +473,7 @@ typedef struct CKINFO {
typedef struct TSnd {
WAVEFORMATEX fmt;
CKINFO chunk;
char *sound_path;
const char *sound_path;
LPDIRECTSOUNDBUFFER DSB;
int start_tc;
} TSnd;
@@ -481,7 +481,7 @@ typedef struct TSnd {
#pragma pack(push, 1)
typedef struct TSFX {
unsigned char bFlags;
char *pszName;
const char *pszName;
TSnd *pSnd;
} TSFX;
#pragma pack(pop)
@@ -500,15 +500,15 @@ typedef struct AnimStruct {
typedef struct MonsterData {
int width;
int mImage;
char *GraphicType;
const char *GraphicType;
BOOL has_special;
char *sndfile;
const char *sndfile;
BOOL snd_special;
BOOL has_trans;
char *TransFile;
const char *TransFile;
int Frames[6];
int Rate[6];
char *mName;
const char *mName;
char mMinDLvl;
char mMaxDLvl;
char mLevel;
@@ -634,7 +634,7 @@ typedef struct MonsterStruct { // note: missing field _mAFNum
unsigned char leaderflag;
unsigned char packsize;
unsigned char mlid;
char *mName;
const char *mName;
CMonster *MType;
MonsterData *MData;
} MonsterStruct;
@@ -645,8 +645,8 @@ typedef struct UniqMonstStruct {
#else
char mtype;
#endif
char *mName;
char *mTrnName;
const char *mName;
const char *mTrnName;
unsigned char mlevel;
unsigned short mmaxhp;
unsigned char mAi;
@@ -1055,7 +1055,7 @@ typedef struct QuestData {
unsigned char _qslvl;
int _qflags; /* unsigned char */
int _qdmsg;
char *_qlstr;
const char *_qlstr;
} QuestData;
#ifdef HELLFIRE
@@ -1075,7 +1075,7 @@ typedef struct CornerStoneStruct {
typedef struct TMenuItem {
DWORD dwFlags;
char *pszStr;
const char *pszStr;
void (*fnMenu)(BOOL); /* fix, should have one arg */
} TMenuItem;
@@ -1089,8 +1089,8 @@ typedef struct SpellData {
unsigned char sName;
unsigned char sManaCost;
unsigned char sType;
char *sNameText;
char *sSkillText;
const char *sNameText;
const char *sSkillText;
int sBookLvl;
int sStaffLvl;
BOOL sTargeted;
@@ -1378,8 +1378,8 @@ typedef struct _SNETPLAYERDATA {
typedef struct _SNETPROGRAMDATA {
int size;
char *programname;
char *programdescription;
const char *programname;
const char *programdescription;
int programid;
int versionid;
int reserved1;