// // SC_OpenFile // // Loads a script (from a file). Uses the zone memory allocator for // memory allocation and de-allocation. // void SC_OpenFile (const char *name) { SC_Close (); ScriptSize = M_ReadFile (name, (byte **)&ScriptBuffer); M_ExtractFileBase (name, ScriptName); FreeScript = true; SC_PrepareScript (); }
// // SC_OpenLumpNum // // Loads a script (from the WAD files). // void SC_OpenLumpNum (int lump, const char *name) { SC_Close (); ScriptBuffer = (char *)W_CacheLumpNum (lump, PU_STATIC); ScriptSize = W_LumpLength (lump); ScriptName = name; FreeScript = true; SC_PrepareScript (); }
// // SC_OpenMem // // Prepares a script that is already in memory for parsing. The caller is // responsible for freeing it, if needed. // void SC_OpenMem (const char *name, char *buffer, int size) { SC_Close (); ScriptSize = size; ScriptBuffer = buffer; ScriptName = name; FreeScript = false; SC_PrepareScript (); }
void SC_OpenLumpNum (int lump, const char *name) { SC_Close (); ScriptSize = Wads.LumpLength (lump); ScriptBuffer = new char[ScriptSize]; Wads.ReadLump (lump, ScriptBuffer); strcpy (ScriptName, name); FreeScript = true; SC_PrepareScript (); }