2010-08-02 08:13:51 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010 EDuke32 developers and contributors
|
|
|
|
|
|
|
|
This file is part of EDuke32.
|
|
|
|
|
|
|
|
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
|
2014-07-20 08:55:56 +00:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2010-08-02 08:13:51 +00:00
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#ifndef sector_h_
|
|
|
|
#define sector_h_
|
2010-08-02 08:13:51 +00:00
|
|
|
|
|
|
|
#include "gamevars.h"
|
2012-02-09 22:44:45 +00:00
|
|
|
#include "actors.h" // actor_t
|
|
|
|
#include "player.h" // playerspawn_t
|
2013-12-26 19:45:14 +00:00
|
|
|
#include "namesdyn.h" // for G_GetForcefieldPicnum()
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2011-02-25 21:50:19 +00:00
|
|
|
#define MAXCYCLERS 1024
|
|
|
|
#define MAXANIMATES 256
|
|
|
|
#define MAXANIMWALLS 512
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2014-12-21 15:51:48 +00:00
|
|
|
#define VIEWSCREEN_ACTIVE_DISTANCE 8192
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
typedef struct {
|
|
|
|
int16_t wallnum, tag;
|
|
|
|
} animwalltype;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
// this needs to have a copy of everything related to the map/actor state
|
|
|
|
// see savegame.c
|
|
|
|
int32_t animategoal[MAXANIMATES], animatevel[MAXANIMATES], g_animateCount;
|
2013-10-28 21:26:32 +00:00
|
|
|
intptr_t animateptr[MAXANIMATES];
|
2010-08-02 08:13:51 +00:00
|
|
|
int32_t lockclock;
|
|
|
|
int32_t msx[2048], msy[2048];
|
|
|
|
int32_t randomseed, g_globalRandom;
|
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
|
|
|
int32_t pskyidx;
|
2010-08-02 08:13:51 +00:00
|
|
|
|
|
|
|
int16_t SpriteDeletionQueue[1024],g_spriteDeleteQueuePos;
|
|
|
|
int16_t animatesect[MAXANIMATES];
|
|
|
|
int16_t cyclers[MAXCYCLERS][6];
|
|
|
|
int16_t g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount;
|
|
|
|
int16_t g_numAnimWalls;
|
|
|
|
int16_t g_numClouds,clouds[128],cloudx[128],cloudy[128];
|
|
|
|
int16_t g_numCyclers;
|
2012-03-14 22:31:49 +00:00
|
|
|
|
|
|
|
int32_t numsprites;
|
2012-03-13 20:07:17 +00:00
|
|
|
int16_t tailspritefree;
|
2010-08-02 08:13:51 +00:00
|
|
|
int16_t headspritesect[MAXSECTORS+1];
|
|
|
|
int16_t headspritestat[MAXSTATUS+1];
|
|
|
|
int16_t nextspritesect[MAXSPRITES];
|
|
|
|
int16_t nextspritestat[MAXSPRITES];
|
|
|
|
int16_t numsectors;
|
|
|
|
int16_t numwalls;
|
|
|
|
int16_t prevspritesect[MAXSPRITES];
|
|
|
|
int16_t prevspritestat[MAXSPRITES];
|
|
|
|
|
2013-02-11 17:16:50 +00:00
|
|
|
uint16_t g_earthquakeTime;
|
2012-08-16 21:48:13 +00:00
|
|
|
int8_t g_numPlayerSprites;
|
2012-03-11 17:37:50 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
uint8_t show2dsector[(MAXSECTORS+7)>>3];
|
|
|
|
|
|
|
|
actor_t actor[MAXSPRITES];
|
|
|
|
playerspawn_t g_playerSpawnPoints[MAXPLAYERS];
|
|
|
|
animwalltype animwall[MAXANIMWALLS];
|
2015-01-16 06:30:42 +00:00
|
|
|
tsectortype sector[MAXSECTORS];
|
2010-08-02 08:13:51 +00:00
|
|
|
spriteext_t spriteext[MAXSPRITES];
|
2015-01-16 06:30:42 +00:00
|
|
|
tspritetype sprite[MAXSPRITES];
|
|
|
|
twalltype wall[MAXWALLS];
|
2013-10-27 21:12:20 +00:00
|
|
|
#if !defined LUNATIC
|
2012-05-17 23:54:43 +00:00
|
|
|
intptr_t *vars[MAXGAMEVARS];
|
2013-10-27 21:12:20 +00:00
|
|
|
#else
|
|
|
|
char *savecode;
|
|
|
|
#endif
|
2012-03-11 17:37:08 +00:00
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
int32_t numyaxbunches;
|
2013-04-09 17:35:11 +00:00
|
|
|
# if !defined NEW_MAP_FORMAT
|
2012-03-11 17:37:08 +00:00
|
|
|
int16_t yax_bunchnum[MAXSECTORS][2];
|
|
|
|
int16_t yax_nextwall[MAXWALLS][2];
|
2013-04-09 17:35:11 +00:00
|
|
|
# endif
|
2012-03-11 17:37:08 +00:00
|
|
|
#endif
|
2010-08-02 08:13:51 +00:00
|
|
|
} mapstate_t;
|
|
|
|
|
2013-05-19 19:29:26 +00:00
|
|
|
extern void G_SaveMapState();
|
|
|
|
extern void G_RestoreMapState();
|
2010-08-02 08:13:51 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int32_t partime, designertime;
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
char *name, *filename, *musicfn, *ext_musicfn;
|
2010-08-02 08:13:51 +00:00
|
|
|
mapstate_t *savedstate;
|
|
|
|
} map_t;
|
|
|
|
|
2012-02-09 22:44:45 +00:00
|
|
|
//extern map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2011-02-25 21:50:19 +00:00
|
|
|
void G_ActivateBySector(int32_t sect,int32_t j);
|
2014-05-23 20:25:29 +00:00
|
|
|
int32_t S_FindMusicSFX(int32_t sn, int32_t *sndptr);
|
2010-08-02 08:13:51 +00:00
|
|
|
int32_t A_CallSound(int32_t sn,int32_t whatsprite);
|
|
|
|
int32_t A_CheckHitSprite(int32_t i,int16_t *hitsp);
|
|
|
|
void A_DamageObject(int32_t i,int32_t sn);
|
|
|
|
void A_DamageWall(int32_t spr,int32_t dawallnum,const vec3_t *pos,int32_t atwith);
|
2012-09-02 14:04:16 +00:00
|
|
|
int32_t __fastcall A_FindPlayer(const spritetype *s,int32_t *d);
|
2012-09-12 09:45:14 +00:00
|
|
|
void G_AlignWarpElevators(void);
|
2010-08-02 08:13:51 +00:00
|
|
|
int32_t CheckDoorTile(int32_t dapic);
|
2014-12-27 17:17:52 +00:00
|
|
|
void G_AnimateCamSprite(int32_t smoothratio);
|
2010-08-02 08:13:51 +00:00
|
|
|
void G_AnimateWalls(void);
|
|
|
|
int32_t G_ActivateWarpElevators(int32_t s,int32_t d);
|
|
|
|
int32_t G_CheckActivatorMotion(int32_t lotag);
|
|
|
|
void G_DoSectorAnimations(void);
|
|
|
|
void G_OperateActivators(int32_t low,int32_t snum);
|
|
|
|
void G_OperateForceFields(int32_t s,int32_t low);
|
|
|
|
void G_OperateMasterSwitches(int32_t low);
|
|
|
|
void G_OperateRespawns(int32_t low);
|
|
|
|
void G_OperateSectors(int32_t sn,int32_t ii);
|
2012-05-15 23:39:48 +00:00
|
|
|
void P_HandleSharedKeys(int32_t snum);
|
2011-12-21 18:43:39 +00:00
|
|
|
int32_t GetAnimationGoal(const int32_t *animptr);
|
2010-08-02 08:13:51 +00:00
|
|
|
int32_t isanearoperator(int32_t lotag);
|
|
|
|
int32_t isanunderoperator(int32_t lotag);
|
2012-03-10 21:22:03 +00:00
|
|
|
int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchissprite);
|
2010-08-02 08:13:51 +00:00
|
|
|
void P_CheckSectors(int32_t snum);
|
2013-12-20 18:31:29 +00:00
|
|
|
int32_t Sect_DamageCeilingOrFloor(int32_t floorp, int32_t sn);
|
2010-08-02 08:13:51 +00:00
|
|
|
int32_t SetAnimation(int32_t animsect,int32_t *animptr,int32_t thegoal,int32_t thevel);
|
|
|
|
|
2013-12-26 19:45:14 +00:00
|
|
|
#define FORCEFIELD_CSTAT (64+16+4+1)
|
|
|
|
|
|
|
|
// Returns W_FORCEFIELD if wall has a forcefield overpicnum, its overpicnum else.
|
|
|
|
static inline int32_t G_GetForcefieldPicnum(int32_t wallnum)
|
|
|
|
{
|
|
|
|
int32_t picnum = wall[wallnum].overpicnum;
|
2013-12-26 19:45:15 +00:00
|
|
|
if (picnum == W_FORCEFIELD+1)
|
2013-12-26 19:45:14 +00:00
|
|
|
picnum = W_FORCEFIELD;
|
|
|
|
return picnum;
|
|
|
|
}
|
|
|
|
|
2014-12-27 17:17:52 +00:00
|
|
|
// Returns the interpolated position of the camera that the player is looking
|
|
|
|
// through (using a viewscreen). <i> should be the player's ->newowner member.
|
|
|
|
static inline vec3_t G_GetCameraPosition(int32_t i, int32_t smoothratio)
|
|
|
|
{
|
|
|
|
const spritetype *const cs = &sprite[i];
|
|
|
|
const actor_t *const ca = &actor[i];
|
|
|
|
|
|
|
|
vec3_t cam = { ca->bpos.x + mulscale16(cs->x - ca->bpos.x, smoothratio),
|
|
|
|
ca->bpos.y + mulscale16(cs->y - ca->bpos.y, smoothratio),
|
|
|
|
ca->bpos.z + mulscale16(cs->z - ca->bpos.z, smoothratio)
|
|
|
|
};
|
|
|
|
return cam;
|
|
|
|
}
|
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-11-05 02:49:08 +00:00
|
|
|
#include "sector_inline.h"
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#endif
|