Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make save-restore compatible with petty mod development #1823

Open
a1batross opened this issue Oct 3, 2024 · 1 comment
Open

Make save-restore compatible with petty mod development #1823

a1batross opened this issue Oct 3, 2024 · 1 comment
Assignees
Labels
goldsrc-compatibility Half-Life (games and mods) Related to everything that uses Half-Life engine (GoldSrc)

Comments

@a1batross
Copy link
Member

// 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 a1batross added goldsrc-compatibility Half-Life (games and mods) Related to everything that uses Half-Life engine (GoldSrc) labels Oct 3, 2024
@a1batross a1batross self-assigned this Oct 3, 2024
@a1batross
Copy link
Member Author

a1batross commented Oct 3, 2024

FIELD_MODELNAME can be safely redefined into FIELD_STRING with manual model precache after restoring static entity.

Custom save/restore functions could also be used for soundlist_t and decallist_t structures. SAVE_CLIENT on the other hand, is shared with GoldSrc with only few fields unique to Xash3D.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
goldsrc-compatibility Half-Life (games and mods) Related to everything that uses Half-Life engine (GoldSrc)
Projects
None yet
Development

No branches or pull requests

1 participant