Replace SDL_GetTicks

This commit is contained in:
twinaphex 2015-09-10 03:47:14 +02:00
parent a288fb19d1
commit cff6e398de
9 changed files with 24 additions and 11 deletions

View File

@ -58,6 +58,7 @@ SRCS += wl_menu.cpp
SRCS += wl_play.cpp
SRCS += wl_state.cpp
SRCS += wl_text.cpp
SRCS += surface.cpp
SRCS += SDL_mixer/effect_position.cpp
SRCS += SDL_mixer/effects_internal.cpp
SRCS += SDL_mixer/mixer.cpp

View File

@ -21,6 +21,7 @@ SOURCES_C += $(CORE_DIR)/wl_menu.c
SOURCES_C += $(CORE_DIR)/wl_play.c
SOURCES_C += $(CORE_DIR)/wl_state.c
SOURCES_C += $(CORE_DIR)/wl_text.c
SOURCES_C += $(CORE_DIR)/surface.c
SOURCES_C += $(CORE_DIR)/SDL_mixer/effect_position.c
SOURCES_C += $(CORE_DIR)/SDL_mixer/effects_internal.c
SOURCES_C += $(CORE_DIR)/SDL_mixer/mixer.c

View File

@ -28,6 +28,7 @@
#include "SDL_timer.h"
#include "SDL_mixer.h"
#include "../surface.h"
#define __MIX_INTERNAL_EFFECT__
#include "effects_internal.h"
@ -190,7 +191,7 @@ static void mix_channels(void *udata, Uint8 *stream, int len)
mix_music(music_data, stream, len);
/* Mix any playing channels... */
sdl_ticks = SDL_GetTicks();
sdl_ticks = LR_GetTicks();
for ( i=0; i<num_channels; ++i )
{
if( ! mix_channel[i].paused )
@ -688,7 +689,7 @@ int Mix_PlayChannelTimed(int which, Mix_Chunk *chunk, int loops, int ticks)
/* Queue up the audio data for this channel */
if ( which >= 0 && which < num_channels )
{
Uint32 sdl_ticks = SDL_GetTicks();
Uint32 sdl_ticks = LR_GetTicks();
if (Mix_Playing(which))
_Mix_channel_done_playing(which);
mix_channel[which].samples = chunk->abuf;
@ -718,7 +719,7 @@ int Mix_ExpireChannel(int which, int ticks)
}
else if ( which < num_channels )
{
mix_channel[which].expire = (ticks>0) ? (SDL_GetTicks() + ticks) : 0;
mix_channel[which].expire = (ticks>0) ? (LR_GetTicks() + ticks) : 0;
++ status;
}
return(status);
@ -880,7 +881,7 @@ void Mix_CloseAudio(void)
/* Pause a particular channel (or all) */
void Mix_Pause(int which)
{
Uint32 sdl_ticks = SDL_GetTicks();
Uint32 sdl_ticks = LR_GetTicks();
if ( which == -1 )
{
int i;
@ -901,7 +902,7 @@ void Mix_Pause(int which)
/* Resume a paused channel */
void Mix_Resume(int which)
{
Uint32 sdl_ticks = SDL_GetTicks();
Uint32 sdl_ticks = LR_GetTicks();
if (which == -1)
{
@ -995,7 +996,7 @@ int Mix_GroupOldest(int tag)
{
int i;
int chan = -1;
Uint32 mintime = SDL_GetTicks();
Uint32 mintime = LR_GetTicks();
for( i=0; i < num_channels; i ++ )
{

View File

@ -8,6 +8,8 @@
#ifndef __ID_SD__
#define __ID_SD__
#include "surface.h"
#define TickBase 70 // 70Hz per tick - used as a base for timer 0
typedef enum
@ -117,7 +119,7 @@ extern SMMode MusicMode;
extern int DigiMap[];
extern int DigiChannel[];
#define GetTimeCount() ((SDL_GetTicks()*7)/100)
#define GetTimeCount() ((LR_GetTicks()*7)/100)
static inline void Delay(int wolfticks)
{

View File

@ -750,7 +750,7 @@ US_LineInput(int x,int y,char *buf,const char *def,boolean escok,
void US_InitRndT(int randomize)
{
if(randomize)
rndindex = (SDL_GetTicks() >> 4) & 0xff;
rndindex = (LR_GetTicks() >> 4) & 0xff;
else
rndindex = 0;
}

8
surface.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef SURFACE_H
#define SURFACE_H
#include <stdint.h>
uint32_t LR_GetTicks(void);
#endif

View File

@ -1334,7 +1334,7 @@ static inline fixed FixedMul(fixed a, fixed b)
#endif
#define DEMOCOND_SDL (!DEMOCOND_ORIG)
#define GetTicks() ((SDL_GetTicks()*7)/100)
#define GetTicks() ((LR_GetTicks()*7)/100)
#define ISPOINTER(x) ((((uintptr_t)(x)) & ~0xffff) != 0)

View File

@ -1022,7 +1022,7 @@ void CalcTics (void)
if (lasttimecount > (int32_t) GetTimeCount())
lasttimecount = GetTimeCount(); /* if the game was paused a LONG time */
curtime = SDL_GetTicks();
curtime = LR_GetTicks();
tics = (curtime * 7) / 100 - lasttimecount;
if(!tics)

View File

@ -1036,7 +1036,7 @@ void DoJukebox(void)
#ifndef SPEAR
#ifndef UPLOAD
start = ((SDL_GetTicks()/10)%3)*6;
start = ((LR_GetTicks()/10)%3)*6;
#else
start = 0;
#endif