|
|
|
@ -384,17 +384,13 @@ static void grid_correct_for_holes(GameState* gs, struct Entity* grid)
|
|
|
|
|
V2 cur_local_pos = entity_shape_pos(N);
|
|
|
|
|
const V2 dirs[] = {
|
|
|
|
|
(V2){
|
|
|
|
|
.x = -1.0f, .y = 0.0f
|
|
|
|
|
},
|
|
|
|
|
.x = -1.0f, .y = 0.0f},
|
|
|
|
|
(V2){
|
|
|
|
|
.x = 1.0f, .y = 0.0f
|
|
|
|
|
},
|
|
|
|
|
.x = 1.0f, .y = 0.0f},
|
|
|
|
|
(V2){
|
|
|
|
|
.x = 0.0f, .y = 1.0f
|
|
|
|
|
},
|
|
|
|
|
.x = 0.0f, .y = 1.0f},
|
|
|
|
|
(V2){
|
|
|
|
|
.x = 0.0f, .y = -1.0f
|
|
|
|
|
},
|
|
|
|
|
.x = 0.0f, .y = -1.0f},
|
|
|
|
|
};
|
|
|
|
|
int num_dirs = sizeof(dirs) / sizeof(*dirs);
|
|
|
|
|
|
|
|
|
@ -703,13 +699,35 @@ SerMaybeFailure ser_data(SerState* ser, char* data, size_t data_len, const char*
|
|
|
|
|
{
|
|
|
|
|
char read_name[512] = {0};
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < var_name_len; i++)
|
|
|
|
|
size_t just_field_name = strlen(name);
|
|
|
|
|
int i = 0;
|
|
|
|
|
int nondigit_i = 0;
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
read_name[i] = ser->bytes[ser->cursor];
|
|
|
|
|
if (nondigit_i == 0 && read_name[i] >= '0' && read_name[i] <= '9')
|
|
|
|
|
{
|
|
|
|
|
// still a digit
|
|
|
|
|
if (i >= 10)
|
|
|
|
|
{ // 10 is way too many digits for a line number...
|
|
|
|
|
return (SerMaybeFailure){
|
|
|
|
|
.expression = "Way too many digits as a line number before a field name",
|
|
|
|
|
.failed = true,
|
|
|
|
|
.line = __LINE__,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
nondigit_i += 1;
|
|
|
|
|
}
|
|
|
|
|
i++;
|
|
|
|
|
ser->cursor += 1;
|
|
|
|
|
SER_ASSERT(ser->cursor <= ser->max_size);
|
|
|
|
|
if (nondigit_i >= just_field_name)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
read_name[var_name_len] = '\0';
|
|
|
|
|
read_name[i + 1] = '\0';
|
|
|
|
|
// advance past digits
|
|
|
|
|
char *read = read_name;
|
|
|
|
|
char *var = var_name;
|
|
|
|
@ -742,6 +760,7 @@ enum GameVersion
|
|
|
|
|
VAddedTest,
|
|
|
|
|
VAddedSerToDisk,
|
|
|
|
|
VRemovedTest,
|
|
|
|
|
VChangedVectorSerializing,
|
|
|
|
|
VMax, // this minus one will be the version used
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -770,7 +789,8 @@ SerMaybeFailure ser_entityid(SerState* ser, EntityID* id)
|
|
|
|
|
{
|
|
|
|
|
SER_VAR(&id->generation);
|
|
|
|
|
SER_VAR(&id->index);
|
|
|
|
|
if (id->generation > 0) SER_ASSERT(id->index < ser->max_entity_index);
|
|
|
|
|
if (id->generation > 0)
|
|
|
|
|
SER_ASSERT(id->index < ser->max_entity_index);
|
|
|
|
|
return ser_ok;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -846,7 +866,14 @@ SerMaybeFailure ser_entity(SerState* ser, GameState* gs, Entity* e)
|
|
|
|
|
V2 shape_pos;
|
|
|
|
|
if (ser->serializing)
|
|
|
|
|
shape_pos = entity_shape_pos(e);
|
|
|
|
|
if (ser->version < VChangedVectorSerializing)
|
|
|
|
|
{
|
|
|
|
|
SER_VAR(&shape_pos);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SER_MAYBE_RETURN(ser_V2(ser, &shape_pos));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float shape_mass;
|
|
|
|
|
if (ser->serializing)
|
|
|
|
@ -938,10 +965,12 @@ SerMaybeFailure ser_opus_packets(SerState* ser, OpusBuffer* mic_or_speaker_data)
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
SER_VAR(&no_more_packets);
|
|
|
|
|
if (no_more_packets) break;
|
|
|
|
|
if (no_more_packets)
|
|
|
|
|
break;
|
|
|
|
|
OpusPacket *cur = push_packet(mic_or_speaker_data);
|
|
|
|
|
OpusPacket dummy;
|
|
|
|
|
if (cur == NULL) cur = &dummy; // throw away this packet
|
|
|
|
|
if (cur == NULL)
|
|
|
|
|
cur = &dummy; // throw away this packet
|
|
|
|
|
bool isnull = false;
|
|
|
|
|
SER_VAR(&isnull);
|
|
|
|
|
if (!isnull)
|
|
|
|
|