2006-04-13 20:47:06 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
2010-05-25 10:56:00 +00:00
|
|
|
Copyright (C) 2010 EDuke32 developers and contributors
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-25 10:56:00 +00:00
|
|
|
This file is part of EDuke32.
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
EDuke32 is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#ifndef __duke3d_h__
|
|
|
|
#define __duke3d_h__
|
2006-10-19 00:45:36 +00:00
|
|
|
|
2012-11-05 02:49:08 +00:00
|
|
|
#ifdef EXTERNC
|
|
|
|
{
|
2006-04-13 20:47:06 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// JBF
|
|
|
|
#include "compat.h"
|
|
|
|
#include "a.h"
|
|
|
|
#include "build.h"
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2008-05-10 01:29:37 +00:00
|
|
|
#ifdef POLYMER
|
2010-08-02 08:13:51 +00:00
|
|
|
#include "polymer.h"
|
2010-06-23 04:20:46 +00:00
|
|
|
#else
|
2011-03-04 08:50:58 +00:00
|
|
|
#ifdef USE_OPENGL
|
2010-08-02 08:13:51 +00:00
|
|
|
#include "polymost.h"
|
2010-06-23 04:20:46 +00:00
|
|
|
#endif
|
2006-10-15 18:51:41 +00:00
|
|
|
#endif
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
#include "cache1d.h"
|
|
|
|
#include "pragmas.h"
|
|
|
|
#include "baselayer.h"
|
2010-08-02 08:13:51 +00:00
|
|
|
#include "file_lib.h"
|
|
|
|
#include "keyboard.h"
|
|
|
|
#include "mathutil.h"
|
|
|
|
#include "fx_man.h"
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#define APPNAME "EDuke32"
|
|
|
|
#define VERSION "2.0.0devel"
|
|
|
|
#define HEAD2 APPNAME" "VERSION
|
2009-01-09 09:29:17 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#define VOLUMEALL (g_Shareware == 0)
|
|
|
|
#define PLUTOPAK (g_scriptVersion == 14)
|
|
|
|
#define VOLUMEONE (g_Shareware == 1)
|
2006-07-22 05:20:25 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
// increase by 3, because atomic GRP adds 1, and Shareware adds 2
|
2013-07-13 21:04:47 +00:00
|
|
|
#ifdef LUNATIC
|
|
|
|
// Lunatic
|
Clean up parallaxed sky functionality, part 2.
- Rename sky_t members: yscale -> horizfrac, bits -> lognumtiles.
- Add default sky (8 tiles, horizfrac=32768 (i.e. 1/2 the scene horiz), offsets
all zero) and CLOUDYOCEAN sky (8 tiles, horizfrac=65536, offsets all zero)
to multipsky[].
- Get rid of "psky_t g_psky", merely maintaining a g_pskyidx instead. Set it up
at map load time so as to keep the behavior of the legacy per-map psky:
the last sector index with a matching psky ceiling wins.
- In mapstate_t, save g_pskyidx too, not (former) pskybits and pskyoffs[].
- Make on-map-load global psky setup consistent for the game and editor by
factoring it out into common.c: G_SetupGlobalPsky().
- Remove a couple of useless initializations, add some static assertions.
This commit is more likely to introduce subtle differences in behavior.
Specifically, getpsky() now always returns the default sky properties instead of
the global sky ones (but with all-zero offsets) when no match for a suiting
multi-psky is found. This is only likely to affect the yscale/horizfrac of
non-multi-pskies when a global non-default multi-psky has been set up.
Bump BYTEVERSION again.
git-svn-id: https://svn.eduke32.com/eduke32@3976 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-04 20:37:48 +00:00
|
|
|
# define BYTEVERSION_JF 285
|
2013-07-13 21:04:47 +00:00
|
|
|
#else
|
|
|
|
// Non-Lua build
|
Clean up parallaxed sky functionality, part 2.
- Rename sky_t members: yscale -> horizfrac, bits -> lognumtiles.
- Add default sky (8 tiles, horizfrac=32768 (i.e. 1/2 the scene horiz), offsets
all zero) and CLOUDYOCEAN sky (8 tiles, horizfrac=65536, offsets all zero)
to multipsky[].
- Get rid of "psky_t g_psky", merely maintaining a g_pskyidx instead. Set it up
at map load time so as to keep the behavior of the legacy per-map psky:
the last sector index with a matching psky ceiling wins.
- In mapstate_t, save g_pskyidx too, not (former) pskybits and pskyoffs[].
- Make on-map-load global psky setup consistent for the game and editor by
factoring it out into common.c: G_SetupGlobalPsky().
- Remove a couple of useless initializations, add some static assertions.
This commit is more likely to introduce subtle differences in behavior.
Specifically, getpsky() now always returns the default sky properties instead of
the global sky ones (but with all-zero offsets) when no match for a suiting
multi-psky is found. This is only likely to affect the yscale/horizfrac of
non-multi-pskies when a global non-default multi-psky has been set up.
Bump BYTEVERSION again.
git-svn-id: https://svn.eduke32.com/eduke32@3976 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-04 20:37:48 +00:00
|
|
|
# define BYTEVERSION_JF 285
|
2013-07-13 21:04:47 +00:00
|
|
|
#endif
|
2011-12-25 15:34:37 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#define BYTEVERSION_13 27
|
|
|
|
#define BYTEVERSION_14 116
|
|
|
|
#define BYTEVERSION_15 117
|
|
|
|
#define BYTEVERSION (BYTEVERSION_JF+(PLUTOPAK?1:(VOLUMEONE<<1)))
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#define NUMPAGES 1
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#define RECSYNCBUFSIZ 2520 //2520 is the (LCM of 1-8)*3
|
|
|
|
#define MOVEFIFOSIZ 2
|
2009-01-18 07:32:35 +00:00
|
|
|
|
2012-06-17 19:45:37 +00:00
|
|
|
// KEEPINSYNC lunatic/con_lang.lua
|
2010-08-02 08:13:51 +00:00
|
|
|
#define MAXVOLUMES 7
|
2012-06-03 16:10:08 +00:00
|
|
|
#define MAXLEVELS 64
|
2010-08-02 08:13:51 +00:00
|
|
|
#define MAXGAMETYPES 16
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-09-08 22:18:40 +00:00
|
|
|
////////// TIMING CONSTANTS //////////
|
|
|
|
// The number of 'totalclock' increments per second:
|
2010-08-02 08:13:51 +00:00
|
|
|
#define TICRATE 120
|
2012-09-08 22:18:40 +00:00
|
|
|
// The number of game state updates per second:
|
|
|
|
#define REALGAMETICSPERSEC 30
|
|
|
|
// The number of 'totalclock' increments per game state update:
|
|
|
|
// NOTE: calling a game state update a 'frame' is really weird.
|
|
|
|
// (This used to be TICRATE/GAMETICSPERSEC, which was 120/26 = 4.615~ truncated
|
|
|
|
// to 4 by integer division.)
|
|
|
|
#define TICSPERFRAME (TICRATE/REALGAMETICSPERSEC)
|
|
|
|
// Used as a constant to satisfy all of the calculations written with ticrate =
|
|
|
|
// 26 in mind:
|
|
|
|
#define GAMETICSPERSEC 26
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 21:52:51 +00:00
|
|
|
#define PACKBUF_SIZE 32768
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#define TILE_SAVESHOT (MAXTILES-1)
|
|
|
|
#define TILE_LOADSHOT (MAXTILES-3)
|
|
|
|
#define TILE_TILT (MAXTILES-2)
|
|
|
|
#define TILE_ANIM (MAXTILES-4)
|
|
|
|
#define TILE_VIEWSCR (MAXTILES-5)
|
2006-04-15 03:12:08 +00:00
|
|
|
|
2011-06-22 19:12:47 +00:00
|
|
|
// sprites with these statnums should be considered for fixing (bitmap)
|
2012-12-23 19:24:21 +00:00
|
|
|
#define ROTFIXSPR_STATNUMP(k) ((k)==STAT_DEFAULT || (k)==STAT_STANDABLE || (k)==STAT_FX || \
|
2012-05-06 21:01:52 +00:00
|
|
|
(k)==STAT_FALLER || (k)==STAT_LIGHT)
|
2012-12-23 19:24:21 +00:00
|
|
|
#define ROTFIXSPR_MAGIC 0x18190000
|
2011-06-22 19:12:47 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
// JBF 20040604: sync is a function on some platforms
|
|
|
|
#define sync dsync
|
2009-04-26 05:57:42 +00:00
|
|
|
|
2012-02-12 13:47:33 +00:00
|
|
|
// Uncomment the following to remove calls to a.nasm functions with the GL renderers
|
|
|
|
// so that debugging with valgrind --smc-check=none is possible:
|
|
|
|
//#define DEBUG_VALGRIND_NO_SMC
|
|
|
|
|
2012-06-03 16:09:33 +00:00
|
|
|
#include "common_game.h"
|
2010-08-02 08:13:51 +00:00
|
|
|
#include "namesdyn.h"
|
2006-04-13 20:47:06 +00:00
|
|
|
#include "function.h"
|
2010-08-02 08:13:51 +00:00
|
|
|
#include "macros.h"
|
|
|
|
#include "gamedefs.h"
|
2006-04-13 20:47:06 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include "sounds.h"
|
|
|
|
#include "control.h"
|
|
|
|
#include "_rts.h"
|
|
|
|
#include "rts.h"
|
2013-06-01 06:55:30 +00:00
|
|
|
#include "soundsdyn.h"
|
2006-04-13 20:47:06 +00:00
|
|
|
#include "music.h"
|
2010-08-02 08:13:51 +00:00
|
|
|
#include "player.h"
|
|
|
|
#include "actors.h"
|
2011-02-25 21:50:19 +00:00
|
|
|
#include "quotes.h"
|
2010-08-02 08:13:51 +00:00
|
|
|
#include "global.h"
|
|
|
|
#include "sector.h"
|
|
|
|
#include "net.h"
|
|
|
|
#include "game.h"
|
|
|
|
#include "gamedef.h"
|
|
|
|
#include "gameexec.h"
|
|
|
|
#include "gamevars.h"
|
2009-07-09 02:29:48 +00:00
|
|
|
|
2012-12-10 18:17:57 +00:00
|
|
|
#ifdef LUNATIC
|
|
|
|
# include "lunatic_game.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static inline int32_t G_HaveEvent(int32_t iEventID)
|
|
|
|
{
|
|
|
|
#ifdef LUNATIC
|
2013-01-20 21:17:06 +00:00
|
|
|
return El_HaveEvent(iEventID);
|
|
|
|
#else
|
|
|
|
return apScriptGameEvent[iEventID]!=NULL;
|
2012-12-10 18:17:57 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2012-12-29 15:21:28 +00:00
|
|
|
static inline int32_t G_HaveActor(int32_t actortile)
|
|
|
|
{
|
|
|
|
#ifdef LUNATIC
|
2013-02-03 12:48:17 +00:00
|
|
|
return El_HaveActor(actortile);
|
|
|
|
#else
|
|
|
|
return g_tile[actortile].execPtr!=NULL;
|
2012-12-29 15:21:28 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int32_t G_InitialActorStrength(int32_t actortile)
|
|
|
|
{
|
2013-01-19 18:29:00 +00:00
|
|
|
#ifdef LUNATIC
|
2012-12-29 15:21:28 +00:00
|
|
|
return g_elActors[actortile].strength;
|
|
|
|
#else
|
|
|
|
return g_tile[actortile].execPtr[0];
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2012-11-05 02:49:08 +00:00
|
|
|
#ifdef EXTERNC
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
#endif
|
2008-12-19 00:53:54 +00:00
|
|
|
#endif
|