- Added Gez's A_CheckCeiling submission.

- Fixed: AM_NewResolution crashed when called from outside a level.
- Added support for Quake PAK files.
- Improved warning messages for WAD files with incorrect marker usage.


SVN r1556 (trunk)
This commit is contained in:
Christoph Oelckers 2009-04-23 23:20:21 +00:00
parent cc066bc409
commit 19c4e3caed
7 changed files with 226 additions and 26 deletions

View file

@ -1,4 +1,8 @@
April 23, 2009 (Changes by Graf Zahl)
- Added Gez's A_CheckCeiling submission.
- Fixed: AM_NewResolution crashed when called from outside a level.
- Added support for Quake PAK files.
- Improved warning messages for WAD files with incorrect marker usage.
- complete restructuring of resource file handling for more flexibility and future
extensions.
- Removed merging of special namespaces. For the texture manager this has

View file

@ -914,6 +914,11 @@ void AM_maxOutWindowScale ()
void AM_NewResolution()
{
fixed_t oldmin = min_scale_mtof;
if ( oldmin == 0 )
{
return; // [SP] Not in a game, exit!
}
AM_calcMinMaxMtoF();
scale_mtof = Scale(scale_mtof, min_scale_mtof, oldmin);
scale_ftom = MapDiv(MAPUNIT, scale_mtof);

View file

@ -1 +1,144 @@
// not implemented yet
/*
** file_pak.cpp
**
**---------------------------------------------------------------------------
** Copyright 2009 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
**
*/
#include "resourcefile.h"
#include "cmdlib.h"
#include "v_text.h"
#include "w_wad.h"
//==========================================================================
//
//
//
//==========================================================================
struct dpackfile_t
{
char name[56];
int filepos, filelen;
} ;
struct dpackheader_t
{
int ident; // == IDPAKHEADER
int dirofs;
int dirlen;
} ;
//==========================================================================
//
// Wad file
//
//==========================================================================
class FPakFile : public FUncompressedFile
{
public:
FPakFile(const char * filename, FileReader *file);
bool Open();
};
//==========================================================================
//
// FWadFile::FWadFile
//
// Initializes a WAD file
//
//==========================================================================
FPakFile::FPakFile(const char *filename, FileReader *file) : FUncompressedFile(filename, file)
{
Lumps = NULL;
}
//==========================================================================
//
// Open it
//
//==========================================================================
bool FPakFile::Open()
{
dpackheader_t header;
Reader->Read(&header, sizeof(header));
NumLumps = LittleLong(header.dirlen) / sizeof(dpackfile_t);
header.dirofs = LittleLong(header.dirofs);
dpackfile_t *fileinfo = new dpackfile_t[NumLumps];
Reader->Seek (header.dirofs, SEEK_SET);
Reader->Read (fileinfo, NumLumps * sizeof(dpackfile_t));
Lumps = new FUncompressedLump[NumLumps];
Printf(", %d lumps\n", NumLumps);
for(DWORD i = 0; i < NumLumps; i++)
{
Lumps[i].LumpNameSetup(fileinfo[i].name);
Lumps[i].Owner = this;
Lumps[i].Position = LittleLong(fileinfo[i].filepos);
Lumps[i].LumpSize = LittleLong(fileinfo[i].filelen);
Lumps[i].CheckEmbedded();
}
delete [] fileinfo;
return true;
}
//==========================================================================
//
// File open
//
//==========================================================================
FResourceFile *CheckPak(const char *filename, FileReader *file)
{
char head[4];
file->Seek(0, SEEK_SET);
file->Read(&head, 4);
file->Seek(0, SEEK_SET);
if (!memcmp(head, "PACK", 4))
{
FResourceFile *rf = new FPakFile(filename, file);
if (rf->Open()) return rf;
delete rf;
}
return NULL;
}

View file

@ -169,7 +169,14 @@ void FWadFile::SetNamespace(const char *startmarker, const char *endmarker, name
break;
}
}
if (end == -1) return;
if (end == -1)
{
if (start != -1)
{
Printf(TEXTCOLOR_YELLOW"WARNING: %s marker without corresponding %s found.\n", startmarker, endmarker);
}
return;
}
if (start != -1)
{
@ -197,9 +204,11 @@ void FWadFile::SetNamespace(const char *startmarker, const char *endmarker, name
}
}
}
else if (flathack)
else
{
Printf(TEXTCOLOR_YELLOW"WARNING: %s marker without corresponding %s found.\n", endmarker, startmarker);
if (flathack)
{
for(int i = 0; i < end; i++)
{
if (Lumps[i].LumpSize == 4096)
@ -211,6 +220,7 @@ void FWadFile::SetNamespace(const char *startmarker, const char *endmarker, name
}
}
}
}
//==========================================================================

View file

@ -1965,6 +1965,25 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFloor)
}
//===========================================================================
//
// A_CheckCeiling
// [GZ] Totally copied on A_CheckFloor, jumps if actor touches ceiling
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckCeiling)
{
ACTION_PARAM_START(1);
ACTION_PARAM_STATE(jump, 0);
ACTION_SET_RESULT(false);
if (self->z+self->height >= self->ceilingz) // Height needs to be counted
{
ACTION_JUMP(jump);
}
}
//===========================================================================
//
// A_Stop

View file

@ -1,14 +1,38 @@
/*
** w_wad.cpp
**
**---------------------------------------------------------------------------
** Copyright 1998-2009 Randy Heit
** Copyright 2005-2009 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
**
*/
//**************************************************************************
//**
//** w_wad.c : Heretic 2 : Raven Software, Corp.
//**
//** $RCSfile: w_wad.c,v $
//** $Revision: 1.6 $
//** $Date: 95/10/06 20:56:47 $
//** $Author: cjr $
//**
//**************************************************************************
// HEADER FILES ------------------------------------------------------------
@ -32,13 +56,6 @@
#include "doomerrors.h"
#include "resourcefiles/resourcefile.h"
extern "C" {
#include "Archive/7z/7zHeader.h"
#include "Archive/7z/7zExtract.h"
#include "Archive/7z/7zIn.h"
#include "7zCrc.h"
}
// MACROS ------------------------------------------------------------------
#define NULL_INDEX (0xffffffff)
@ -213,11 +230,12 @@ typedef FResourceFile * (*CheckFunc)(const char *filename, FileReader *file);
FResourceFile *CheckWad(const char *filename, FileReader *file);
FResourceFile *CheckGRP(const char *filename, FileReader *file);
FResourceFile *CheckRFF(const char *filename, FileReader *file);
FResourceFile *CheckPak(const char *filename, FileReader *file);
FResourceFile *CheckZip(const char *filename, FileReader *file);
FResourceFile *Check7Z(const char *filename, FileReader *file);
FResourceFile *CheckLump(const char *filename, FileReader *file);
static CheckFunc funcs[] = { CheckWad, CheckZip, Check7Z, CheckGRP, CheckRFF, CheckLump };
static CheckFunc funcs[] = { CheckWad, CheckZip, Check7Z, CheckPak, CheckGRP, CheckRFF, CheckLump };
void FWadCollection::AddFile (const char *filename, FileReader *wadinfo)

View file

@ -196,6 +196,7 @@ ACTOR Actor native //: Thinker
action native A_KillChildren();
action native A_KillSiblings();
action native A_CheckFloor(state label);
action native A_CheckCeiling(state label);
action native A_PlayerSkinCheck(state label);
action native A_BasicAttack(int meleedamage, sound meleesound, class<actor> missiletype, float missileheight);
action native A_ThrowGrenade(class<Actor> itemtype, float zheight = 0, float xymom = 0, float zmom = 0, bool useammo = true);