mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 09:01:57 -05:00
Split up Dat_Load into Dat_Load and Dat_LoadFormat2
This commit is contained in:
parent
ac0bf7ccdb
commit
cb48d63437
2 changed files with 32 additions and 22 deletions
|
@ -66,8 +66,8 @@ Listed below are all of the options supported in options.txt
|
|||
### Audio options
|
||||
|Name|Default|Description|
|
||||
|--|--|--|
|
||||
`soundsvolume`|`0` for webclient<br>100 elsewhere|Volume of game sounds (e.g. break/walk sounds)<br>Volume must be between 0 and 100
|
||||
`musicvolume`|`0` for webclient<br>100 elsewhere|Volume of game background music<br>Volume must be between 0 and 100
|
||||
`soundsvolume`|`0` for webclient<br>`100` elsewhere|Volume of game sounds (e.g. break/walk sounds)<br>Volume must be between 0 and 100
|
||||
`musicvolume`|`0` for webclient<br>`100` elsewhere|Volume of game background music<br>Volume must be between 0 and 100
|
||||
`music-mindelay`|`120` (2 minutes)|Minimum delay before next music track is played <br>Delay must be between 0 and 3600
|
||||
`music-maxdelay`|`420` (7 minutes)|Maximum delay before next music track is played <br>Delay must be between 0 and 3600
|
||||
|
||||
|
@ -114,8 +114,10 @@ Listed below are all of the options supported in options.txt
|
|||
./Game.c: Game_AllowServerTextures = Options_GetBool(OPT_SERVER_TEXTURES, true);
|
||||
|
||||
### Hacks options
|
||||
./Entity.c: hacks->Enabled = !Game_PureClassic && Options_GetBool(OPT_HACKS_ENABLED, true);
|
||||
./Entity.c: hacks->SpeedMultiplier = Options_GetFloat(OPT_SPEED_FACTOR, 0.1f, 50.0f, 10.0f);
|
||||
|Name|Default|Description|
|
||||
|--|--|--|
|
||||
`hacks-hacksenabled`|`true`|Whether hacks are enabled at all<br>Has no effect in 'classic only' game mode
|
||||
`hacks-speedmultiplier`|`10.0`|Speed multiplier/factor when speedhacks are active<br>Multiplier must be between 0.1 and 50.0
|
||||
./Entity.c: hacks->PushbackPlacing = Options_GetBool(OPT_PUSHBACK_PLACING, false);
|
||||
./Entity.c: hacks->NoclipSlide = Options_GetBool(OPT_NOCLIP_SLIDE, false);
|
||||
./Entity.c: hacks->WOMStyleHacks = Options_GetBool(OPT_WOM_STYLE_HACKS, false);
|
||||
|
|
|
@ -894,34 +894,25 @@ static int Dat_I32(struct JFieldDesc* field) {
|
|||
return field->Value.I32;
|
||||
}
|
||||
|
||||
cc_result Dat_Load(struct Stream* stream) {
|
||||
cc_uint8 header[10];
|
||||
static cc_result Dat_LoadFormat2(struct Stream* stream) {
|
||||
struct LocalPlayer* p = &LocalPlayer_Instance;
|
||||
cc_uint8 header[5];
|
||||
struct JClassDesc obj;
|
||||
struct JFieldDesc* field;
|
||||
cc_string fieldName;
|
||||
cc_result res;
|
||||
int i;
|
||||
|
||||
struct LocalPlayer* p = &LocalPlayer_Instance;
|
||||
struct Stream compStream;
|
||||
struct InflateState state;
|
||||
Inflate_MakeStream2(&compStream, &state, stream);
|
||||
|
||||
if ((res = Map_SkipGZipHeader(stream))) return res;
|
||||
if ((res = Stream_Read(&compStream, header, sizeof(header)))) return res;
|
||||
/* .dat header */
|
||||
if (Stream_GetU32_BE(&header[0]) != 0x271BB788) return DAT_ERR_IDENTIFIER;
|
||||
if (header[4] != 0x02) return DAT_ERR_VERSION;
|
||||
if ((res = Stream_Read(stream, header, sizeof(header)))) return res;
|
||||
|
||||
/* Java seralisation headers */
|
||||
if (Stream_GetU16_BE(&header[5]) != 0xACED) return DAT_ERR_JIDENTIFIER;
|
||||
if (Stream_GetU16_BE(&header[7]) != 0x0005) return DAT_ERR_JVERSION;
|
||||
if (header[9] != TC_OBJECT) return DAT_ERR_ROOT_TYPE;
|
||||
if ((res = Dat_ReadClassDesc(&compStream, &obj))) return res;
|
||||
if (Stream_GetU16_BE(&header[0]) != 0xACED) return DAT_ERR_JIDENTIFIER;
|
||||
if (Stream_GetU16_BE(&header[2]) != 0x0005) return DAT_ERR_JVERSION;
|
||||
if (header[4] != TC_OBJECT) return DAT_ERR_ROOT_TYPE;
|
||||
if ((res = Dat_ReadClassDesc(stream, &obj))) return res;
|
||||
|
||||
for (i = 0; i < obj.FieldsCount; i++) {
|
||||
field = &obj.Fields[i];
|
||||
if ((res = Dat_ReadFieldData(&compStream, field))) return res;
|
||||
if ((res = Dat_ReadFieldData(stream, field))) return res;
|
||||
fieldName = String_FromRaw((char*)field->FieldName, JNAME_SIZE);
|
||||
|
||||
if (String_CaselessEqualsConst(&fieldName, "width")) {
|
||||
|
@ -945,6 +936,23 @@ cc_result Dat_Load(struct Stream* stream) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
cc_result Dat_Load(struct Stream* stream) {
|
||||
cc_uint8 header[5];
|
||||
cc_result res;
|
||||
|
||||
struct Stream compStream;
|
||||
struct InflateState state;
|
||||
Inflate_MakeStream2(&compStream, &state, stream);
|
||||
if ((res = Map_SkipGZipHeader(stream))) return res;
|
||||
|
||||
if ((res = Stream_Read(&compStream, header, sizeof(header)))) return res;
|
||||
/* .dat header */
|
||||
if (Stream_GetU32_BE(&header[0]) != 0x271BB788) return DAT_ERR_IDENTIFIER;
|
||||
if (header[4] != 0x02) return DAT_ERR_VERSION;
|
||||
|
||||
return Dat_LoadFormat2(&compStream);
|
||||
}
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
*--------------------------------------------------ClassicWorld export----------------------------------------------------*
|
||||
|
|
Loading…
Reference in a new issue