Fixing saved games for Unforgiven (and possibly others)

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
taniwha
Posts: 401
Joined: Thu Jan 14, 2010 7:11 am
Contact:

Fixing saved games for Unforgiven (and possibly others)

Post by taniwha »

First, I don't know how badly other engines are affected, but this was definitely a problem in QuakeForge: ED_InitEntity: parse error when attempted to load a saved game when playing Unforgiven.

The problem is caused by builtin function names being stripped from the progs, and the unforgiven progs using movetogoal in the th_goal function field :P.

The fix is a two step process:
  1. modify the builtin function table(s) to store the function name as well as the function pointer.
  2. modify the progs loader to run through the progs functions (the dfunction_t table) looking for unnamed function defs that refer to builtins, and set the name appropriately using the builtin number to find the function name from the table(s) modified in step 1.
QF has had #1 for a long time, but #2 was actually two sub-steps has I'd set the names a few days ago (for dumping progs), but as QF uses hash tables for looking up functions by name, I discovered today that I also needed to stuff the fixed builtin descriptor into the hash table :P.

For the names in step 1, I very strongly suggest that standard names are used. For id standard builtins, that means the names as in id's defs.qc. For standard extension functions, then the prevailing standard name. If that's a mess, then fix it :) For engine specific functions, it doesn't really matter as those progs wouldn't work in other engines anyway :)
Leave others their otherness.
http://quakeforge.net/
Post Reply