From 0362794f2c5840efb0ee610991619b9d8ff41dd7 Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Mon, 27 Aug 2018 02:02:13 +0200 Subject: [PATCH] Make Hardqore2 work without the change in Script_Program.h I got "ERROR: Exceeded global memory size" from idProgram::ReserveMem() Now the scripts get a bit more memory (like in D3XP) and that seems to work. I also had to disable assertions. This means that Debug builds don't work and -DNDEBUG must be set. --- CMakeLists.txt | 3 ++- game/script/Script_Program.h | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aaf46e3..88727e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,8 @@ project(dhewm3sdk) option(BASE "Build the base (game/) game code" ON) set(BASE_NAME "hardqore2" CACHE STRING "Name of the mod built from game/ (will result in \${BASE_NAME}.dll)") -set(BASE_DEFS "GAME_DLL;_WATER_PHYSICS;_PORTALSKY;_DENTONMOD" CACHE STRING "Compiler definitions for the mod built from game/") +# FIXME: maybe try to get it to work with assertions enabled (i.e. in Debug builds or in Release builds without NDEBUG) +set(BASE_DEFS "GAME_DLL;_WATER_PHYSICS;_PORTALSKY;_DENTONMOD;NDEBUG" CACHE STRING "Compiler definitions for the mod built from game/") option(D3XP "Build the d3xp/ game code" OFF) set(D3XP_NAME "d3xp" CACHE STRING "Name of the mod built from d3xp/ (will result in \${D3XP_NAME}.dll)") diff --git a/game/script/Script_Program.h b/game/script/Script_Program.h index 5975677..211e8bd 100644 --- a/game/script/Script_Program.h +++ b/game/script/Script_Program.h @@ -44,7 +44,10 @@ class idSaveGame; class idRestoreGame; #define MAX_STRING_LEN 128 -#define MAX_GLOBALS 196608 // in bytes +//#define MAX_GLOBALS 196608 // in bytes +// DG: apparently the default value is not enough (=> idProgram::ReserveMem() throws error on game start on Linux amd64) +// so use the value D3XP uses +#define MAX_GLOBALS 296608 // in bytes #define MAX_STRINGS 1024 #define MAX_FUNCS 3072 #define MAX_STATEMENTS 81920 // statement_t - 18 bytes last I checked