Skip to content

Commit

Permalink
added posix option to the vorbis lib: it is buildable under Linux wit…
Browse files Browse the repository at this point in the history
…h -DHAVE_ALLOCA_H=1;

Anim_SetNextFrame: changed conditions to avoid skipping state changes in extreme fps drops;
fixed z positioning in Character_MoveOnFloor(...);
  • Loading branch information
TeslaRus committed Jan 21, 2017
1 parent 9250cb8 commit 2ff4090
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 38 deletions.
3 changes: 3 additions & 0 deletions extern/ogg/libvorbis/block.c
Expand Up @@ -21,6 +21,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#include "../ogg.h"
#include "../codec.h"
#include "codec_internal.h"
Expand Down
3 changes: 3 additions & 0 deletions extern/ogg/libvorbis/codebook.c
Expand Up @@ -18,6 +18,9 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#include "../ogg.h"
#include "../codec.h"
#include "codebook.h"
Expand Down
3 changes: 3 additions & 0 deletions extern/ogg/libvorbis/envelope.c
Expand Up @@ -19,6 +19,9 @@
#include <string.h>
#include <stdio.h>
#include <math.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#include "../ogg.h"
#include "../codec.h"
#include "codec_internal.h"
Expand Down
3 changes: 3 additions & 0 deletions extern/ogg/libvorbis/info.c
Expand Up @@ -21,6 +21,9 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#include "../ogg.h"
#include "../codec.h"
#include "codec_internal.h"
Expand Down
3 changes: 3 additions & 0 deletions extern/ogg/libvorbis/lpc.c
Expand Up @@ -46,6 +46,9 @@ Carsten Bormann
#include <stdlib.h>
#include <string.h>
#include <math.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#include "os.h"
#include "smallft.h"
#include "lpc.h"
Expand Down
3 changes: 3 additions & 0 deletions extern/ogg/libvorbis/lsp.c
Expand Up @@ -35,6 +35,9 @@
#include <math.h>
#include <string.h>
#include <stdlib.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#include "lsp.h"
#include "os.h"
#include "misc.h"
Expand Down
3 changes: 3 additions & 0 deletions extern/ogg/libvorbis/mapping0.c
Expand Up @@ -19,6 +19,9 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#include "../ogg.h"
#include "../codec.h"
#include "codec_internal.h"
Expand Down
3 changes: 3 additions & 0 deletions extern/ogg/libvorbis/mdct.c
Expand Up @@ -41,6 +41,9 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#include "../codec.h"
#include "mdct.h"
#include "os.h"
Expand Down
3 changes: 3 additions & 0 deletions extern/ogg/libvorbis/psy.c
Expand Up @@ -18,6 +18,9 @@
#include <stdlib.h>
#include <math.h>
#include <string.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#include "../codec.h"
#include "codec_internal.h"

Expand Down
3 changes: 3 additions & 0 deletions extern/ogg/libvorbis/res0.c
Expand Up @@ -23,6 +23,9 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#include "../ogg.h"
#include "../codec.h"
#include "codec_internal.h"
Expand Down
3 changes: 3 additions & 0 deletions extern/ogg/libvorbis/sharedbook.c
Expand Up @@ -18,6 +18,9 @@
#include <stdlib.h>
#include <math.h>
#include <string.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#include "../ogg.h"
#include "../codec.h"
#include "os.h"
Expand Down
3 changes: 3 additions & 0 deletions extern/ogg/libvorbis/vorbisfile.c
Expand Up @@ -20,6 +20,9 @@
#include <errno.h>
#include <string.h>
#include <math.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif

#include "../codec.h"

