xash3d-fwgs icon indicating copy to clipboard operation
xash3d-fwgs copied to clipboard

Make save-restore compatible with petty mod development

Open a1batross opened this issue 4 months ago • 1 comments

// 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:

  1. SAVE_CLIENT structure. Xash3D saves viewentity as FIELD_SHORT. Maybe save it as FIELD_INTEGER?
  2. Same for soundlist_t structure. Xash3D saves entity index to restore sounds as a FIELD_SHORT.
  3. Same for decallist_t structure. Xash3D saves entity index to restore decals as a FIELD_SHORT.
  4. Static entities save-restore. It uses FIELD_MODELNAME to store the model in messagenum field and uses FIELD_SHORT for skin and body. That might be overriden with custom SaveRead/WriteFields implementation. Or skipping save restore for static entities for these mods altogether (it's not like mods use static entities very often).
  5. There is also gEntVarsDescription for FindEntityByString implementation. But it doesn't interact with the mod and directly peeks into entvars_t.

a1batross avatar Oct 03 '24 15:10 a1batross