Miscellaneous corrections
This commit is contained in:
@@ -101,7 +101,7 @@ void Anim_Draw(Anim a,int time_ms,int x,int y){
|
||||
Animation *anim=a;
|
||||
int frame;
|
||||
|
||||
frame=(time_ms%anim->time)/anim->ftime;
|
||||
frame=(time_ms/anim->ftime)%anim->frames;
|
||||
Draw_DrawImgPart(anim->img,x,y,anim->w,frame);
|
||||
}
|
||||
|
||||
|
||||
@@ -451,7 +451,6 @@ int Draw_LoopIteration(){
|
||||
SDL_GL_SwapBuffers();
|
||||
|
||||
// Process Events
|
||||
Input_SetKey(InputKey_Exit,0);
|
||||
while(SDL_PollEvent(&event) ){
|
||||
if(event.type == SDL_QUIT ){
|
||||
Input_SetKey(InputKey_Exit,1);
|
||||
@@ -494,6 +493,7 @@ int Draw_LoopIteration(){
|
||||
Input_Frame();
|
||||
_proc_func(_data);
|
||||
_accTime-=proc_t_frame;
|
||||
Input_SetKey(InputKey_Exit,0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -636,12 +636,14 @@ int Entity_CollisionInfoResponse(CollisionInfo collInfo){
|
||||
// Handle colision
|
||||
int response=1;
|
||||
int rc;
|
||||
vec2 n1;
|
||||
vec2 n2;
|
||||
vec2_copy(n1,collInfo->n);
|
||||
vec2_scale(n2,collInfo->n,-1.0f);
|
||||
|
||||
// Check the collision methods
|
||||
if(collInfo->ent1->collision){
|
||||
rc=collInfo->ent1->collision(collInfo->ent1,collInfo->ent2,collInfo->t,collInfo->n);
|
||||
rc=collInfo->ent1->collision(collInfo->ent1,collInfo->ent2,collInfo->t,n1);
|
||||
if (rc==0)
|
||||
response=0;
|
||||
if (rc>1)
|
||||
@@ -667,7 +669,7 @@ int Entity_CollisionInfoResponse(CollisionInfo collInfo){
|
||||
{
|
||||
Entity_CollisionResponseCircle(collInfo->ent1,collInfo->ent2,collInfo->t,n2);
|
||||
}else{
|
||||
Entity_CollisionResponseCircle(collInfo->ent2,collInfo->ent1,collInfo->t,collInfo->n);
|
||||
Entity_CollisionResponseCircle(collInfo->ent2,collInfo->ent1,collInfo->t,n1);
|
||||
}
|
||||
}
|
||||
return(1);
|
||||
|
||||
@@ -27,7 +27,7 @@ void (*_gameproc)()=NULL;
|
||||
void (*_gamepostproc)()=NULL;
|
||||
void (*_gamepredraw)(float f)=NULL;
|
||||
void (*_gamedraw)(float f)=NULL;
|
||||
int _ft;
|
||||
int _pft;
|
||||
int _game_size[2];
|
||||
int _game_pos0[2];
|
||||
int _game_pos1[2];
|
||||
@@ -63,7 +63,7 @@ int GameLib_Init(int w,int h,char *title,int pfps,int fps){
|
||||
_game_pos1[0]=0;
|
||||
_game_pos1[1]=0;
|
||||
|
||||
_ft=1000/fps;
|
||||
_pft=1000/pfps;
|
||||
|
||||
return(1);
|
||||
}
|
||||
@@ -105,6 +105,8 @@ void GameLib_AddEntity(Entity e){
|
||||
|
||||
// Mark for light update
|
||||
Entity_MarkUpdateLight(e,_entity,_n_entities);
|
||||
|
||||
Entity_CalcBBox(e);
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +196,7 @@ void GameLib_ProcLoop(void *data){
|
||||
|
||||
// Step the gamePosition
|
||||
_game_pos0[0]=_game_pos1[0];
|
||||
_game_pos0[0]=_game_pos1[0];
|
||||
_game_pos0[1]=_game_pos1[1];
|
||||
|
||||
// Process
|
||||
time=Time_GetTime();
|
||||
@@ -205,7 +207,7 @@ void GameLib_ProcLoop(void *data){
|
||||
for(i=0;i<_n_entities;i++){
|
||||
if(!_entity[i])
|
||||
continue;
|
||||
Entity_Process(_entity[i],_ft);
|
||||
Entity_Process(_entity[i],_pft);
|
||||
}
|
||||
GameLib_Compactate();
|
||||
t_proc+=Time_GetTime()-time;
|
||||
@@ -311,7 +313,7 @@ void GameLib_ProcLoop(void *data){
|
||||
time=Time_GetTime();
|
||||
GameLib_Compactate();_entities_lock=1;
|
||||
for(i=0;i<_n_entities;i++){
|
||||
Entity_PostProcess(_entity[i],_ft);
|
||||
Entity_PostProcess(_entity[i],_pft);
|
||||
if(_entity[i]->flags&EntityFlag_UpdatedPos){
|
||||
Entity_MarkUpdateLight(_entity[i],_entity,_n_entities);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user