1)patched teleport bug; 2)waveout sound

git-svn-id: svn://kolibrios.org@342 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-02-13 04:00:47 +00:00
parent 579829b9f9
commit 3ea0750ebe
12 changed files with 2701 additions and 2665 deletions

View File

@ -436,7 +436,7 @@ void D_DoomLoop (void)
S_UpdateSounds (players[consoleplayer].mo);// move positional sounds
D_Display ();
// I_UpdateSound();
// I_UpdateSound();
XXX(105);
}
}
@ -1120,8 +1120,8 @@ void D_DoomMain (void)
printf ("D_CheckNetGame: Checking network game status.\n\r");
D_CheckNetGame ();
// printf ("S_Init: Setting up sound.\n\r");
// S_Init (snd_SfxVolume /* *8 */, snd_MusicVolume /* *8*/ );
printf ("S_Init: Setting up sound.\n\r");
S_Init (snd_SfxVolume /* *8 */, snd_MusicVolume /* *8*/ );
printf ("HU_Init: Setting up heads up display.\n\r");
HU_Init ();

View File

@ -42,25 +42,25 @@
// to provide a complete scene geometry description.
enum
{
ML_LABEL, // A separator, name, ExMx or MAPxx
ML_THINGS, // Monsters, items..
ML_LINEDEFS, // LineDefs, from editing
ML_SIDEDEFS, // SideDefs, from editing
ML_VERTEXES, // Vertices, edited and BSP splits generated
ML_SEGS, // LineSegs, from LineDefs split by BSP
ML_SSECTORS, // SubSectors, list of LineSegs
ML_NODES, // BSP nodes
ML_SECTORS, // Sectors, from editing
ML_REJECT, // LUT, sector-sector visibility
ML_BLOCKMAP // LUT, motion clipping, walls/grid element
ML_LABEL, // A separator, name, ExMx or MAPxx
ML_THINGS, // Monsters, items..
ML_LINEDEFS, // LineDefs, from editing
ML_SIDEDEFS, // SideDefs, from editing
ML_VERTEXES, // Vertices, edited and BSP splits generated
ML_SEGS, // LineSegs, from LineDefs split by BSP
ML_SSECTORS, // SubSectors, list of LineSegs
ML_NODES, // BSP nodes
ML_SECTORS, // Sectors, from editing
ML_REJECT, // LUT, sector-sector visibility
ML_BLOCKMAP // LUT, motion clipping, walls/grid element
};
// A single Vertex.
typedef struct
{
short x;
short y;
short x;
short y;
} mapvertex_t;
@ -68,13 +68,13 @@ typedef struct
// by setting textures and offsets.
typedef struct
{
short textureoffset;
short rowoffset;
char toptexture[8];
char bottomtexture[8];
char midtexture[8];
short textureoffset;
short rowoffset;
char toptexture[8];
char bottomtexture[8];
char midtexture[8];
// Front sector, towards viewer.
short sector;
short sector;
} mapsidedef_t;
@ -83,13 +83,13 @@ typedef struct
// to the BSP builder.
typedef struct
{
short v1;
short v2;
short flags;
short special;
short tag;
short v1;
short v2;
short flags;
short special;
short tag;
// sidenum[1] will be -1 if one sided
short sidenum[2];
short sidenum[2];
} maplinedef_t;
@ -98,14 +98,14 @@ typedef struct
//
// Solid, is an obstacle.
#define ML_BLOCKING 1
#define ML_BLOCKING 1
// Blocks monsters only.
#define ML_BLOCKMONSTERS 2
#define ML_BLOCKMONSTERS 2
// Backside will not be present at all
// if not two sided.
#define ML_TWOSIDED 4
#define ML_TWOSIDED 4
// If a texture is pegged, the texture will have
// the end exposed to air held constant at the
@ -117,44 +117,44 @@ typedef struct
// top and bottom textures (use next to windows).
// upper texture unpegged
#define ML_DONTPEGTOP 8
#define ML_DONTPEGTOP 8
// lower texture unpegged
#define ML_DONTPEGBOTTOM 16
#define ML_DONTPEGBOTTOM 16
// In AutoMap: don't map as two sided: IT'S A SECRET!
#define ML_SECRET 32
#define ML_SECRET 32
// Sound rendering: don't let sound cross two of these.
#define ML_SOUNDBLOCK 64
#define ML_SOUNDBLOCK 64
// Don't draw on the automap at all.
#define ML_DONTDRAW 128
#define ML_DONTDRAW 128
// Set if already seen, thus drawn in automap.
#define ML_MAPPED 256
#define ML_MAPPED 256
// Sector definition, from editing.
typedef struct
typedef struct
{
short floorheight;
short ceilingheight;
char floorpic[8];
char ceilingpic[8];
short lightlevel;
short special;
short tag;
short floorheight;
short ceilingheight;
char floorpic[8];
char ceilingpic[8];
short lightlevel;
short special;
short tag;
} mapsector_t;
// SubSector, as generated by BSP.
typedef struct
{
short numsegs;
short numsegs;
// Index of first one, segs are stored sequentially.
short firstseg;
short firstseg;
} mapsubsector_t;
@ -162,12 +162,12 @@ typedef struct
// using partition lines selected by BSP builder.
typedef struct
{
short v1;
short v2;
short angle;
short linedef;
short side;
short offset;
short v1;
short v2;
short angle;
short linedef;
short side;
short offset;
} mapseg_t;
@ -175,23 +175,23 @@ typedef struct
// BSP node structure.
// Indicate a leaf.
#define NF_SUBSECTOR 0x8000
#define NF_SUBSECTOR 0x8000
typedef struct
{
// Partition line from (x,y) to x+dx,y+dy)
short x;
short y;
short dx;
short dy;
short x;
short y;
short dx;
short dy;
// Bounding box for each child,
// clip against view frustum.
short bbox[2][4];
short bbox[2][4];
// If NF_SUBSECTOR its a subsector,
// else it's a node of another subtree.
unsigned short children[2];
unsigned short children[2];
} mapnode_t;
@ -202,18 +202,18 @@ typedef struct
// plus skill/visibility flags and attributes.
typedef struct
{
short x;
short y;
short angle;
short type;
short options;
short x;
short y;
short angle;
short type;
short options;
} mapthing_t;
#endif // __DOOMDATA__
#endif // __DOOMDATA__
//-----------------------------------------------------------------------------
//
// $Log:$

