Due to conversion from fix64 to fix Boss_dying_start_time was not 0 when saving even if boss was not dead - fixed; Fixed warning about set but unused variable

This commit is contained in:
zicodxx 2011-08-26 18:56:18 +02:00
parent a2bdb63149
commit d1a471dedc
3 changed files with 18 additions and 5 deletions

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog
20110826
--------
main/ai.c: Due to conversion from fix64 to fix Boss_dying_start_time was not 0 when saving even if boss was not dead - fixed; Fixed warning about set but unused variable
20110720
--------
main/menu: Added Polygon model viewer and GameBitmaps viewer in non-Release build for debugging, messing around, DXX-Redrawn, etc.

View file

@ -1356,11 +1356,10 @@ void move_object_to_legal_spot(object *objp)
for (i=0; i<MAX_SIDES_PER_SEGMENT; i++) {
if (WALL_IS_DOORWAY(segp, i) & WID_FLY_FLAG) {
vms_vector segment_center, goal_dir;
fix dist_to_center;
compute_segment_center(&segment_center, &Segments[segp->children[i]]);
vm_vec_sub(&goal_dir, &segment_center, &objp->pos);
dist_to_center = vm_vec_normalize_quick(&goal_dir);
vm_vec_normalize_quick(&goal_dir);
vm_vec_scale(&goal_dir, objp->size);
vm_vec_add2(&objp->pos, &goal_dir);
if (!object_intersects_wall(objp)) {
@ -3198,10 +3197,19 @@ int ai_save_state(PHYSFS_file *fp)
tmptime32 = Last_gate_time - GameTime64;
PHYSFS_write(fp, &tmptime32, sizeof(fix), 1);
PHYSFS_write(fp, &Gate_interval, sizeof(fix), 1);
if (Boss_dying_start_time - GameTime64 < F1_0*(-18000))
tmptime32 = F1_0*(-18000);
if (Boss_dying_start_time == 0) // if Boss not dead, yet we expect this to be 0, so do not convert!
{
tmptime32 = 0;
}
else
tmptime32 = Boss_dying_start_time - GameTime64;
{
if (Boss_dying_start_time - GameTime64 < F1_0*(-18000))
tmptime32 = F1_0*(-18000);
else
tmptime32 = Boss_dying_start_time - GameTime64;
if (tmptime32 == 0) // now if our converted value went 0 we should do something against it
tmptime32 = -1;
}
PHYSFS_write(fp, &tmptime32, sizeof(fix), 1);
PHYSFS_write(fp, &Boss_dying, sizeof(int), 1);
PHYSFS_write(fp, &Boss_dying_sound_playing, sizeof(int), 1);

View file

@ -204,6 +204,7 @@ bitmap_index bm_load_sub(int skip, char * filename )
new->bm_selector=0;
#endif
if (iff_error != IFF_NO_ERROR) {
printf("%s %i\n",filename,PHYSFSX_exists(filename,0));
Error("File %s - IFF error: %s",filename,iff_errormsg(iff_error));
}