mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-05-30 00:30:38 +00:00
Okay, the big whitespace reformat. There is some silliness (case
statements, variable declarations), but all in all it's not bad.
This commit is contained in:
parent
b62d75a774
commit
54e2a4d9d3
172 changed files with 26949 additions and 26640 deletions
122
source/wad.c
122
source/wad.c
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
|
@ -42,11 +42,11 @@
|
|||
#include "quakefs.h"
|
||||
#include "qendian.h"
|
||||
|
||||
int wad_numlumps;
|
||||
lumpinfo_t *wad_lumps;
|
||||
byte *wad_base;
|
||||
int wad_numlumps;
|
||||
lumpinfo_t *wad_lumps;
|
||||
byte *wad_base;
|
||||
|
||||
void SwapPic (qpic_t *pic);
|
||||
void SwapPic (qpic_t *pic);
|
||||
|
||||
/*
|
||||
==================
|
||||
|
@ -59,23 +59,23 @@ Space padding is so names can be printed nicely in tables.
|
|||
Can safely be performed in place.
|
||||
==================
|
||||
*/
|
||||
void W_CleanupName (char *in, char *out)
|
||||
void
|
||||
W_CleanupName (char *in, char *out)
|
||||
{
|
||||
int i;
|
||||
int c;
|
||||
|
||||
for (i=0 ; i<16 ; i++ )
|
||||
{
|
||||
int i;
|
||||
int c;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
c = in[i];
|
||||
if (!c)
|
||||
break;
|
||||
|
||||
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
c += ('a' - 'A');
|
||||
out[i] = c;
|
||||
}
|
||||
|
||||
for ( ; i< 16 ; i++ )
|
||||
|
||||
for (; i < 16; i++)
|
||||
out[i] = 0;
|
||||
}
|
||||
|
||||
|
@ -86,36 +86,35 @@ void W_CleanupName (char *in, char *out)
|
|||
W_LoadWadFile
|
||||
====================
|
||||
*/
|
||||
void W_LoadWadFile (char *filename)
|
||||
void
|
||||
W_LoadWadFile (char *filename)
|
||||
{
|
||||
lumpinfo_t *lump_p;
|
||||
wadinfo_t *header;
|
||||
unsigned int i;
|
||||
int infotableofs;
|
||||
|
||||
lumpinfo_t *lump_p;
|
||||
wadinfo_t *header;
|
||||
unsigned int i;
|
||||
int infotableofs;
|
||||
|
||||
wad_base = COM_LoadHunkFile (filename);
|
||||
if (!wad_base)
|
||||
Sys_Error ("W_LoadWadFile: couldn't load %s", filename);
|
||||
|
||||
header = (wadinfo_t *)wad_base;
|
||||
|
||||
header = (wadinfo_t *) wad_base;
|
||||
|
||||
if (header->identification[0] != 'W'
|
||||
|| header->identification[1] != 'A'
|
||||
|| header->identification[2] != 'D'
|
||||
|| header->identification[3] != '2')
|
||||
Sys_Error ("Wad file %s doesn't have WAD2 id\n",filename);
|
||||
|
||||
wad_numlumps = LittleLong(header->numlumps);
|
||||
infotableofs = LittleLong(header->infotableofs);
|
||||
wad_lumps = (lumpinfo_t *)(wad_base + infotableofs);
|
||||
|
||||
for (i=0, lump_p = wad_lumps ; i<wad_numlumps ; i++,lump_p++)
|
||||
{
|
||||
lump_p->filepos = LittleLong(lump_p->filepos);
|
||||
lump_p->size = LittleLong(lump_p->size);
|
||||
|| header->identification[1] != 'A'
|
||||
|| header->identification[2] != 'D' || header->identification[3] != '2')
|
||||
Sys_Error ("Wad file %s doesn't have WAD2 id\n", filename);
|
||||
|
||||
wad_numlumps = LittleLong (header->numlumps);
|
||||
infotableofs = LittleLong (header->infotableofs);
|
||||
wad_lumps = (lumpinfo_t *) (wad_base + infotableofs);
|
||||
|
||||
for (i = 0, lump_p = wad_lumps; i < wad_numlumps; i++, lump_p++) {
|
||||
lump_p->filepos = LittleLong (lump_p->filepos);
|
||||
lump_p->size = LittleLong (lump_p->size);
|
||||
W_CleanupName (lump_p->name, lump_p->name);
|
||||
if (lump_p->type == TYP_QPIC)
|
||||
SwapPic ( (qpic_t *)(wad_base + lump_p->filepos));
|
||||
SwapPic ((qpic_t *) (wad_base + lump_p->filepos));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,43 +124,45 @@ void W_LoadWadFile (char *filename)
|
|||
W_GetLumpinfo
|
||||
=============
|
||||
*/
|
||||
lumpinfo_t *W_GetLumpinfo (char *name)
|
||||
lumpinfo_t *
|
||||
W_GetLumpinfo (char *name)
|
||||
{
|
||||
int i;
|
||||
lumpinfo_t *lump_p;
|
||||
char clean[16];
|
||||
|
||||
int i;
|
||||
lumpinfo_t *lump_p;
|
||||
char clean[16];
|
||||
|
||||
W_CleanupName (name, clean);
|
||||
|
||||
for (lump_p=wad_lumps, i=0 ; i<wad_numlumps ; i++,lump_p++)
|
||||
{
|
||||
if (!strcmp(clean, lump_p->name))
|
||||
|
||||
for (lump_p = wad_lumps, i = 0; i < wad_numlumps; i++, lump_p++) {
|
||||
if (!strcmp (clean, lump_p->name))
|
||||
return lump_p;
|
||||
}
|
||||
|
||||
|
||||
Sys_Error ("W_GetLumpinfo: %s not found", name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *W_GetLumpName (char *name)
|
||||
void *
|
||||
W_GetLumpName (char *name)
|
||||
{
|
||||
lumpinfo_t *lump;
|
||||
|
||||
lumpinfo_t *lump;
|
||||
|
||||
lump = W_GetLumpinfo (name);
|
||||
|
||||
return (void *)(wad_base + lump->filepos);
|
||||
|
||||
return (void *) (wad_base + lump->filepos);
|
||||
}
|
||||
|
||||
void *W_GetLumpNum (int num)
|
||||
void *
|
||||
W_GetLumpNum (int num)
|
||||
{
|
||||
lumpinfo_t *lump;
|
||||
|
||||
lumpinfo_t *lump;
|
||||
|
||||
if (num < 0 || num > wad_numlumps)
|
||||
Sys_Error ("W_GetLumpNum: bad number: %i", num);
|
||||
|
||||
|
||||
lump = wad_lumps + num;
|
||||
|
||||
return (void *)(wad_base + lump->filepos);
|
||||
|
||||
return (void *) (wad_base + lump->filepos);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -172,8 +173,9 @@ automatic byte swapping
|
|||
=============================================================================
|
||||
*/
|
||||
|
||||
void SwapPic (qpic_t *pic)
|
||||
void
|
||||
SwapPic (qpic_t *pic)
|
||||
{
|
||||
pic->width = LittleLong(pic->width);
|
||||
pic->height = LittleLong(pic->height);
|
||||
pic->width = LittleLong (pic->width);
|
||||
pic->height = LittleLong (pic->height);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue