void ReadCompatibleUserInfo(FArchive &arc, userinfo_t &info) { char netname[MAXPLAYERNAME + 1]; BYTE team; int aimdist, color, colorset, skin, gender; bool neverswitch; //fixed_t movebob, stillbob; These were never serialized! //int playerclass; " info.Reset(); arc.Read(&netname, sizeof(netname)); arc << team << aimdist << color << skin << gender << neverswitch << colorset; *static_cast<FStringCVar *>(info[NAME_Name]) = netname; *static_cast<FIntCVar *>(info[NAME_Team]) = team; *static_cast<FFloatCVar *>(info[NAME_Autoaim]) = (float)aimdist / ANGLE_1; *static_cast<FIntCVar *>(info[NAME_Skin]) = skin; *static_cast<FIntCVar *>(info[NAME_Gender]) = gender; *static_cast<FBoolCVar *>(info[NAME_NeverSwitchOnPickup]) = neverswitch; *static_cast<FIntCVar *>(info[NAME_ColorSet]) = colorset; UCVarValue val; val.Int = color; static_cast<FColorCVar *>(info[NAME_Color])->SetGenericRep(val, CVAR_Int); }
void ReadUserInfo(FArchive &arc, userinfo_t &info) { FName name; FBaseCVar **cvar; char *str = NULL; UCVarValue val; info.Reset(); for (arc << name; name != NAME_None; arc << name) { cvar = info.CheckKey(name); arc << str; if (cvar != NULL && *cvar != NULL) { switch (name) { case NAME_Team: info.TeamChanged(atoi(str)); break; case NAME_Skin: info.SkinChanged(str); break; case NAME_PlayerClass: info.PlayerClassChanged(str); break; default: val.String = str; (*cvar)->SetGenericRep(val, CVAR_String); break; } } } if (str != NULL) { delete[] str; } }
void ReadUserInfo(FArchive &arc, userinfo_t &info, FString &skin) { FName name; FBaseCVar **cvar; char *str = NULL; UCVarValue val; if (SaveVersion < 4253) { ReadCompatibleUserInfo(arc, info); return; } info.Reset(); skin = NULL; for (arc << name; name != NAME_None; arc << name) { cvar = info.CheckKey(name); arc << str; if (cvar != NULL && *cvar != NULL) { switch (name) { case NAME_Team: info.TeamChanged(atoi(str)); break; case NAME_Skin: skin = str; break; // Caller must call SkinChanged() once current calss is known case NAME_PlayerClass: info.PlayerClassChanged(str); break; default: val.String = str; (*cvar)->SetGenericRep(val, CVAR_String); break; } } } if (str != NULL) { delete[] str; } }