mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-14 20:00:49 +00:00
- testing some script parser improvements.
This commit is contained in:
parent
cbe25d9d6b
commit
424c0ce3f4
3 changed files with 58 additions and 8 deletions
|
@ -17,6 +17,7 @@
|
||||||
#include "gamecontrol.h"
|
#include "gamecontrol.h"
|
||||||
#include "palettecontainer.h"
|
#include "palettecontainer.h"
|
||||||
#include "mapinfo.h"
|
#include "mapinfo.h"
|
||||||
|
#include "parsefuncs.h"
|
||||||
|
|
||||||
int tileSetHightileReplacement(int picnum, int palnum, const char* filename, float alphacut, float xscale, float yscale, float specpower, float specfactor, uint8_t flags);
|
int tileSetHightileReplacement(int picnum, int palnum, const char* filename, float alphacut, float xscale, float yscale, float specpower, float specfactor, uint8_t flags);
|
||||||
int tileSetSkybox(int picnum, int palnum, const char** facenames, int flags);
|
int tileSetSkybox(int picnum, int palnum, const char** facenames, int flags);
|
||||||
|
@ -655,15 +656,9 @@ static int32_t defsparser(scriptfile *script)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case T_ANIMTILERANGE:
|
case T_ANIMTILERANGE:
|
||||||
{
|
parseAnimTileRange(*script, pos);
|
||||||
SetAnim set;
|
|
||||||
if (scriptfile_getsymbol(script,&set.tile1)) break;
|
|
||||||
if (scriptfile_getsymbol(script,&set.tile2)) break;
|
|
||||||
if (scriptfile_getsymbol(script,&set.speed)) break;
|
|
||||||
if (scriptfile_getsymbol(script,&set.type)) break;
|
|
||||||
processSetAnim("animtilerange", pos, set);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case T_TILEFROMTEXTURE:
|
case T_TILEFROMTEXTURE:
|
||||||
{
|
{
|
||||||
auto texturepos = scriptfile_getposition(script);
|
auto texturepos = scriptfile_getposition(script);
|
||||||
|
|
|
@ -113,6 +113,13 @@ public:
|
||||||
void MustGetNumber(bool evaluate = false);
|
void MustGetNumber(bool evaluate = false);
|
||||||
bool CheckNumber(bool evaluate = false);
|
bool CheckNumber(bool evaluate = false);
|
||||||
|
|
||||||
|
bool GetNumber(int& var, bool evaluate = false)
|
||||||
|
{
|
||||||
|
if (!GetNumber(evaluate)) return false;
|
||||||
|
var = Number;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool GetFloat(bool evaluate = false);
|
bool GetFloat(bool evaluate = false);
|
||||||
void MustGetFloat(bool evaluate = false);
|
void MustGetFloat(bool evaluate = false);
|
||||||
bool CheckFloat(bool evaluate = false);
|
bool CheckFloat(bool evaluate = false);
|
||||||
|
|
48
source/core/parsefuncs.h
Normal file
48
source/core/parsefuncs.h
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
** parsefuncs.h
|
||||||
|
** handlers for .def parser
|
||||||
|
** only to be included by the actual parser
|
||||||
|
**
|
||||||
|
**---------------------------------------------------------------------------
|
||||||
|
** Copyright 2021 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.
|
||||||
|
**---------------------------------------------------------------------------
|
||||||
|
**
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
void parseAnimTileRange(FScanner& sc, FScriptPosition& pos)
|
||||||
|
{
|
||||||
|
SetAnim set;
|
||||||
|
if (!sc.GetNumber(set.tile1, true)) return;
|
||||||
|
if (!sc.GetNumber(set.tile2, true)) return;
|
||||||
|
if (!sc.GetNumber(set.speed, true)) return;
|
||||||
|
if (!sc.GetNumber(set.type, true)) return;
|
||||||
|
processSetAnim("animtilerange", pos, set);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue