Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 9096 → Rev 9097

/contrib/games/wolf3d/Makefile
43,6 → 43,7
SDL_OBJ += SDL/SDL_wave.o
SDL_OBJ += SDL/SDL_audiocvt.o
SDL_OBJ += SDL/SDL_mixer.o
SDL_OBJ += SDL/uSDL.o
 
SDL_MIX_OBJ += SDL_mixer/mixer.o
SDL_MIX_OBJ += SDL_mixer/music.o
/contrib/games/wolf3d/SDL/uSDL.c
0,0 → 1,29
static unsigned __starttime;
 
void uSDL_StartTicks(void){
__asm__ __volatile__ (
"int $0x40"
:"=a"(__starttime)
:"a"(26),"b"(9)
:"memory"
);
}
 
unsigned uSDL_GetTicks(void){
unsigned __curtime;
__asm__ __volatile__(
"int $0x40"
:"=a"(__curtime)
:"a"(26),"b"(9)
:"memory"
);
return (__curtime-__starttime);
}
 
void uSDL_Delay(unsigned time){
__asm__ __volatile__(
"int $0x40"
::"a"(5), "b"(time/3)
:"memory"
);
}
/contrib/games/wolf3d/SDL_mixer/mixer.c
42,6 → 42,14
#define __MIX_INTERNAL_EFFECT__
#include "effects_internal.h"
 
#ifdef _KOLIBRI
void uSDL_Delay(unsigned int time);
unsigned uSDL_GetTicks();
#else
#define uSDL_Delay SDL_Delay
#define uSDL_GetTicks SDL_GetTicks
#endif
 
/* Magic numbers for various audio file formats */
#define RIFF 0x46464952 /* "RIFF" */
#define WAVE 0x45564157 /* "WAVE" */
300,7 → 308,7
}
 