View File

@ -23,7 +23,7 @@
#ifndef __R_DEFS__
#define __R_DEFS__
#include "doomtype.h"
// Screenwidth.
#include "doomdef.h"

View File

@ -48,6 +48,8 @@ rcsid[] = "$Id: i_unix.c,v 1.5 1997/02/03 22:45:10 b1 Exp $";
#include "doomdef.h"
#include "kolibri.h"
// The number of internal mixing channels,
// the samples calculated for each mixing step,
// the size of the 16bit, 2 hardware channel (stereo)
@ -55,14 +57,14 @@ rcsid[] = "$Id: i_unix.c,v 1.5 1997/02/03 22:45:10 b1 Exp $";
// Needed for calling the actual sound output.
#define SAMPLECOUNT 512
#define SAMPLECOUNT 8192
#define NUM_CHANNELS 16
// It is 2 for 16bit, and 2 for two channels.
#define BUFMUL 4
#define BUFMUL 4
#define MIXBUFFERSIZE (SAMPLECOUNT*BUFMUL)
#define SAMPLERATE 11025 // Hz
#define SAMPLESIZE 2 // 16bit
#define SAMPLERATE 11025 // Hz
#define SAMPLESIZE 2 // 16bit
// The actual lengths of all sound effects.
int lengths[NUMSFX];
@ -332,8 +334,8 @@ void I_SetChannels()
channels[i] = 0;
}
// for (i=-128 ; i<128 ; i++)
// steptablemid[i] = (int)(pow(2.0, (i/64.0))*65536.0);
for (i=-128 ; i<128 ; i++)
steptablemid[i] = (int)(pow(2.0, (i/64.0))*65536.0);
// Generates volume lookup tables
// which also turn the unsigned samples
@ -423,6 +425,10 @@ int I_SoundIsPlaying(int handle)
//
// This function currently supports only 16bit.
//
extern DWORD hMixBuff[4];
extern int mix_ptr;
void I_UpdateSound( void )
{
@ -441,6 +447,9 @@ void I_UpdateSound( void )
// Mixing channel index.
int chan;
int i;
int flags;
flags = 0;
// Left and right channel
// are in global mixbuffer, alternating.
@ -455,7 +464,7 @@ void I_UpdateSound( void )
// Mix sounds into the mixing buffer.
// Loop over step*SAMPLECOUNT,
// that is 512 values for two channels.
while (leftout != leftend)
for (i=0; i < 8192; i++)
{
// Reset left/right value.
dl = 0;
@ -469,6 +478,8 @@ void I_UpdateSound( void )
// Check channel, if active.
if (channels[ chan ])
{
flags=1;
// Get the raw data from the channel.
sample = *channels[ chan ];
// Add left and right part
@ -515,7 +526,10 @@ void I_UpdateSound( void )
leftout += step;
rightout += step;
}
// I_SubmitSound(mixbuffer);
if(flags)
{ WaveOut(hMixBuff[mix_ptr],(char*)&mixbuffer[0],32768);
mix_ptr= (mix_ptr+1)&3;
};
}

View File

@ -99,7 +99,7 @@ int I_GetTime (void)
void I_Init (void)
{
I_InitGraphics();
// I_InitSound();
I_InitSound();
}
//

View File

@ -17,7 +17,7 @@
// $Log:$
//
// DESCRIPTION:
// Fixed point implementation.
// Fixed point implementation.
//
//-----------------------------------------------------------------------------
@ -42,8 +42,8 @@ rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";
fixed_t
FixedMul
( fixed_t a,
fixed_t b )
( fixed_t a,
fixed_t b )
{
return ((long long) a * (long long) b) >> FRACBITS;
}
@ -56,11 +56,11 @@ FixedMul
fixed_t
FixedDiv
( fixed_t a,
fixed_t b )
( fixed_t a,
fixed_t b )
{
if ( (abs(a)>>14) >= abs(b))
return (a^b)<0 ? MININT : MAXINT;
return (a^b)<0 ? MININT : MAXINT;
return FixedDiv2 (a,b);
}
@ -68,8 +68,8 @@ FixedDiv
fixed_t
FixedDiv2
( fixed_t a,
fixed_t b )
( fixed_t a,
fixed_t b )
{
#if 0
long long c;
@ -82,6 +82,6 @@ FixedDiv2
c = ((double)a) / ((double)b) * FRACUNIT;
if (c >= 2147483648.0 || c < -2147483648.0)
I_Error("FixedDiv: divide by zero");
I_Error("FixedDiv: divide by zero");
return (fixed_t) c;
}

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@
// $Log:$
//
// DESCRIPTION:
// Teleportation.
// Teleportation.
//
//-----------------------------------------------------------------------------
@ -25,7 +25,7 @@ static const char
rcsid[] = "$Id: p_telept.c,v 1.3 1997/01/28 22:08:29 b1 Exp $";
#include "doomtype.h"
#include "doomdef.h"
#include "s_sound.h"
@ -46,86 +46,86 @@ rcsid[] = "$Id: p_telept.c,v 1.3 1997/01/28 22:08:29 b1 Exp $";
//
int
EV_Teleport
( line_t* line,
int side,
mobj_t* thing )
( line_t* line,
int side,
mobj_t* thing )
{
int i;
int tag;
mobj_t* m;
mobj_t* fog;
unsigned an;
thinker_t* thinker;
sector_t* sector;
fixed_t oldx;
fixed_t oldy;
fixed_t oldz;
int i;
int tag;
mobj_t* m;
mobj_t* fog;
unsigned an;
thinker_t* thinker;
sector_t* sector;
fixed_t oldx;
fixed_t oldy;
fixed_t oldz;
// don't teleport missiles
if (thing->flags & MF_MISSILE)
return 0;
return 0;
// Don't teleport if hit back of line,
// so you can get out of teleporter.
if (side == 1)
return 0;
return 0;
tag = line->tag;
for (i = 0; i < numsectors; i++)
{
if (sectors[ i ].tag == tag )
{
thinker = thinkercap.next;
for (thinker = thinkercap.next;
thinker != &thinkercap;
thinker = thinker->next)
{
// not a mobj
if (thinker->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (sectors[ i ].tag == tag )
{
thinker = thinkercap.next;
for (thinker = thinkercap.next;
thinker != &thinkercap;
thinker = thinker->next)
{
// not a mobj
if (thinker->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
m = (mobj_t *)thinker;
m = (mobj_t *)thinker;
// not a teleportman
if (m->type != MT_TELEPORTMAN )
continue;
// not a teleportman
if (m->type != MT_TELEPORTMAN )
continue;
sector = m->subsector->sector;
// wrong sector
if (sector-sectors != i )
continue;
sector = m->subsector->sector;
// wrong sector
if (sector-sectors != i )
continue;
oldx = thing->x;
oldy = thing->y;
oldz = thing->z;
oldx = thing->x;
oldy = thing->y;
oldz = thing->z;
if (!P_TeleportMove (thing, m->x, m->y))
return 0;
if (!P_TeleportMove (thing, m->x, m->y))
return 0;
thing->z = thing->floorz; //fixme: not needed?
if (thing->player)
thing->player->viewz = thing->z+thing->player->viewheight;
thing->z = thing->floorz; //fixme: not needed?
if (thing->player)
thing->player->viewz = thing->z+thing->player->viewheight;
// spawn teleport fog at source and destination
fog = P_SpawnMobj (oldx, oldy, oldz, MT_TFOG);
S_StartSound (fog, sfx_telept);
an = m->angle >> ANGLETOFINESHIFT;
fog = P_SpawnMobj (m->x+20*finecosine[an], m->y+20*finesine[an]
, thing->z, MT_TFOG);
// spawn teleport fog at source and destination
fog = P_SpawnMobj (oldx, oldy, oldz, MT_TFOG);
S_StartSound (fog, sfx_telept);
an = m->angle >> ANGLETOFINESHIFT;
fog = P_SpawnMobj (m->x+20*finecosine[an], m->y+20*finesine[an]
, thing->z, MT_TFOG);
// emit sound, where?
S_StartSound (fog, sfx_telept);
// emit sound, where?
S_StartSound (fog, sfx_telept);
// don't move for a bit
if (thing->player)
thing->reactiontime = 18;
// don't move for a bit
if (thing->player)
thing->reactiontime = 18;
thing->angle = m->angle;
thing->momx = thing->momy = thing->momz = 0;
return 1;
}
}
thing->angle = m->angle;
thing->momx = thing->momy = thing->momz = 0;
return 1;
}
}
}
return 0;
}

View File

@ -17,9 +17,9 @@
// $Log:$
//
// DESCRIPTION:
// The actual span/column drawing functions.
// Here find the main potential for optimization,
// e.g. inline assembly, different algorithms.
// The actual span/column drawing functions.
// Here find the main potential for optimization,
// e.g. inline assembly, different algorithms.
//
//-----------------------------------------------------------------------------
@ -27,7 +27,7 @@
static const char
rcsid[] = "$Id: r_draw.c,v 1.4 1997/02/03 16:47:55 b1 Exp $";
#include "doomtype.h"
#include "doomdef.h"
#include "i_system.h"
@ -44,11 +44,11 @@ rcsid[] = "$Id: r_draw.c,v 1.4 1997/02/03 16:47:55 b1 Exp $";
// ?
#define MAXWIDTH 1120
#define MAXHEIGHT 832
#define MAXWIDTH 1120
#define MAXHEIGHT 832
// status bar height at bottom of screen
#define SBARHEIGHT 32
#define SBARHEIGHT 32
//
// All drawing to the view buffer is accomplished in this file.
@ -60,20 +60,20 @@ rcsid[] = "$Id: r_draw.c,v 1.4 1997/02/03 16:47:55 b1 Exp $";
//
byte* viewimage;
int viewwidth;
int scaledviewwidth;
int viewheight;
int viewwindowx;
int viewwindowy;
byte* ylookup[MAXHEIGHT];
int columnofs[MAXWIDTH];
byte* viewimage;
int viewwidth;
int scaledviewwidth;
int viewheight;
int viewwindowx;
int viewwindowy;
byte* ylookup[MAXHEIGHT];
int columnofs[MAXWIDTH];
// Color tables for different players,
// translate a limited part to another
// (color ramps used for suit colors).
//
byte translations[3][256];
byte translations[3][256];
@ -82,18 +82,18 @@ byte translations[3][256];
// R_DrawColumn
// Source is the top of the column to scale.
//
lighttable_t* dc_colormap;
int dc_x;
int dc_yl;
int dc_yh;
fixed_t dc_iscale;
fixed_t dc_texturemid;
lighttable_t* dc_colormap;
int dc_x;
int dc_yl;
int dc_yh;
fixed_t dc_iscale;
fixed_t dc_texturemid;
// first pixel in a column (possibly virtual)
byte* dc_source;
byte* dc_source;
// just for profiling
int dccount;
int dccount;
//
// A column is a vertical slice/span from a wall texture that,
@ -104,22 +104,22 @@ int dccount;
//
void R_DrawColumn (void)
{
int count;
byte* dest;
fixed_t frac;
fixed_t fracstep;
int count;
byte* dest;
fixed_t frac;
fixed_t fracstep;
count = dc_yh - dc_yl;
// Zero length, column does not exceed a pixel.
if (count < 0)
return;
return;
#ifdef RANGECHECK
if ((unsigned)dc_x >= SCREENWIDTH
|| dc_yl < 0
|| dc_yh >= SCREENHEIGHT)
I_Error ("R_DrawColumn: %i to %i at %i", dc_yl, dc_yh, dc_x);
|| dc_yl < 0
|| dc_yh >= SCREENHEIGHT)
I_Error ("R_DrawColumn: %i to %i at %i", dc_yl, dc_yh, dc_x);
#endif
// Framebuffer destination address.
@ -137,12 +137,12 @@ void R_DrawColumn (void)
// This is as fast as it gets.
do
{
// Re-map color indices from wall texture column
// using a lighting/special effects LUT.
*dest = dc_colormap[dc_source[(frac>>FRACBITS)&127]];
// Re-map color indices from wall texture column
// using a lighting/special effects LUT.
*dest = dc_colormap[dc_source[(frac>>FRACBITS)&127]];
dest += SCREENWIDTH;
frac += fracstep;
dest += SCREENWIDTH;
frac += fracstep;
} while (count--);
}
@ -154,16 +154,16 @@ void R_DrawColumn (void)
#if 0
void R_DrawColumn (void)
{
int count;
byte* source;
byte* dest;
byte* colormap;
int count;
byte* source;
byte* dest;
byte* colormap;
unsigned frac;
unsigned fracstep;
unsigned fracstep2;
unsigned fracstep3;
unsigned fracstep4;
unsigned frac;
unsigned fracstep;
unsigned fracstep2;
unsigned fracstep3;
unsigned fracstep4;
count = dc_yh - dc_yl + 1;
@ -180,29 +180,29 @@ void R_DrawColumn (void)
while (count >= 8)
{
dest[0] = colormap[source[frac>>25]];
dest[SCREENWIDTH] = colormap[source[(frac+fracstep)>>25]];
dest[SCREENWIDTH*2] = colormap[source[(frac+fracstep2)>>25]];
dest[SCREENWIDTH*3] = colormap[source[(frac+fracstep3)>>25]];
dest[0] = colormap[source[frac>>25]];
dest[SCREENWIDTH] = colormap[source[(frac+fracstep)>>25]];
dest[SCREENWIDTH*2] = colormap[source[(frac+fracstep2)>>25]];
dest[SCREENWIDTH*3] = colormap[source[(frac+fracstep3)>>25]];
frac += fracstep4;
frac += fracstep4;
dest[SCREENWIDTH*4] = colormap[source[frac>>25]];
dest[SCREENWIDTH*5] = colormap[source[(frac+fracstep)>>25]];
dest[SCREENWIDTH*6] = colormap[source[(frac+fracstep2)>>25]];
dest[SCREENWIDTH*7] = colormap[source[(frac+fracstep3)>>25]];
dest[SCREENWIDTH*4] = colormap[source[frac>>25]];
dest[SCREENWIDTH*5] = colormap[source[(frac+fracstep)>>25]];
dest[SCREENWIDTH*6] = colormap[source[(frac+fracstep2)>>25]];
dest[SCREENWIDTH*7] = colormap[source[(frac+fracstep3)>>25]];
frac += fracstep4;
dest += SCREENWIDTH*8;
count -= 8;
frac += fracstep4;
dest += SCREENWIDTH*8;
count -= 8;
}
while (count > 0)
{
*dest = colormap[source[frac>>25]];
dest += SCREENWIDTH;
frac += fracstep;
count--;
*dest = colormap[source[frac>>25]];
dest += SCREENWIDTH;
frac += fracstep;
count--;
}
}
#endif
@ -210,27 +210,27 @@ void R_DrawColumn (void)
void R_DrawColumnLow (void)
{
int count;
byte* dest;
byte* dest2;
fixed_t frac;
fixed_t fracstep;
int count;
byte* dest;
byte* dest2;
fixed_t frac;
fixed_t fracstep;
count = dc_yh - dc_yl;
// Zero length.
if (count < 0)
return;
return;
#ifdef RANGECHECK
if ((unsigned)dc_x >= SCREENWIDTH
|| dc_yl < 0
|| dc_yh >= SCREENHEIGHT)
|| dc_yl < 0
|| dc_yh >= SCREENHEIGHT)
{
I_Error ("R_DrawColumn: %i to %i at %i", dc_yl, dc_yh, dc_x);
I_Error ("R_DrawColumn: %i to %i at %i", dc_yl, dc_yh, dc_x);
}
// dccount++;
// dccount++;
#endif
// Blocky mode, need to multiply by 2.
dc_x <<= 1;
@ -243,11 +243,11 @@ void R_DrawColumnLow (void)
do
{
// Hack. Does not work corretly.
*dest2 = *dest = dc_colormap[dc_source[(frac>>FRACBITS)&127]];
dest += SCREENWIDTH;
dest2 += SCREENWIDTH;
frac += fracstep;
// Hack. Does not work corretly.
*dest2 = *dest = dc_colormap[dc_source[(frac>>FRACBITS)&127]];
dest += SCREENWIDTH;
dest2 += SCREENWIDTH;
frac += fracstep;
} while (count--);
}
@ -256,11 +256,11 @@ void R_DrawColumnLow (void)
//
// Spectre/Invisibility.
//
#define FUZZTABLE 50
#define FUZZOFF (SCREENWIDTH)
#define FUZZTABLE 50
#define FUZZOFF (SCREENWIDTH)
int fuzzoffset[FUZZTABLE] =
int fuzzoffset[FUZZTABLE] =
{
FUZZOFF,-FUZZOFF,FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,
FUZZOFF,FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,
@ -271,7 +271,7 @@ int fuzzoffset[FUZZTABLE] =
FUZZOFF,FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,FUZZOFF
};
int fuzzpos = 0;
int fuzzpos = 0;
//
@ -284,32 +284,32 @@ int fuzzpos = 0;
//
void R_DrawFuzzColumn (void)
{
int count;
byte* dest;
fixed_t frac;
fixed_t fracstep;
int count;
byte* dest;
fixed_t frac;
fixed_t fracstep;
// Adjust borders. Low...
if (!dc_yl)
dc_yl = 1;
dc_yl = 1;
// .. and high.
if (dc_yh == viewheight-1)
dc_yh = viewheight - 2;
dc_yh = viewheight - 2;
count = dc_yh - dc_yl;
// Zero length.
if (count < 0)
return;
return;
#ifdef RANGECHECK
if ((unsigned)dc_x >= SCREENWIDTH
|| dc_yl < 0 || dc_yh >= SCREENHEIGHT)
|| dc_yl < 0 || dc_yh >= SCREENHEIGHT)
{
I_Error ("R_DrawFuzzColumn: %i to %i at %i",
dc_yl, dc_yh, dc_x);
I_Error ("R_DrawFuzzColumn: %i to %i at %i",
dc_yl, dc_yh, dc_x);
}
#endif
@ -319,23 +319,23 @@ void R_DrawFuzzColumn (void)
/* WATCOM code
if (detailshift)
{
if (dc_x & 1)
{
outpw (GC_INDEX,GC_READMAP+(2<<8) );
outp (SC_INDEX+1,12);
}
else
{
outpw (GC_INDEX,GC_READMAP);
outp (SC_INDEX+1,3);
}
dest = destview + dc_yl*80 + (dc_x>>1);
if (dc_x & 1)
{
outpw (GC_INDEX,GC_READMAP+(2<<8) );
outp (SC_INDEX+1,12);
}
else
{
outpw (GC_INDEX,GC_READMAP);
outp (SC_INDEX+1,3);
}
dest = destview + dc_yl*80 + (dc_x>>1);
}
else
{
outpw (GC_INDEX,GC_READMAP+((dc_x&3)<<8) );
outp (SC_INDEX+1,1<<(dc_x&3));
dest = destview + dc_yl*80 + (dc_x>>2);
outpw (GC_INDEX,GC_READMAP+((dc_x&3)<<8) );
outp (SC_INDEX+1,1<<(dc_x&3));
dest = destview + dc_yl*80 + (dc_x>>2);
}*/
@ -351,19 +351,19 @@ void R_DrawFuzzColumn (void)
// brighter than average).
do
{
// Lookup framebuffer, and retrieve
// a pixel that is either one column
// left or right of the current one.
// Add index from colormap to index.
*dest = colormaps[6*256+dest[fuzzoffset[fuzzpos]]];
// Lookup framebuffer, and retrieve
// a pixel that is either one column
// left or right of the current one.
// Add index from colormap to index.
*dest = colormaps[6*256+dest[fuzzoffset[fuzzpos]]];
// Clamp table lookup index.
if (++fuzzpos == FUZZTABLE)
fuzzpos = 0;
// Clamp table lookup index.
if (++fuzzpos == FUZZTABLE)
fuzzpos = 0;
dest += SCREENWIDTH;
dest += SCREENWIDTH;
frac += fracstep;
frac += fracstep;
} while (count--);
}
@ -379,27 +379,27 @@ void R_DrawFuzzColumn (void)
// of the BaronOfHell, the HellKnight, uses
// identical sprites, kinda brightened up.
//
byte* dc_translation;
byte* translationtables;
byte* dc_translation;
byte* translationtables;
void R_DrawTranslatedColumn (void)
{
int count;
byte* dest;
fixed_t frac;
fixed_t fracstep;
int count;
byte* dest;
fixed_t frac;
fixed_t fracstep;
count = dc_yh - dc_yl;
if (count < 0)
return;
return;
#ifdef RANGECHECK
if ((unsigned)dc_x >= SCREENWIDTH
|| dc_yl < 0
|| dc_yh >= SCREENHEIGHT)
|| dc_yl < 0
|| dc_yh >= SCREENHEIGHT)
{
I_Error ( "R_DrawColumn: %i to %i at %i",
dc_yl, dc_yh, dc_x);
I_Error ( "R_DrawColumn: %i to %i at %i",
dc_yl, dc_yh, dc_x);
}
#endif
@ -409,18 +409,18 @@ void R_DrawTranslatedColumn (void)
/* Keep for fixing.
if (detailshift)
{
if (dc_x & 1)
outp (SC_INDEX+1,12);
else
outp (SC_INDEX+1,3);
if (dc_x & 1)
outp (SC_INDEX+1,12);
else
outp (SC_INDEX+1,3);
dest = destview + dc_yl*80 + (dc_x>>1);
dest = destview + dc_yl*80 + (dc_x>>1);
}
else
{
outp (SC_INDEX+1,1<<(dc_x&3));
outp (SC_INDEX+1,1<<(dc_x&3));
dest = destview + dc_yl*80 + (dc_x>>2);
dest = destview + dc_yl*80 + (dc_x>>2);
}*/
@ -434,15 +434,15 @@ void R_DrawTranslatedColumn (void)
// Here we do an additional index re-mapping.
do
{
// Translation tables are used
// to map certain colorramps to other ones,
// used with PLAY sprites.
// Thus the "green" ramp of the player 0 sprite
// is mapped to gray, red, black/indigo.
*dest = dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]];
dest += SCREENWIDTH;
// Translation tables are used
// to map certain colorramps to other ones,
// used with PLAY sprites.
// Thus the "green" ramp of the player 0 sprite
// is mapped to gray, red, black/indigo.
*dest = dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]];
dest += SCREENWIDTH;
frac += fracstep;
frac += fracstep;
} while (count--);
}
@ -458,7 +458,7 @@ void R_DrawTranslatedColumn (void)
//
void R_InitTranslationTables (void)
{
int i;
int i;
translationtables = Z_Malloc (256*3+255, PU_STATIC, 0);
translationtables = (byte *)(( (int)translationtables + 255 )& ~255);
@ -466,19 +466,19 @@ void R_InitTranslationTables (void)
// translate just the 16 green colors
for (i=0 ; i<256 ; i++)
{
if (i >= 0x70 && i<= 0x7f)
{
// map green ramp to gray, brown, red
translationtables[i] = 0x60 + (i&0xf);
translationtables [i+256] = 0x40 + (i&0xf);
translationtables [i+512] = 0x20 + (i&0xf);
}
else
{
// Keep all other colors as is.
translationtables[i] = translationtables[i+256]
= translationtables[i+512] = i;
}
if (i >= 0x70 && i<= 0x7f)
{
// map green ramp to gray, brown, red
translationtables[i] = 0x60 + (i&0xf);
translationtables [i+256] = 0x40 + (i&0xf);
translationtables [i+512] = 0x20 + (i&0xf);
}
else
{
// Keep all other colors as is.
translationtables[i] = translationtables[i+256]
= translationtables[i+512] = i;
}
}
}
@ -497,44 +497,44 @@ void R_InitTranslationTables (void)
// In consequence, flats are not stored by column (like walls),
// and the inner loop has to step in texture space u and v.
//
int ds_y;
int ds_x1;
int ds_x2;
int ds_y;
int ds_x1;
int ds_x2;
lighttable_t* ds_colormap;
lighttable_t* ds_colormap;
fixed_t ds_xfrac;
fixed_t ds_yfrac;
fixed_t ds_xstep;
fixed_t ds_ystep;
fixed_t ds_xfrac;
fixed_t ds_yfrac;
fixed_t ds_xstep;
fixed_t ds_ystep;
// start of a 64*64 tile image
byte* ds_source;
byte* ds_source;
// just for profiling
int dscount;
int dscount;
//
// Draws the actual span.
void R_DrawSpan (void)
{
fixed_t xfrac;
fixed_t yfrac;
byte* dest;
int count;
int spot;
fixed_t xfrac;
fixed_t yfrac;
byte* dest;
int count;
int spot;
#ifdef RANGECHECK
if (ds_x2 < ds_x1
|| ds_x1<0
|| ds_x2>=SCREENWIDTH
|| (unsigned)ds_y>SCREENHEIGHT)
|| ds_x1<0
|| ds_x2>=SCREENWIDTH
|| (unsigned)ds_y>SCREENHEIGHT)
{
I_Error( "R_DrawSpan: %i to %i at %i",
ds_x1,ds_x2,ds_y);
I_Error( "R_DrawSpan: %i to %i at %i",
ds_x1,ds_x2,ds_y);
}
// dscount++;
// dscount++;
#endif
@ -548,16 +548,16 @@ void R_DrawSpan (void)
do
{
// Current texture index in u,v.
spot = ((yfrac>>(16-6))&(63*64)) + ((xfrac>>16)&63);
// Current texture index in u,v.
spot = ((yfrac>>(16-6))&(63*64)) + ((xfrac>>16)&63);
// Lookup pixel from flat texture tile,
// re-index using light/colormap.
*dest++ = ds_colormap[ds_source[spot]];
// Lookup pixel from flat texture tile,
// re-index using light/colormap.
*dest++ = ds_colormap[ds_source[spot]];
// Next step in u,v.
xfrac += ds_xstep;
yfrac += ds_ystep;
// Next step in u,v.
xfrac += ds_xstep;
yfrac += ds_ystep;
} while (count--);
}
@ -569,18 +569,18 @@ void R_DrawSpan (void)
#if 0
void R_DrawSpan (void)
{
unsigned position, step;
unsigned position, step;
byte* source;
byte* colormap;
byte* dest;
byte* source;
byte* colormap;
byte* dest;
unsigned count;
usingned spot;
unsigned value;
unsigned temp;
unsigned xtemp;
unsigned ytemp;
unsigned count;
usingned spot;
unsigned value;
unsigned temp;
unsigned xtemp;
unsigned ytemp;
position = ((ds_xfrac<<10)&0xffff0000) | ((ds_yfrac>>6)&0xffff);
step = ((ds_xstep<<10)&0xffff0000) | ((ds_ystep>>6)&0xffff);
@ -592,46 +592,46 @@ void R_DrawSpan (void)
while (count >= 4)
{
ytemp = position>>4;
ytemp = ytemp & 4032;
xtemp = position>>26;
spot = xtemp | ytemp;
position += step;
dest[0] = colormap[source[spot]];
ytemp = position>>4;
ytemp = ytemp & 4032;
xtemp = position>>26;
spot = xtemp | ytemp;
position += step;
dest[0] = colormap[source[spot]];
ytemp = position>>4;
ytemp = ytemp & 4032;
xtemp = position>>26;
spot = xtemp | ytemp;
position += step;
dest[1] = colormap[source[spot]];
ytemp = position>>4;
ytemp = ytemp & 4032;
xtemp = position>>26;
spot = xtemp | ytemp;
position += step;
dest[1] = colormap[source[spot]];
ytemp = position>>4;
ytemp = ytemp & 4032;
xtemp = position>>26;
spot = xtemp | ytemp;
position += step;
dest[2] = colormap[source[spot]];
ytemp = position>>4;
ytemp = ytemp & 4032;
xtemp = position>>26;
spot = xtemp | ytemp;
position += step;
dest[2] = colormap[source[spot]];
ytemp = position>>4;
ytemp = ytemp & 4032;
xtemp = position>>26;
spot = xtemp | ytemp;
position += step;
dest[3] = colormap[source[spot]];
ytemp = position>>4;
ytemp = ytemp & 4032;
xtemp = position>>26;
spot = xtemp | ytemp;
position += step;
dest[3] = colormap[source[spot]];
count -= 4;
dest += 4;
count -= 4;
dest += 4;
}
while (count > 0)
{
ytemp = position>>4;
ytemp = ytemp & 4032;
xtemp = position>>26;
spot = xtemp | ytemp;
position += step;
*dest++ = colormap[source[spot]];
count--;
ytemp = position>>4;
ytemp = ytemp & 4032;
xtemp = position>>26;
spot = xtemp | ytemp;
position += step;
*dest++ = colormap[source[spot]];
count--;
}
}
#endif
@ -642,22 +642,22 @@ void R_DrawSpan (void)
//
void R_DrawSpanLow (void)
{
fixed_t xfrac;
fixed_t yfrac;
byte* dest;
int count;
int spot;
fixed_t xfrac;
fixed_t yfrac;
byte* dest;
int count;
int spot;
#ifdef RANGECHECK
if (ds_x2 < ds_x1
|| ds_x1<0
|| ds_x2>=SCREENWIDTH
|| (unsigned)ds_y>SCREENHEIGHT)
|| ds_x1<0
|| ds_x2>=SCREENWIDTH
|| (unsigned)ds_y>SCREENHEIGHT)
{
I_Error( "R_DrawSpan: %i to %i at %i",
ds_x1,ds_x2,ds_y);
I_Error( "R_DrawSpan: %i to %i at %i",
ds_x1,ds_x2,ds_y);
}
// dscount++;
// dscount++;
#endif
xfrac = ds_xfrac;
@ -673,14 +673,14 @@ void R_DrawSpanLow (void)
count = ds_x2 - ds_x1;
do
{
spot = ((yfrac>>(16-6))&(63*64)) + ((xfrac>>16)&63);
// Lowres/blocky mode does it twice,
// while scale is adjusted appropriately.
*dest++ = ds_colormap[ds_source[spot]];
*dest++ = ds_colormap[ds_source[spot]];
spot = ((yfrac>>(16-6))&(63*64)) + ((xfrac>>16)&63);
// Lowres/blocky mode does it twice,
// while scale is adjusted appropriately.
*dest++ = ds_colormap[ds_source[spot]];
*dest++ = ds_colormap[ds_source[spot]];
xfrac += ds_xstep;
yfrac += ds_ystep;
xfrac += ds_xstep;
yfrac += ds_ystep;
} while (count--);
}
@ -694,10 +694,10 @@ void R_DrawSpanLow (void)
//
void
R_InitBuffer
( int width,
int height )
( int width,
int height )
{
int i;
int i;
// Handle resize,
// e.g. smaller view windows
@ -706,17 +706,17 @@ R_InitBuffer
// Column offset. For windows.
for (i=0 ; i<width ; i++)
columnofs[i] = viewwindowx + i;
columnofs[i] = viewwindowx + i;
// Samw with base row offset.
if (width == SCREENWIDTH)
viewwindowy = 0;
viewwindowy = 0;
else
viewwindowy = (SCREENHEIGHT-SBARHEIGHT-height) >> 1;
viewwindowy = (SCREENHEIGHT-SBARHEIGHT-height) >> 1;
// Preclaculate all row offsets.
for (i=0 ; i<height ; i++)
ylookup[i] = screens[0] + (i+viewwindowy)*SCREENWIDTH;
ylookup[i] = screens[0] + (i+viewwindowy)*SCREENWIDTH;
}
@ -730,84 +730,84 @@ R_InitBuffer
//
void R_FillBackScreen (void)
{
byte* src;
byte* dest;
int x;
int y;
patch_t* patch;
byte* src;
byte* dest;
int x;
int y;
patch_t* patch;
// DOOM border patch.
char name1[] = "FLOOR7_2";
char name1[] = "FLOOR7_2";
// DOOM II border patch.
char name2[] = "GRNROCK";
char name2[] = "GRNROCK";
char* name;
char* name;
if (scaledviewwidth == 320)
return;
return;
if ( gamemode == commercial)
name = name2;
name = name2;
else
name = name1;
name = name1;
src = W_CacheLumpName (name, PU_CACHE);
dest = screens[1];
for (y=0 ; y<SCREENHEIGHT-SBARHEIGHT ; y++)
{
for (x=0 ; x<SCREENWIDTH/64 ; x++)
{
memcpy (dest, src+((y&63)<<6), 64);
dest += 64;
}
for (x=0 ; x<SCREENWIDTH/64 ; x++)
{
memcpy (dest, src+((y&63)<<6), 64);
dest += 64;
}
if (SCREENWIDTH&63)
{
memcpy (dest, src+((y&63)<<6), SCREENWIDTH&63);
dest += (SCREENWIDTH&63);
}
if (SCREENWIDTH&63)
{
memcpy (dest, src+((y&63)<<6), SCREENWIDTH&63);
dest += (SCREENWIDTH&63);
}
}
patch = W_CacheLumpName ("brdr_t",PU_CACHE);
for (x=0 ; x<scaledviewwidth ; x+=8)
V_DrawPatch (viewwindowx+x,viewwindowy-8,1,patch);
V_DrawPatch (viewwindowx+x,viewwindowy-8,1,patch);
patch = W_CacheLumpName ("brdr_b",PU_CACHE);
for (x=0 ; x<scaledviewwidth ; x+=8)
V_DrawPatch (viewwindowx+x,viewwindowy+viewheight,1,patch);
V_DrawPatch (viewwindowx+x,viewwindowy+viewheight,1,patch);
patch = W_CacheLumpName ("brdr_l",PU_CACHE);
for (y=0 ; y<viewheight ; y+=8)
V_DrawPatch (viewwindowx-8,viewwindowy+y,1,patch);
V_DrawPatch (viewwindowx-8,viewwindowy+y,1,patch);
patch = W_CacheLumpName ("brdr_r",PU_CACHE);
for (y=0 ; y<viewheight ; y+=8)
V_DrawPatch (viewwindowx+scaledviewwidth,viewwindowy+y,1,patch);
V_DrawPatch (viewwindowx+scaledviewwidth,viewwindowy+y,1,patch);
// Draw beveled edge.
V_DrawPatch (viewwindowx-8,
viewwindowy-8,
1,
W_CacheLumpName ("brdr_tl",PU_CACHE));
viewwindowy-8,
1,
W_CacheLumpName ("brdr_tl",PU_CACHE));
V_DrawPatch (viewwindowx+scaledviewwidth,
viewwindowy-8,
1,
W_CacheLumpName ("brdr_tr",PU_CACHE));
viewwindowy-8,
1,
W_CacheLumpName ("brdr_tr",PU_CACHE));
V_DrawPatch (viewwindowx-8,
viewwindowy+viewheight,
1,
W_CacheLumpName ("brdr_bl",PU_CACHE));
viewwindowy+viewheight,
1,
W_CacheLumpName ("brdr_bl",PU_CACHE));
V_DrawPatch (viewwindowx+scaledviewwidth,
viewwindowy+viewheight,
1,
W_CacheLumpName ("brdr_br",PU_CACHE));
viewwindowy+viewheight,
1,
W_CacheLumpName ("brdr_br",PU_CACHE));
}
@ -816,8 +816,8 @@ void R_FillBackScreen (void)
//
void
R_VideoErase
( unsigned ofs,
int count )
( unsigned ofs,
int count )
{
// LFB copy.
// This might not be a good idea if memcpy
@ -835,20 +835,20 @@ R_VideoErase
//
void
V_MarkRect
( int x,
int y,
int width,
int height );
( int x,
int y,
int width,
int height );
void R_DrawViewBorder (void)
{
int top;
int side;
int ofs;
int i;
int top;
int side;
int ofs;
int i;
if (scaledviewwidth == SCREENWIDTH)
return;
return;
top = ((SCREENHEIGHT-SBARHEIGHT)-viewheight)/2;
side = (SCREENWIDTH-scaledviewwidth)/2;
@ -866,8 +866,8 @@ void R_DrawViewBorder (void)
for (i=1 ; i<viewheight ; i++)
{
R_VideoErase (ofs, side);
ofs += SCREENWIDTH;
R_VideoErase (ofs, side);
ofs += SCREENWIDTH;
}
// ?

File diff suppressed because it is too large Load Diff

View File

@ -45,6 +45,9 @@ rcsid[] = "$Id: s_sound.c,v 1.6 1997/02/03 22:45:12 b1 Exp $";
//#include "qmus2mid.h"
#include "kolibri.h"
void WriteDebug(char *);
// Purpose?
@ -112,10 +115,10 @@ static channel_t* channels;
// These are not used, but should be (menu).
// Maximum volume of a sound effect.
// Internal default is max out of 0-15.
int snd_SfxVolume = 80;
int snd_SfxVolume = 15;
// Maximum volume of music. Useless so far.
int snd_MusicVolume = 80;
int snd_MusicVolume = 15;
@ -161,6 +164,10 @@ void S_StopChannel(int cnum);
// Sets channels, SFX and music volume,
// allocates channel buffer, sets S_sfx lookup.
//
DWORD hMixBuff[4];
int mix_ptr;
void S_Init
( int sfxVolume,
int musicVolume )
@ -169,7 +176,13 @@ void S_Init
printf("S_Init: default sfx volume %d\n", sfxVolume);
//I_CreateSound();
InitSound();
hMixBuff[0]= CreateBuffer(15);
hMixBuff[1]= CreateBuffer(15);
hMixBuff[2]= CreateBuffer(15);
hMixBuff[3]= CreateBuffer(15);
numChannels = NUM_CHANNELS;
// Whatever these did with DMX, these are rather dummies now.

View File

@ -152,6 +152,8 @@ void W_AddFile (char *filename)
reloadlump = numlumps;
}
printf("open file %s\n\r",filename);
if ( (handle = fopen (filename,"rb")) == NULL)
{
printf (" couldn't open %s\n",filename);