xash3d-fwgs
xash3d-fwgs copied to clipboard
Make save-restore compatible with petty mod development
// The engine only uses these data types.
// Some custom engine may use others, but those engines are not supported.
switch (fieldType)
{
case ENGINEFIELDTYPE::FIELD_FLOAT: return FIELD_FLOAT;
case ENGINEFIELDTYPE::FIELD_STRING: return FIELD_STRING;
case ENGINEFIELDTYPE::FIELD_EDICT: return FIELD_EDICT;
case ENGINEFIELDTYPE::FIELD_VECTOR: return FIELD_VECTOR;
case ENGINEFIELDTYPE::FIELD_INTEGER: return FIELD_INTEGER;
case ENGINEFIELDTYPE::FIELD_CHARACTER: return FIELD_CHARACTER;
case ENGINEFIELDTYPE::FIELD_TIME: return FIELD_TIME;
default: return FIELD_TYPECOUNT;
}
}
The affected parts of sv_save.c are:
-
SAVE_CLIENT
structure. Xash3D saves viewentity as FIELD_SHORT. Maybe save it as FIELD_INTEGER? - Same for
soundlist_t
structure. Xash3D saves entity index to restore sounds as aFIELD_SHORT
. - Same for
decallist_t
structure. Xash3D saves entity index to restore decals as aFIELD_SHORT
. - Static entities save-restore. It uses
FIELD_MODELNAME
to store the model inmessagenum
field and usesFIELD_SHORT
forskin
andbody
. That might be overriden with customSaveRead/WriteFields
implementation. Or skipping save restore for static entities for these mods altogether (it's not like mods use static entities very often). - There is also gEntVarsDescription for
FindEntityByString
implementation. But it doesn't interact with the mod and directly peeks into entvars_t.