/* Mix any playing channels... */
sdl_ticks = SDL_GetTicks();
sdl_ticks = uSDL_GetTicks();
for ( i=0; i<num_channels; ++i ) {
if( ! mix_channel[i].paused ) {
if ( mix_channel[i].expire > 0 && mix_channel[i].expire < sdl_ticks ) {
857,7 → 865,7
 
/* Queue up the audio data for this channel */
if ( which >= 0 && which < num_channels ) {
Uint32 sdl_ticks = SDL_GetTicks();
Uint32 sdl_ticks = uSDL_GetTicks();
if (Mix_Playing(which))
_Mix_channel_done_playing(which);
mix_channel[which].samples = chunk->abuf;
888,7 → 896,7
}
} else if ( which < num_channels ) {
SDL_LockAudio();
mix_channel[which].expire = (ticks>0) ? (SDL_GetTicks() + ticks) : 0;
mix_channel[which].expire = (ticks>0) ? ( uSDL_GetTicks() + ticks) : 0;
SDL_UnlockAudio();
++ status;
}
927,7 → 935,7
 
/* Queue up the audio data for this channel */
if ( which >= 0 && which < num_channels ) {
Uint32 sdl_ticks = SDL_GetTicks();
Uint32 sdl_ticks = uSDL_GetTicks();
if (Mix_Playing(which))
_Mix_channel_done_playing(which);
mix_channel[which].samples = chunk->abuf;
1046,7 → 1054,7
mix_channel[which].fade_volume = mix_channel[which].volume;
mix_channel[which].fading = MIX_FADING_OUT;
mix_channel[which].fade_length = ms;
mix_channel[which].ticks_fade = SDL_GetTicks();
mix_channel[which].ticks_fade = uSDL_GetTicks();
 
/* only change fade_volume_reset if we're not fading. */
if (mix_channel[which].fading == MIX_NO_FADING) {
1151,7 → 1159,7
/* Pause a particular channel (or all) */
void Mix_Pause(int which)
{
Uint32 sdl_ticks = SDL_GetTicks();
Uint32 sdl_ticks = uSDL_GetTicks();
if ( which == -1 ) {
int i;
 
1170,7 → 1178,7
/* Resume a paused channel */
void Mix_Resume(int which)
{
Uint32 sdl_ticks = SDL_GetTicks();
Uint32 sdl_ticks = uSDL_GetTicks();
 
SDL_LockAudio();
if ( which == -1 ) {
1260,7 → 1268,7
int Mix_GroupOldest(int tag)
{
int chan = -1;
Uint32 mintime = SDL_GetTicks();
Uint32 mintime = uSDL_GetTicks();
int i;
for( i=0; i < num_channels; i ++ ) {
if ( (mix_channel[i].tag==tag || tag==-1) && mix_channel[i].playing > 0
/contrib/games/wolf3d/SDL_mixer/music.c
71,6 → 71,13
static SDL_AudioSpec used_mixer;
#endif
 
#ifdef _KOLIBRI
extern void uSDL_Delay(unsigned int time);
extern unsigned uSDL_GetTicks();
#else
#define uSDL_Delay SDL_Delay
#define uSDL_GetTicks SDL_GetTicks
#endif
 
int volatile music_active = 1;
static int volatile music_stopped = 0;
761,7 → 768,7
/* Wait for any fade out to finish */
while ( music->fading == MIX_FADING_OUT ) {
SDL_UnlockAudio();
SDL_Delay(100);
uSDL_Delay(100);
SDL_LockAudio();
}
if ( music == music_playing ) {
1013,7 → 1020,7
/* If the current music is fading out, wait for the fade to complete */
while ( music_playing && (music_playing->fading == MIX_FADING_OUT) ) {
SDL_UnlockAudio();
SDL_Delay(100);
uSDL_Delay(100);
SDL_LockAudio();
}
music_active = 1;
/contrib/games/wolf3d/Tupfile.lua
22,7 → 22,8
 
-- SDL and SDL_mixer --
compile_gcc{
"SDL/SDL_wave.c", "SDL/SDL_audiocvt.c", "SDL/SDL_mixer.c", "SDL_mixer/mixer.c", "SDL_mixer/music.c", "SDL_mixer/load_aiff.c", "SDL_mixer/load_voc.c",
"SDL/SDL_wave.c", "SDL/SDL_audiocvt.c", "SDL/SDL_mixer.c", "SDL_mixer/mixer.c", "SDL_mixer/music.c",
"SDL_mixer/load_aiff.c", "SDL_mixer/load_voc.c", "SDL/uSDL.c",
"SDL_mixer/effects_internal.c", "SDL_mixer/effect_position.c",
}
 
/contrib/games/wolf3d/id_in.cpp
650,7 → 650,7
IN_ProcessEvents();
if (IN_CheckAck())
return true;
SDL_Delay(5);
uSDL_Delay(5);
} while (GetTimeCount() - lasttime < delay);
return(false);
}
/contrib/games/wolf3d/id_sd.cpp
935,7 → 935,7
 
SD_FadeOutMusic();
while (SD_MusicPlaying())
SDL_Delay(5);
uSDL_Delay(5);
 
switch (mode)
{
1284,7 → 1284,7
SD_WaitSoundDone(void)
{
while (SD_SoundPlaying())
SDL_Delay(5);
uSDL_Delay(5);
}
 
///////////////////////////////////////////////////////////////////////////
/contrib/games/wolf3d/id_sd.h
119,11 → 119,17
extern int DigiMap[];
extern int DigiChannel[];
 
#define GetTimeCount() ((SDL_GetTicks()*7)/100)
#ifdef _KOLIBRI
extern void uSDL_Delay(unsigned time);
#else
#define uSDL_Delay SDL_Delay
#endif
 
#define GetTimeCount() (( uSDL_GetTicks()*7)/100)
 
inline void Delay(int wolfticks)
{
if(wolfticks>0) SDL_Delay(wolfticks * 100 / 7);
if(wolfticks>0) uSDL_Delay(wolfticks * 100/ 7);
}
 
// Function prototypes
/contrib/games/wolf3d/id_us_1.cpp
741,7 → 741,7
 
cursorvis ^= true;
}
else SDL_Delay(5);
else uSDL_Delay(5);
if (cursorvis)
USL_XORICursor(x,y,s,cursor);
 
772,7 → 772,7
void US_InitRndT(int randomize)
{
if(randomize)
rndindex = (SDL_GetTicks() >> 4) & 0xff;
rndindex = ( uSDL_GetTicks() >> 4) & 0xff;
else
rndindex = 0;
}
/contrib/games/wolf3d/id_vl.h
28,7 → 28,7
// VGA hardware routines
//
 
#define VL_WaitVBL(a) SDL_Delay((a)*8)
#define VL_WaitVBL(a) uSDL_Delay((a)*8)
 
void VL_SetVGAPlaneMode (void);
void VL_SetTextMode (void);
/contrib/games/wolf3d/kolibri.cpp
208,3 → 208,4
::"a"(30), "b"(1), "c"(path)
);
}
 
/contrib/games/wolf3d/wl_def.h
24,6 → 24,17
# define O_BINARY 0
#endif
 
#ifdef _KOLIBRI
extern "C"{
extern void uSDL_Delay(unsigned int time);
extern unsigned uSDL_GetTicks();
}
#else
#define uSDL_Delay SDL_Delay
#define uSDL_GetTicks SDL_GetTicks
#endif
 
 
#pragma pack(1)
 
#if defined(_arch_dreamcast)
1391,7 → 1402,7
#endif
#define DEMOCOND_SDL (!DEMOCOND_ORIG)
 
#define GetTicks() ((SDL_GetTicks()*7)/100)
#define GetTicks() (( uSDL_GetTicks()*7)/100)
 
#define ISPOINTER(x) ((((uintptr_t)(x)) & ~0xffff) != 0)
 
1483,3 → 1494,5
#endif
 
#endif
 
 
/contrib/games/wolf3d/wl_draw.cpp
1,6 → 1,7
// WL_DRAW.C
 
#include "wl_def.h"
#include <cstdio>
#pragma hdrstop
 
#include "wl_cloudsky.h"
1073,12 → 1074,12
if (lasttimecount > (int32_t) GetTimeCount())
lasttimecount = GetTimeCount(); // if the game was paused a LONG time
 
uint32_t curtime = SDL_GetTicks();
uint32_t curtime = uSDL_GetTicks();
tics = (curtime * 7) / 100 - lasttimecount;
if(!tics)
{
// wait until end of current tic
SDL_Delay(((lasttimecount + 1) * 100) / 7 - curtime);
uSDL_Delay(((lasttimecount + 1) * 100) / 7 - curtime);
tics = 1;
}
 
/contrib/games/wolf3d/wl_inter.cpp
403,7 → 403,7
static int which = 0, max = 10;
int pics[2] = { L_GUYPIC, L_GUY2PIC };
 
SDL_Delay(5);
uSDL_Delay(5);
 
if ((int32_t) GetTimeCount () - lastBreathTime > max)
{
/contrib/games/wolf3d/wl_main.cpp
27,6 → 27,9
extern void kolibri_set_win_center();
extern char* dirname(char* path);
extern void setcwd(char* path);
extern "C"{
extern void uSDL_StartTicks(void);
}
/*
=============================================================================
 
1126,7 → 1129,7
 
#ifndef SPEAR
#ifndef UPLOAD
start = ((SDL_GetTicks()/10)%3)*6;
start = (( uSDL_GetTicks()/10)%3)*6;
#else
start = 0;
#endif
1217,6 → 1220,9
printf("Unable to init SDL: %s\n", SDL_GetError());
exit(1);
}
#ifdef _KOLIBRI
uSDL_StartTicks();
#endif
SDL_AudioInit(NULL);
atexit(SDL_Quit);
 
1906,8 → 1912,8
" --nowait Skips intro screens\n"
#ifndef _KOLIBRI
" --windowed[-mouse] Starts the game in a window [and grabs mouse]\n"
#endif
" --res <width> <height> Sets the screen resolution\n"
#endif
" (must be multiple of 320x200 or 320x240)\n"
" --resf <w> <h> Sets any screen resolution >= 320x200\n"
" (which may result in graphic errors)\n"
1916,7 → 1922,7
" allowed: 8, 16, 24, 32, default: \"best\" depth)\n"
" --nodblbuf Don't use SDL's double buffering\n"
" --extravbls <vbls> Sets a delay after each frame, which may help to\n"
" reduce flickering (unit is currently 8 ms, default: 0)\n"
" reduce flickering (unit is currently 8 ms, default: 2)\n"
#ifndef _KOLIBRI
" --joystick <index> Use the index-th joystick if available\n"
" (-1 to disable joystick, default: 0)\n"
/contrib/games/wolf3d/wl_menu.cpp
1956,7 → 1956,7
DrawMouseSens ();
do
{
SDL_Delay(5);
uSDL_Delay(5);
ReadAnyControl (&ci);
switch (ci.dir)
{
2228,7 → 2228,7
redraw = 0;
}
 
SDL_Delay(5);
uSDL_Delay(5);
ReadAnyControl (&ci);
 
if (type == MOUSE || type == JOYSTICK)
2274,7 → 2274,7
lastFlashTime = GetTimeCount();
VW_UpdateScreen ();
}
else SDL_Delay(5);
else uSDL_Delay(5);
 
//
// WHICH TYPE OF INPUT DO WE PROCESS?
2397,7 → 2397,7
while (!cust->allowed[which]);
redraw = 1;
SD_PlaySound (MOVEGUN1SND);
while (ReadAnyControl (&ci), ci.dir != dir_None) SDL_Delay(5);
while (ReadAnyControl (&ci), ci.dir != dir_None) uSDL_Delay(5);
IN_ClearKeysDown ();
break;
 
2411,7 → 2411,7
while (!cust->allowed[which]);
redraw = 1;
SD_PlaySound (MOVEGUN1SND);
while (ReadAnyControl (&ci), ci.dir != dir_None) SDL_Delay(5);
while (ReadAnyControl (&ci), ci.dir != dir_None) uSDL_Delay(5);
IN_ClearKeysDown ();
break;
case dir_North:
2837,7 → 2837,7
do
{
CheckPause ();
SDL_Delay(5);
uSDL_Delay(5);
ReadAnyControl (&ci);
switch (ci.dir)
{
3284,7 → 3284,7
routine (which);
VW_UpdateScreen ();
}
else SDL_Delay(5);
else uSDL_Delay(5);
 
CheckPause ();
 
3484,7 → 3484,7
VWB_DrawPic (x, y, C_CURSOR1PIC);
VW_UpdateScreen ();
SD_PlaySound (MOVEGUN1SND);
SDL_Delay(1); //Fixed too long delay in the menu
uSDL_Delay(1); //Fixed too long delay in the menu
}
 
 
3526,7 → 3526,7
int32_t startTime = GetTimeCount ();
do
{
SDL_Delay(5);
uSDL_Delay(5);
ReadAnyControl (&ci);
}
while ((int32_t) GetTimeCount () - startTime < count && ci.dir != dir_None);
3732,7 → 3732,7
tick ^= 1;
lastBlinkTime = GetTimeCount();
}
else SDL_Delay(5);
else uSDL_Delay(5);
 
#ifdef SPANISH
}
/contrib/games/wolf3d/wl_play.cpp
211,7 → 211,7
XFUNKIE_MUS,
XDEATH_MUS,
XGETYOU_MUS, // DON'T KNOW
ULTIMATE_MUS, // Trans Gr”sse
ULTIMATE_MUS, // Trans Gr�sse
 
DUNGEON_MUS,
GOINGAFT_MUS,
406,11 → 406,11
if (demoplayback || demorecord) // demo recording and playback needs to be constant
{
// wait up to DEMOTICS Wolf tics
uint32_t curtime = SDL_GetTicks();
uint32_t curtime = uSDL_GetTicks();
lasttimecount += DEMOTICS;
int32_t timediff = (lasttimecount * 100) / 7 - curtime;
if(timediff > 0)
SDL_Delay(timediff);
uSDL_Delay(timediff);
 
if(timediff < -2 * DEMOTICS) // more than 2-times DEMOTICS behind?
lasttimecount = (curtime * 7) / 100; // yes, set to current timecount
/contrib/games/wolf3d/wl_text.cpp
669,7 → 669,7
firstpage = false;
}
}
SDL_Delay(5);
uSDL_Delay(5);
 
LastScan = 0;
ReadAnyControl(&ci);