Expand Down
4 changes: 0 additions & 4 deletions src/anim_state_control.cpp
Expand Up @@ -1199,10 +1199,6 @@ int State_Control_Lara(struct entity_s *ent, struct ss_animation_s *ss_anim)
pos[2] = curr_fc->floor_hit.point[2];
ent->dir_flag = ENT_MOVE_BACKWARD;
}
else
{
ent->dir_flag = ENT_STAY; // waiting for correct frame
}
}
else if((cmd->move[0] == -1) && ((cmd->shift) || (ent->character->height_info.quicksand)))
{
Expand Down
42 changes: 9 additions & 33 deletions src/character_controller.cpp
Expand Up @@ -486,7 +486,7 @@ int Character_HasStopSlant(struct entity_s *ent, height_info_p next_fc)

void Character_FixPosByFloorInfoUnderLegs(struct entity_s *ent)
{
if(ent->no_fix_all == 0)
if(0 && ent->no_fix_all == 0)
{
height_info_p hi = &ent->character->height_info;
float *pos = ent->transform + 12;
Expand Down Expand Up @@ -1050,35 +1050,12 @@ int Character_MoveOnFloor(struct entity_s *ent)
* check move type
*/

if(!ent->character->height_info.floor_hit.hit || (ent->character->height_info.floor_hit.point[2] + ent->character->fall_down_height < pos[2]))
if(ent->character->height_info.floor_hit.hit && (pos[2] < ent->character->height_info.floor_hit.point[2] + ent->character->fall_down_height))
{
tv[0] = pos[0];
tv[1] = pos[1];
tv[2] = pos[2] - ent->character->max_step_up_height;
move[0] = pos[0];
move[1] = pos[1];
move[2] = pos[2] + 24.0f;
Physics_SphereTest(&ent->character->height_info.floor_hit, move, tv, 16.0f, ent->self, COLLISION_FILTER_HEIGHT_TEST);
ent->character->height_info.floor_hit.normale[0] = 0.0f;
ent->character->height_info.floor_hit.normale[1] = 0.0f;
ent->character->height_info.floor_hit.normale[2] = 1.0f;
}

if(ent->character->height_info.floor_hit.hit || (ent->character->resp.vertical_collide & 0x01))
{
if(ent->character->height_info.floor_hit.point[2] + ent->character->fall_down_height < pos[2])
{
ent->move_type = MOVE_FREE_FALLING;
ent->speed[2] = 0.0;
return -1; // nothing to do here
}
else
{
ent->character->resp.vertical_collide |= 0x01;
}

ent->character->resp.vertical_collide |= 0x01;
vec3_copy(tv, ent->character->height_info.floor_hit.normale);
if(ent->character->height_info.floor_hit.hit && tv[2] > 0.02 && tv[2] < ent->character->critical_slant_z_component)

if((tv[2] > 0.02) && (tv[2] < ent->character->critical_slant_z_component))
{
tv[2] = -tv[2];
t = ent->character->linear_speed_mult * DEFAULT_CHARACTER_SLIDE_SPEED_MULT;
Expand All @@ -1099,14 +1076,13 @@ int Character_MoveOnFloor(struct entity_s *ent)
// back forward slide down
}
Entity_UpdateTransform(ent);
ent->character->resp.vertical_collide |= 0x01;
}
else // no slide - free to walk
{
t = ent->anim_linear_speed * ent->character->linear_speed_mult;
ent->character->resp.vertical_collide |= 0x01;

ent->angles[0] += ROT_SPEED_LAND * 60.0f * ent->character->rotate_speed_mult * engine_frame_time * ent->character->cmd.rot[0];
ent->angles[0] += ROT_SPEED_LAND * 60.0f * ent->character->rotate_speed_mult * engine_frame_time * (float)ent->character->cmd.rot[0];

Entity_UpdateTransform(ent); // apply rotations

Expand Down Expand Up @@ -1146,7 +1122,7 @@ int Character_MoveOnFloor(struct entity_s *ent)
/*
* now move normally
*/
if(ent->character->height_info.floor_hit.hit && (ent->character->height_info.floor_hit.point[2] + 1.0 >= ent->transform[12 + 2] + ent->bf->bb_min[2]))
if(ent->character->height_info.floor_hit.hit && (ent->character->height_info.floor_hit.point[2] + 1.0f >= pos[2] + ent->bf->bb_min[2]))
{
engine_container_p cont = ent->character->height_info.floor_hit.obj;
if((cont != NULL) && (cont->object_type == OBJECT_ENTITY))
Expand Down Expand Up @@ -1187,7 +1163,6 @@ int Character_MoveOnFloor(struct entity_s *ent)
if(t < 0.0f)
{
pos[2] = ent->character->height_info.floor_hit.point[2];
Entity_FixPenetrations(ent, NULL, COLLISION_FILTER_CHARACTER);
ent->character->resp.vertical_collide |= 0x01;
ent->character->resp.step_z = (t < -ent->character->min_step_up_height) ? (0x01) : (0x00);
pos[2] = ent->character->height_info.floor_hit.point[2];
Expand All @@ -1196,6 +1171,7 @@ int Character_MoveOnFloor(struct entity_s *ent)
{
ent->character->resp.step_z = (t > ent->character->min_step_up_height) ? (0x02) : (0x00);
pos[2] -= engine_frame_time * 2400.0; ///@FIXME: magick
pos[2] = (pos[2] >= ent->character->height_info.floor_hit.point[2]) ? (pos[2]) : (ent->character->height_info.floor_hit.point[2]);
}
}
else
Expand Down Expand Up @@ -1911,7 +1887,7 @@ int Character_CheckTraverse(struct entity_s *ch, struct entity_s *obj)
float from[3], to[3];
from[0] = ch_s->pos[0];
from[1] = ch_s->pos[1];
from[2] = floor + 0.5 * TR_METERING_SECTORSIZE;
from[2] = floor + 0.5f * TR_METERING_SECTORSIZE;

to[0] = next_s->pos[0];
to[1] = next_s->pos[1];
Expand Down
4 changes: 3 additions & 1 deletion src/skeletal_model.c
Expand Up @@ -806,7 +806,9 @@ int Anim_SetNextFrame(struct ss_animation_s *ss_anim, float time)
anim_dispatch_p disp = stc->anim_dispatch;
for(uint16_t i = 0; i < stc->anim_dispatch_count; i++, disp++)
{
if((next_anim->max_frame == 1) || (disp->frame_high >= disp->frame_low) && ((new_frame >= disp->frame_low) && (new_frame <= disp->frame_high)))
if((next_anim->max_frame == 1) ||
(new_frame >= disp->frame_low) && (new_frame <= disp->frame_high) ||
(ss_anim->next_frame <= disp->frame_high) && (new_frame >= disp->frame_high))
{
ss_anim->current_animation = ss_anim->next_animation;
ss_anim->current_frame = ss_anim->next_frame;
Expand Down

0 comments on commit 2ff4090

Please sign in to comment.