2015-05-19 21:54:34 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1997, 2005 - 3D Realms Entertainment
|
|
|
|
|
|
|
|
This file is part of Shadow Warrior version 1.2
|
|
|
|
|
|
|
|
Shadow Warrior is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
Original Source: 1997 - Frank Maddin and Jim Norwood
|
|
|
|
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// JSECTOR.C
|
|
|
|
// This is all Jim's programming having to do with sectors.
|
2019-10-09 16:09:05 +00:00
|
|
|
#include "ns.h"
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
#include "build.h"
|
|
|
|
|
2020-10-06 19:35:26 +00:00
|
|
|
#include "names.h"
|
2015-05-19 21:54:34 +00:00
|
|
|
#include "names2.h"
|
|
|
|
#include "panel.h"
|
|
|
|
#include "game.h"
|
|
|
|
#include "tags.h"
|
|
|
|
#include "sector.h"
|
|
|
|
#include "player.h"
|
|
|
|
#include "sprite.h"
|
|
|
|
#include "jsector.h"
|
|
|
|
#include "jtags.h"
|
|
|
|
#include "lists.h"
|
|
|
|
#include "pal.h"
|
|
|
|
#include "parent.h"
|
2020-01-12 19:28:07 +00:00
|
|
|
#include "v_video.h"
|
2021-03-21 11:22:50 +00:00
|
|
|
#include "render.h"
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-03-21 11:22:50 +00:00
|
|
|
EXTERN_CVAR(Bool, testnewrenderer)
|
|
|
|
|
2019-10-09 16:09:05 +00:00
|
|
|
BEGIN_SW_NS
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-03-21 11:22:50 +00:00
|
|
|
|
2015-05-19 21:54:34 +00:00
|
|
|
// V A R I A B L E D E C L A R A T I O N S //////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
MIRRORTYPE mirror[MAXMIRRORS];
|
|
|
|
|
|
|
|
short mirrorcnt; //, floormirrorcnt;
|
|
|
|
//short floormirrorsector[MAXMIRRORS];
|
2020-09-09 18:32:24 +00:00
|
|
|
bool mirrorinview;
|
2020-04-18 11:01:35 +00:00
|
|
|
uint32_t oscilationclock;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
// Voxel stuff
|
2020-09-09 18:32:24 +00:00
|
|
|
//bool bVoxelsOn = true; // Turn voxels on by default
|
|
|
|
bool bSpinBobVoxels = false; // Do twizzly stuff to voxels, but
|
2015-05-19 21:54:34 +00:00
|
|
|
// not by default
|
2020-09-09 18:32:24 +00:00
|
|
|
bool bAutoSize = true; // Autosizing on/off
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
//extern int chainnumpages;
|
|
|
|
extern AMB_INFO ambarray[];
|
|
|
|
extern short NormalVisibility;
|
|
|
|
|
|
|
|
extern ParentalStruct aVoxelArray[MAXTILES];
|
|
|
|
|
|
|
|
// F U N C T I O N S //////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
// SpawnWallSound
|
|
|
|
/////////////////////////////////////////////////////
|
2019-11-17 17:02:17 +00:00
|
|
|
void SpawnWallSound(short sndnum, short i)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
short SpriteNum;
|
SW: setsprite, setspritez, getzrange, clipmove, pushmove, neartag, dragpoint, screencapture, md_tilehasmodel, preparemirror, saveboard, loadboard, pos
git-svn-id: https://svn.eduke32.com/eduke32@5201 1a8010ca-5511-0410-912e-c29ae57300e0
2015-05-19 22:00:38 +00:00
|
|
|
vec3_t mid;
|
2015-05-19 21:54:34 +00:00
|
|
|
SPRITEp sp;
|
|
|
|
|
|
|
|
SpriteNum = COVERinsertsprite(0, STAT_DEFAULT);
|
|
|
|
if (SpriteNum < 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
sp = &sprite[SpriteNum];
|
|
|
|
sp->cstat = 0;
|
|
|
|
sp->extra = 0;
|
|
|
|
// Get wall midpoint for offset in mirror view
|
SW: setsprite, setspritez, getzrange, clipmove, pushmove, neartag, dragpoint, screencapture, md_tilehasmodel, preparemirror, saveboard, loadboard, pos
git-svn-id: https://svn.eduke32.com/eduke32@5201 1a8010ca-5511-0410-912e-c29ae57300e0
2015-05-19 22:00:38 +00:00
|
|
|
mid.x = (wall[i].x + wall[wall[i].point2].x) / 2;
|
|
|
|
mid.y = (wall[i].y + wall[wall[i].point2].y) / 2;
|
|
|
|
mid.z = (sector[wall[i].nextsector].ceilingz + sector[wall[i].nextsector].floorz) / 2;
|
|
|
|
setspritez(SpriteNum, &mid);
|
2015-05-19 21:54:34 +00:00
|
|
|
sp = &sprite[SpriteNum];
|
|
|
|
|
2019-12-18 18:17:37 +00:00
|
|
|
PlaySound(sndnum, sp, v3df_dontpan | v3df_doppler);
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
short
|
|
|
|
CheckTileSound(short picnum)
|
|
|
|
{
|
|
|
|
short sndnum = -1;
|
|
|
|
|
|
|
|
switch (picnum)
|
|
|
|
{
|
|
|
|
case 163: // Sizzly Lava
|
|
|
|
case 167:
|
|
|
|
sndnum = DIGI_VOLCANOSTEAM1;
|
|
|
|
break;
|
|
|
|
case 175: // Flowing Lava
|
|
|
|
sndnum = DIGI_ERUPTION;
|
|
|
|
break;
|
|
|
|
case 179: // Bubbly lava
|
|
|
|
sndnum = DIGI_LAVAFLOW1;
|
|
|
|
break;
|
|
|
|
case 300: // Water fall tile
|
|
|
|
sndnum = DIGI_WATERFALL1;
|
|
|
|
break;
|
|
|
|
case 334: // Teleporter Pad
|
|
|
|
sndnum = DIGI_ENGROOM1;
|
|
|
|
break;
|
|
|
|
case 2690: // Jet engine fan
|
|
|
|
sndnum = DIGI_JET;
|
|
|
|
break;
|
|
|
|
case 2672: // X-Ray Machine engine
|
|
|
|
sndnum = DIGI_ENGROOM5;
|
|
|
|
break;
|
|
|
|
case 768: // Electricity
|
|
|
|
// sndnum = DIGI_;
|
|
|
|
break;
|
|
|
|
case 2714: // Pachinko Machine
|
|
|
|
// sndnum = DIGI_;
|
|
|
|
break;
|
|
|
|
case 2782: // Telepad
|
|
|
|
sndnum = DIGI_ENGROOM4;
|
|
|
|
break;
|
|
|
|
case 3382: // Gears
|
|
|
|
sndnum = DIGI_ENGROOM5;
|
|
|
|
break;
|
|
|
|
case 2801: // Computers
|
|
|
|
case 2804:
|
|
|
|
case 2807:
|
|
|
|
case 3352:
|
|
|
|
case 3385:
|
|
|
|
case 3389:
|
|
|
|
case 3393:
|
|
|
|
case 3397:
|
|
|
|
case 3401:
|
|
|
|
case 3405:
|
|
|
|
// sndnum = DIGI_;
|
|
|
|
break;
|
|
|
|
case 3478: // Radar screen
|
|
|
|
// sndnum = DIGI_;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sndnum = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return sndnum;
|
|
|
|
}
|
|
|
|
|
2019-10-09 17:58:09 +00:00
|
|
|
ANIMATOR GenerateDrips;
|
|
|
|
|
2015-05-19 21:54:34 +00:00
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
// Initialize any of my special use sprites
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
void
|
|
|
|
JS_SpriteSetup(void)
|
|
|
|
{
|
|
|
|
SPRITEp sp;
|
2020-10-15 16:07:35 +00:00
|
|
|
int SpriteNum;
|
2015-05-19 21:54:34 +00:00
|
|
|
USERp u;
|
2020-03-06 15:49:49 +00:00
|
|
|
short i;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2020-10-15 16:07:35 +00:00
|
|
|
StatIterator it(STAT_DEFAULT);
|
|
|
|
while ((SpriteNum = it.NextIndex()) >= 0)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
short tag;
|
|
|
|
|
|
|
|
sp = &sprite[SpriteNum];
|
|
|
|
tag = sp->hitag;
|
|
|
|
|
|
|
|
// Non static camera. Camera sprite will be drawn!
|
|
|
|
if (tag == MIRROR_CAM && sprite[SpriteNum].picnum != ST1)
|
|
|
|
{
|
|
|
|
// Just change it to static, sprite has all the info I need
|
2021-07-10 12:25:18 +00:00
|
|
|
// u = SpawnUser(SpriteNum, sp->picnum, nullptr);
|
2015-05-19 21:54:34 +00:00
|
|
|
// RESET(sp->cstat, CSTAT_SPRITE_BLOCK);
|
|
|
|
// SET(sp->cstat, CSTAT_SPRITE_BLOCK_HITSCAN);
|
|
|
|
change_sprite_stat(SpriteNum, STAT_SPAWN_SPOT);
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (sprite[SpriteNum].picnum)
|
|
|
|
{
|
|
|
|
case ST1:
|
|
|
|
if (tag == MIRROR_CAM)
|
|
|
|
{
|
|
|
|
// Just change it to static, sprite has all the info I need
|
|
|
|
// ST1 cameras won't move with SOBJ's!
|
|
|
|
change_sprite_stat(SpriteNum, STAT_ST1);
|
|
|
|
}
|
|
|
|
else if (tag == MIRROR_SPAWNSPOT)
|
|
|
|
{
|
|
|
|
// Just change it to static, sprite has all the info I need
|
|
|
|
change_sprite_stat(SpriteNum, STAT_ST1);
|
|
|
|
}
|
|
|
|
else if (tag == AMBIENT_SOUND)
|
|
|
|
{
|
|
|
|
change_sprite_stat(SpriteNum, STAT_AMBIENT);
|
|
|
|
}
|
|
|
|
else if (tag == TAG_ECHO_SOUND)
|
|
|
|
{
|
|
|
|
change_sprite_stat(SpriteNum, STAT_ECHO);
|
|
|
|
}
|
|
|
|
else if (tag == TAG_DRIPGEN)
|
|
|
|
{
|
2021-07-10 12:25:18 +00:00
|
|
|
u = SpawnUser(SpriteNum, 0, nullptr);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-07-10 12:25:18 +00:00
|
|
|
ASSERT(u != nullptr);
|
2015-05-19 21:54:34 +00:00
|
|
|
u->RotNum = 0;
|
|
|
|
u->WaitTics = sp->lotag * 120;
|
|
|
|
|
|
|
|
u->ActorActionFunc = GenerateDrips;
|
|
|
|
|
|
|
|
change_sprite_stat(SpriteNum, STAT_NO_STATE);
|
|
|
|
SET(sp->cstat, CSTAT_SPRITE_INVISIBLE);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
// Sprites in editart that should play ambient sounds
|
|
|
|
// automatically
|
|
|
|
case 380:
|
|
|
|
case 396:
|
|
|
|
case 430:
|
|
|
|
case 443:
|
|
|
|
case 512:
|
|
|
|
case 521:
|
|
|
|
case 541:
|
|
|
|
case 2720:
|
|
|
|
case 3143:
|
|
|
|
case 3157:
|
2019-12-18 18:17:37 +00:00
|
|
|
PlaySound(DIGI_FIRE1, sp, v3df_follow|v3df_dontpan|v3df_doppler);
|
2015-05-19 21:54:34 +00:00
|
|
|
break;
|
|
|
|
case 795:
|
|
|
|
case 880:
|
2019-12-18 18:17:37 +00:00
|
|
|
PlaySound(DIGI_WATERFLOW1, sp, v3df_follow|v3df_dontpan|v3df_doppler);
|
2015-05-19 21:54:34 +00:00
|
|
|
break;
|
|
|
|
case 460: // Wind Chimes
|
2019-12-19 00:20:43 +00:00
|
|
|
InitAmbient(79, sp);
|
2015-05-19 21:54:34 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Check for certain walls to make sounds
|
|
|
|
for (i = 0; i < numwalls; i++)
|
|
|
|
{
|
|
|
|
short picnum;
|
|
|
|
|
|
|
|
|
|
|
|
picnum = wall[i].picnum;
|
|
|
|
|
|
|
|
// Set the don't stick bit for liquid tiles
|
|
|
|
switch (picnum)
|
|
|
|
{
|
|
|
|
case 175:
|
|
|
|
case 179:
|
|
|
|
case 300:
|
|
|
|
case 320:
|
|
|
|
case 330:
|
|
|
|
case 352:
|
|
|
|
case 780:
|
|
|
|
case 890:
|
|
|
|
case 2608:
|
|
|
|
case 2616:
|
|
|
|
//case 3834:
|
|
|
|
SET(wall[i].extra, WALLFX_DONT_STICK);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
// Initialize the mirrors
|
|
|
|
/////////////////////////////////////////////////////
|
2019-11-17 17:02:17 +00:00
|
|
|
void JS_InitMirrors(void)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-03-06 15:49:49 +00:00
|
|
|
short startwall, endwall;
|
|
|
|
int i, j, s;
|
2020-10-15 16:07:35 +00:00
|
|
|
int SpriteNum;
|
2020-09-09 18:32:24 +00:00
|
|
|
bool Found_Cam = false;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Set all the mirror struct values to -1
|
|
|
|
memset(mirror, 0xFF, sizeof(mirror));
|
|
|
|
|
2020-09-09 17:52:52 +00:00
|
|
|
mirrorinview = false; // Initially set global mirror flag
|
2015-05-19 21:54:34 +00:00
|
|
|
// to no mirrors seen
|
|
|
|
|
|
|
|
// Scan wall tags for mirrors
|
|
|
|
mirrorcnt = 0;
|
2019-10-11 19:04:31 +00:00
|
|
|
tileDelete(MIRROR);
|
2020-09-02 16:59:56 +00:00
|
|
|
oscilationclock = I_GetBuildTime();
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
for (i = 0; i < MAXMIRRORS; i++)
|
|
|
|
{
|
2019-10-11 19:04:31 +00:00
|
|
|
tileDelete(i + MIRRORLABEL);
|
2015-05-19 21:54:34 +00:00
|
|
|
mirror[i].campic = -1;
|
|
|
|
mirror[i].camsprite = -1;
|
|
|
|
mirror[i].camera = -1;
|
2020-09-09 17:52:52 +00:00
|
|
|
mirror[i].ismagic = false;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < numwalls; i++)
|
|
|
|
{
|
|
|
|
s = wall[i].nextsector;
|
|
|
|
if ((s >= 0) && (wall[i].overpicnum == MIRROR) && (wall[i].cstat & 32))
|
|
|
|
{
|
|
|
|
if ((sector[s].floorstat & 1) == 0)
|
|
|
|
{
|
2020-02-19 03:50:20 +00:00
|
|
|
if (mirrorcnt >= MAXMIRRORS)
|
|
|
|
{
|
2020-05-21 14:25:41 +00:00
|
|
|
Printf("MAXMIRRORS reached! Skipping mirror wall[%d]\n", i);
|
2020-02-19 03:50:20 +00:00
|
|
|
wall[i].overpicnum = sector[s].ceilingpicnum;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2015-05-19 21:54:34 +00:00
|
|
|
wall[i].overpicnum = MIRRORLABEL + mirrorcnt;
|
|
|
|
wall[i].picnum = MIRRORLABEL + mirrorcnt;
|
|
|
|
sector[s].ceilingpicnum = MIRRORLABEL + mirrorcnt;
|
|
|
|
sector[s].floorpicnum = MIRRORLABEL + mirrorcnt;
|
|
|
|
sector[s].floorstat |= 1;
|
|
|
|
mirror[mirrorcnt].mirrorwall = i;
|
|
|
|
mirror[mirrorcnt].mirrorsector = s;
|
|
|
|
mirror[mirrorcnt].numspawnspots = 0;
|
2020-09-09 17:52:52 +00:00
|
|
|
mirror[mirrorcnt].ismagic = false;
|
2020-02-19 03:50:20 +00:00
|
|
|
do if (wall[i].lotag == TAG_WALL_MAGIC_MIRROR)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-10-15 16:59:11 +00:00
|
|
|
int ii;
|
2015-05-19 21:54:34 +00:00
|
|
|
SPRITEp sp;
|
|
|
|
|
2020-09-09 17:52:52 +00:00
|
|
|
Found_Cam = false;
|
2020-10-15 16:59:11 +00:00
|
|
|
|
|
|
|
StatIterator it(STAT_ST1);
|
|
|
|
while ((ii = it.NextIndex()) >= 0)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
sp = &sprite[ii];
|
|
|
|
// if correct type and matches
|
|
|
|
if (sp->hitag == MIRROR_CAM && sp->lotag == wall[i].hitag)
|
|
|
|
{
|
|
|
|
mirror[mirrorcnt].camera = ii;
|
2021-03-21 16:04:06 +00:00
|
|
|
// Set up camera variables
|
2015-05-19 21:54:34 +00:00
|
|
|
SP_TAG5(sp) = sp->ang; // Set current angle to
|
|
|
|
// sprite angle
|
2020-09-09 17:52:52 +00:00
|
|
|
Found_Cam = true;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-15 16:59:11 +00:00
|
|
|
it.Reset(STAT_SPAWN_SPOT);
|
|
|
|
while ((ii = it.NextIndex()) >= 0)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
sp = &sprite[ii];
|
|
|
|
|
|
|
|
// if correct type and matches
|
|
|
|
if (sp->hitag == MIRROR_CAM && sp->lotag == wall[i].hitag)
|
|
|
|
{
|
|
|
|
mirror[mirrorcnt].camera = ii;
|
2021-03-21 16:04:06 +00:00
|
|
|
// Set up camera variables
|
2015-05-19 21:54:34 +00:00
|
|
|
SP_TAG5(sp) = sp->ang; // Set current angle to
|
|
|
|
// sprite angle
|
2020-09-09 17:52:52 +00:00
|
|
|
Found_Cam = true;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!Found_Cam)
|
|
|
|
{
|
2020-10-15 15:02:35 +00:00
|
|
|
Printf("Cound not find the camera view sprite for match %d\n", wall[i].hitag);
|
|
|
|
Printf("Map Coordinates: x = %d, y = %d\n", wall[i].x, wall[i].y);
|
2020-02-19 03:50:20 +00:00
|
|
|
break;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2020-09-09 17:52:52 +00:00
|
|
|
mirror[mirrorcnt].ismagic = true;
|
2020-02-19 03:50:20 +00:00
|
|
|
|
2020-09-09 17:52:52 +00:00
|
|
|
Found_Cam = false;
|
2015-05-19 21:54:34 +00:00
|
|
|
if (TEST_BOOL1(&sprite[mirror[mirrorcnt].camera]))
|
|
|
|
{
|
2020-10-15 16:07:35 +00:00
|
|
|
StatIterator it(STAT_DEFAULT);
|
|
|
|
while ((SpriteNum = it.NextIndex()) >= 0)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
sp = &sprite[SpriteNum];
|
|
|
|
if (sp->picnum >= CAMSPRITE && sp->picnum < CAMSPRITE + 8 &&
|
|
|
|
sp->hitag == wall[i].hitag)
|
|
|
|
{
|
|
|
|
mirror[mirrorcnt].campic = sp->picnum;
|
|
|
|
mirror[mirrorcnt].camsprite = SpriteNum;
|
|
|
|
|
|
|
|
// JBF: commenting out this line results in the screen in $BULLET being visible
|
2019-10-11 19:04:31 +00:00
|
|
|
tileDelete(mirror[mirrorcnt].campic);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2020-09-09 17:52:52 +00:00
|
|
|
Found_Cam = true;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!Found_Cam)
|
|
|
|
{
|
2020-10-15 15:02:35 +00:00
|
|
|
Printf("Did not find drawtotile for camera number %d\n", mirrorcnt);
|
|
|
|
Printf("wall[%d].hitag == %d\n", i, wall[i].hitag);
|
|
|
|
Printf("Map Coordinates: x = %d, y = %d\n", wall[i].x, wall[i].y);
|
2020-02-19 03:50:20 +00:00
|
|
|
RESET_BOOL1(&sprite[mirror[mirrorcnt].camera]);
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// For magic mirrors, set allowable viewing time to 30
|
|
|
|
// secs
|
|
|
|
// Base rate is supposed to be 120, but time is double
|
|
|
|
// what I expect
|
|
|
|
mirror[mirrorcnt].maxtics = 60 * 30;
|
|
|
|
|
|
|
|
}
|
2020-02-19 03:50:20 +00:00
|
|
|
while (0);
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
mirror[mirrorcnt].mstate = m_normal;
|
|
|
|
|
|
|
|
// Set tics used to none
|
|
|
|
mirror[mirrorcnt].tics = 0;
|
|
|
|
|
|
|
|
if (mirror[mirrorcnt].ismagic)
|
|
|
|
{
|
|
|
|
//DSPRINTF(ds, "mirror.mirrorwall %d", mirror[mirrorcnt].mirrorwall);
|
|
|
|
MONO_PRINT(ds);
|
|
|
|
//DSPRINTF(ds, "mirror.mirrorsector %d", mirror[mirrorcnt].mirrorsector);
|
|
|
|
MONO_PRINT(ds);
|
|
|
|
//DSPRINTF(ds, "mirror.camera %d", mirror[mirrorcnt].camera);
|
|
|
|
MONO_PRINT(ds);
|
|
|
|
}
|
|
|
|
|
|
|
|
mirrorcnt++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
wall[i].overpicnum = sector[s].ceilingpicnum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Invalidate textures in sector behind mirror
|
|
|
|
for (i = 0; i < mirrorcnt; i++)
|
|
|
|
{
|
|
|
|
startwall = sector[mirror[i].mirrorsector].wallptr;
|
|
|
|
endwall = startwall + sector[mirror[i].mirrorsector].wallnum;
|
|
|
|
for (j = startwall; j < endwall; j++)
|
|
|
|
{
|
|
|
|
wall[j].picnum = MIRROR;
|
|
|
|
wall[j].overpicnum = MIRROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // InitMirrors
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
// Draw a 3d screen to a specific tile
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
void drawroomstotile(int daposx, int daposy, int daposz,
|
2021-03-28 17:22:51 +00:00
|
|
|
binangle ang, fixedhoriz horiz, short dacursectnum, short tilenume, double smoothratio)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-11-23 07:55:02 +00:00
|
|
|
TileFiles.MakeCanvas(tilenume, tileWidth(tilenume), tileHeight(tilenume));
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2020-06-14 19:57:21 +00:00
|
|
|
auto canvas = renderSetTarget(tilenume);
|
|
|
|
if (!canvas) return;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2020-06-14 19:57:21 +00:00
|
|
|
screen->RenderTextureView(canvas, [=](IntRect& rect)
|
|
|
|
{
|
2021-03-21 11:22:50 +00:00
|
|
|
if (!testnewrenderer)
|
|
|
|
{
|
2021-11-08 22:40:57 +00:00
|
|
|
renderDrawRoomsQ16(daposx, daposy, daposz, ang.asq16(), horiz.asq16(), dacursectnum, false);
|
2021-04-02 08:28:40 +00:00
|
|
|
analyzesprites(pm_tsprite, pm_spritesortcnt, daposx, daposy, daposz, ang.asbuild());
|
2021-03-21 11:22:50 +00:00
|
|
|
renderDrawMasks();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-04-11 05:43:11 +00:00
|
|
|
render_camtex(nullptr, { daposx, daposy, daposz }, dacursectnum, ang, horiz, buildang(0), tileGetTexture(tilenume), rect, smoothratio);
|
2021-03-21 11:22:50 +00:00
|
|
|
}
|
2020-06-14 19:57:21 +00:00
|
|
|
});
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2019-04-08 06:26:36 +00:00
|
|
|
renderRestoreTarget();
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
JS_ProcessEchoSpot()
|
|
|
|
{
|
2020-10-15 15:45:07 +00:00
|
|
|
int i;
|
2015-05-19 21:54:34 +00:00
|
|
|
SPRITEp tp;
|
|
|
|
int j,dist;
|
|
|
|
PLAYERp pp = Player+screenpeek;
|
2015-05-19 21:58:29 +00:00
|
|
|
int16_t reverb;
|
2020-09-09 18:32:24 +00:00
|
|
|
bool reverb_set = false;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
// Process echo sprites
|
2020-10-15 15:30:55 +00:00
|
|
|
StatIterator it(STAT_ECHO);
|
|
|
|
while ((i = it.NextIndex()) >= 0)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
dist = 0x7fffffff;
|
|
|
|
|
|
|
|
tp = &sprite[i];
|
|
|
|
|
2021-01-04 12:02:00 +00:00
|
|
|
j = abs(tp->x - pp->posx);
|
|
|
|
j += abs(tp->y - pp->posy);
|
2015-05-19 21:54:34 +00:00
|
|
|
if (j < dist)
|
|
|
|
dist = j;
|
|
|
|
|
|
|
|
if (dist <= SP_TAG4(tp)) // tag4 = ang
|
|
|
|
{
|
|
|
|
reverb = SP_TAG2(tp);
|
|
|
|
if (reverb > 200) reverb = 200;
|
|
|
|
if (reverb < 100) reverb = 100;
|
|
|
|
|
|
|
|
COVER_SetReverb(reverb);
|
2020-09-09 17:52:52 +00:00
|
|
|
reverb_set = true;
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!TEST(pp->Flags, PF_DIVING) && !reverb_set && pp->Reverb <= 0)
|
|
|
|
COVER_SetReverb(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
// Draw one mirror, the one closest to player
|
|
|
|
// Cams and see to teleporters do NOT support room above room!
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
#define MAXCAMDIST 8000
|
|
|
|
|
|
|
|
int camloopcnt = 0; // Timer to cycle through player
|
2020-09-02 16:59:56 +00:00
|
|
|
int lastcamclock;
|
2015-05-19 21:54:34 +00:00
|
|
|
// views
|
|
|
|
short camplayerview = 1; // Don't show yourself!
|
|
|
|
|
2021-03-21 16:04:06 +00:00
|
|
|
|
2020-03-29 12:01:46 +00:00
|
|
|
// Hack job alert!
|
|
|
|
// Mirrors and cameras are maintained in the same data structure, but for hardware rendering they cannot be interleaved.
|
|
|
|
// So this function replicates JS_DrawMirrors to only process the camera textures but not change any global state.
|
2021-03-28 17:22:51 +00:00
|
|
|
void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz, double smoothratio)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-03-06 15:49:49 +00:00
|
|
|
int j, cnt;
|
|
|
|
int dist;
|
|
|
|
int tposx, tposy; // Camera
|
2020-03-29 12:01:46 +00:00
|
|
|
int* longptr;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2020-09-09 18:32:24 +00:00
|
|
|
bool bIsWallMirror = false;
|
2020-09-02 16:59:56 +00:00
|
|
|
int camclock = I_GetBuildTime();
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2020-09-02 16:59:56 +00:00
|
|
|
camloopcnt += camclock - lastcamclock;
|
2015-05-19 21:54:34 +00:00
|
|
|
if (camloopcnt > (60 * 5)) // 5 seconds per player view
|
|
|
|
{
|
|
|
|
camloopcnt = 0;
|
|
|
|
camplayerview++;
|
|
|
|
if (camplayerview >= numplayers)
|
|
|
|
camplayerview = 1;
|
|
|
|
}
|
2020-09-02 16:59:56 +00:00
|
|
|
lastcamclock = camclock;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2020-03-29 12:01:46 +00:00
|
|
|
{
|
2020-09-02 16:59:56 +00:00
|
|
|
uint32_t oscilation_delta = camclock - oscilationclock;
|
2020-04-18 11:01:35 +00:00
|
|
|
oscilation_delta -= oscilation_delta % 4;
|
|
|
|
oscilationclock += oscilation_delta;
|
|
|
|
oscilation_delta *= 2;
|
2020-03-29 12:01:46 +00:00
|
|
|
for (cnt = MAXMIRRORS - 1; cnt >= 0; cnt--)
|
|
|
|
{
|
|
|
|
if (!mirror[cnt].ismagic) continue; // these are definitely not camera textures.
|
|
|
|
|
2021-05-09 07:05:42 +00:00
|
|
|
if (testgotpic(cnt + MIRRORLABEL) || ((unsigned)mirror[cnt].campic < MAXTILES && testgotpic(mirror[cnt].campic)))
|
2020-03-29 12:01:46 +00:00
|
|
|
{
|
|
|
|
// Do not change any global state here!
|
2021-05-09 07:05:42 +00:00
|
|
|
bIsWallMirror = testgotpic(cnt + MIRRORLABEL);
|
2020-03-29 12:01:46 +00:00
|
|
|
dist = 0x7fffffff;
|
|
|
|
|
|
|
|
if (bIsWallMirror)
|
|
|
|
{
|
2021-01-04 12:02:00 +00:00
|
|
|
j = abs(wall[mirror[cnt].mirrorwall].x - tx);
|
|
|
|
j += abs(wall[mirror[cnt].mirrorwall].y - ty);
|
2020-03-29 12:01:46 +00:00
|
|
|
if (j < dist)
|
|
|
|
dist = j;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SPRITEp tp;
|
|
|
|
|
|
|
|
tp = &sprite[mirror[cnt].camsprite];
|
|
|
|
|
2021-01-04 12:02:00 +00:00
|
|
|
j = abs(tp->x - tx);
|
|
|
|
j += abs(tp->y - ty);
|
2020-03-29 12:01:46 +00:00
|
|
|
if (j < dist)
|
|
|
|
dist = j;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-07-10 12:25:18 +00:00
|
|
|
SPRITEp sp = nullptr;
|
2020-03-29 12:01:46 +00:00
|
|
|
short w;
|
|
|
|
int dx, dy, dz, tdx, tdy, tdz, midx, midy;
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT(mirror[cnt].camera != -1);
|
|
|
|
|
|
|
|
sp = &sprite[mirror[cnt].camera];
|
|
|
|
|
|
|
|
ASSERT(sp);
|
|
|
|
|
|
|
|
// Calculate the angle of the mirror wall
|
|
|
|
w = mirror[cnt].mirrorwall;
|
|
|
|
|
|
|
|
// Get wall midpoint for offset in mirror view
|
|
|
|
midx = (wall[w].x + wall[wall[w].point2].x) / 2;
|
|
|
|
midy = (wall[w].y + wall[wall[w].point2].y) / 2;
|
|
|
|
|
|
|
|
// Finish finding offsets
|
2021-01-04 12:02:00 +00:00
|
|
|
tdx = abs(midx - tx);
|
|
|
|
tdy = abs(midy - ty);
|
2020-03-29 12:01:46 +00:00
|
|
|
|
|
|
|
if (midx >= tx)
|
|
|
|
dx = sp->x - tdx;
|
|
|
|
else
|
|
|
|
dx = sp->x + tdx;
|
|
|
|
|
|
|
|
if (midy >= ty)
|
|
|
|
dy = sp->y - tdy;
|
|
|
|
else
|
|
|
|
dy = sp->y + tdy;
|
|
|
|
|
2021-01-04 12:02:00 +00:00
|
|
|
tdz = abs(tz - sp->z);
|
2020-03-29 12:01:46 +00:00
|
|
|
if (tz >= sp->z)
|
|
|
|
dz = sp->z + tdz;
|
|
|
|
else
|
|
|
|
dz = sp->z - tdz;
|
|
|
|
|
|
|
|
|
|
|
|
// Is it a TV cam or a teleporter that shows destination?
|
2020-09-09 17:52:52 +00:00
|
|
|
// true = It's a TV cam
|
2020-03-29 12:01:46 +00:00
|
|
|
mirror[cnt].mstate = m_normal;
|
|
|
|
if (TEST_BOOL1(sp))
|
|
|
|
mirror[cnt].mstate = m_viewon;
|
|
|
|
|
|
|
|
// Show teleport destination
|
|
|
|
// NOTE: Adding MAXSECTORS lets you draw a room, even if
|
|
|
|
// you are outside of it!
|
|
|
|
if (mirror[cnt].mstate == m_viewon)
|
|
|
|
{
|
2020-09-09 18:32:24 +00:00
|
|
|
bool DoCam = false;
|
2020-03-29 12:01:46 +00:00
|
|
|
|
|
|
|
if (mirror[cnt].campic == -1)
|
|
|
|
{
|
2020-02-19 03:50:20 +00:00
|
|
|
Printf("Missing campic for mirror %d\n",cnt);
|
|
|
|
Printf("Map Coordinates: x = %d, y = %d\n",midx,midy);
|
2020-03-29 12:01:46 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// BOOL2 = Oscilate camera
|
|
|
|
if (TEST_BOOL2(sp) && MoveSkip2 == 0)
|
|
|
|
{
|
|
|
|
if (TEST_BOOL3(sp)) // If true add increment to
|
|
|
|
// angle else subtract
|
|
|
|
{
|
|
|
|
// Store current angle in TAG5
|
2020-04-18 11:01:35 +00:00
|
|
|
SP_TAG5(sp) = NORM_ANGLE((SP_TAG5(sp) + oscilation_delta));
|
2020-03-29 12:01:46 +00:00
|
|
|
|
|
|
|
// TAG6 = Turn radius
|
2021-01-04 12:02:00 +00:00
|
|
|
if (abs(getincangle(sp->ang, SP_TAG5(sp))) >= SP_TAG6(sp))
|
2020-03-29 12:01:46 +00:00
|
|
|
{
|
2020-04-18 11:01:35 +00:00
|
|
|
SP_TAG5(sp) = NORM_ANGLE((SP_TAG5(sp) - oscilation_delta));
|
2020-03-29 12:01:46 +00:00
|
|
|
RESET_BOOL3(sp); // Reverse turn
|
|
|
|
// direction.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Store current angle in TAG5
|
2020-04-18 11:01:35 +00:00
|
|
|
SP_TAG5(sp) = NORM_ANGLE((SP_TAG5(sp) - oscilation_delta));
|
2020-03-29 12:01:46 +00:00
|
|
|
|
|
|
|
// TAG6 = Turn radius
|
2021-01-04 12:02:00 +00:00
|
|
|
if (abs(getincangle(sp->ang, SP_TAG5(sp))) >= SP_TAG6(sp))
|
2020-03-29 12:01:46 +00:00
|
|
|
{
|
2020-04-18 11:01:35 +00:00
|
|
|
SP_TAG5(sp) = NORM_ANGLE((SP_TAG5(sp) + oscilation_delta));
|
2020-03-29 12:01:46 +00:00
|
|
|
SET_BOOL3(sp); // Reverse turn
|
|
|
|
// direction.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!TEST_BOOL2(sp))
|
|
|
|
{
|
|
|
|
SP_TAG5(sp) = sp->ang; // Copy sprite angle to
|
|
|
|
// tag5
|
|
|
|
}
|
|
|
|
|
2021-10-31 00:06:13 +00:00
|
|
|
// Set the horizon value.
|
|
|
|
auto camhoriz = q16horiz(clamp(IntToFixed(SP_TAG7(sp) - 100), gi->playerHorizMin(), gi->playerHorizMax()));
|
2020-03-29 12:01:46 +00:00
|
|
|
|
|
|
|
// If player is dead still then update at MoveSkip4
|
|
|
|
// rate.
|
|
|
|
if (pp->posx == pp->oposx && pp->posy == pp->oposy && pp->posz == pp->oposz)
|
2020-09-09 17:52:52 +00:00
|
|
|
DoCam = true;
|
2020-03-29 12:01:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Set up the tile for drawing
|
|
|
|
TileFiles.MakeCanvas(mirror[cnt].campic, 128, 128);
|
|
|
|
|
|
|
|
{
|
|
|
|
if (dist < MAXCAMDIST)
|
|
|
|
{
|
|
|
|
PLAYERp cp = Player + camplayerview;
|
|
|
|
|
|
|
|
if (TEST_BOOL11(sp) && numplayers > 1)
|
|
|
|
{
|
2021-03-28 17:22:51 +00:00
|
|
|
drawroomstotile(cp->posx, cp->posy, cp->posz, cp->angle.ang, cp->horizon.horiz, cp->cursectnum, mirror[cnt].campic, smoothratio);
|
2020-03-29 12:01:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-31 00:06:13 +00:00
|
|
|
drawroomstotile(sp->x, sp->y, sp->z, buildang(SP_TAG5(sp)), camhoriz, sp->sectnum, mirror[cnt].campic, smoothratio);
|
2020-03-29 12:01:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-28 17:22:51 +00:00
|
|
|
// Workaround until the camera code can be refactored to process all camera textures that were visible last frame.
|
|
|
|
// Need to stash the parameters for later use. This is only used to find the nearest camera.
|
|
|
|
static PLAYERp cam_pp;
|
|
|
|
static int cam_tx, cam_ty, cam_tz;
|
2021-03-29 19:48:23 +00:00
|
|
|
static int oldstat;
|
2021-03-28 17:22:51 +00:00
|
|
|
|
|
|
|
void JS_CameraParms(PLAYERp pp, int tx, int ty, int tz)
|
|
|
|
{
|
|
|
|
cam_pp = pp;
|
|
|
|
cam_tx = tx;
|
|
|
|
cam_ty = ty;
|
|
|
|
cam_tz = tz;
|
|
|
|
}
|
|
|
|
|
|
|
|
void GameInterface::UpdateCameras(double smoothratio)
|
|
|
|
{
|
|
|
|
JS_DrawCameras(cam_pp, cam_tx, cam_ty, cam_tz, smoothratio);
|
|
|
|
}
|
|
|
|
|
2021-03-29 19:48:23 +00:00
|
|
|
void GameInterface::EnterPortal(spritetype* viewer, int type)
|
|
|
|
{
|
|
|
|
if (type == PORTAL_WALL_MIRROR) display_mirror++;
|
|
|
|
}
|
|
|
|
|
|
|
|
void GameInterface::LeavePortal(spritetype* viewer, int type)
|
|
|
|
{
|
|
|
|
if (type == PORTAL_WALL_MIRROR) display_mirror--;
|
|
|
|
}
|
|
|
|
|
2021-03-28 17:22:51 +00:00
|
|
|
|
2015-05-19 21:54:34 +00:00
|
|
|
void
|
2019-12-26 06:27:48 +00:00
|
|
|
DoAutoSize(tspriteptr_t tspr)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
if (!bAutoSize)
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch (tspr->picnum)
|
|
|
|
{
|
|
|
|
case ICON_STAR: // 1793
|
|
|
|
break;
|
|
|
|
case ICON_UZI: // 1797
|
|
|
|
tspr->xrepeat = 43;
|
|
|
|
tspr->yrepeat = 40;
|
|
|
|
break;
|
|
|
|
case ICON_UZIFLOOR: // 1807
|
|
|
|
tspr->xrepeat = 43;
|
|
|
|
tspr->yrepeat = 40;
|
|
|
|
break;
|
|
|
|
case ICON_LG_UZI_AMMO: // 1799
|
|
|
|
break;
|
|
|
|
case ICON_HEART: // 1824
|
|
|
|
break;
|
|
|
|
case ICON_HEART_LG_AMMO: // 1820
|
|
|
|
break;
|
|
|
|
case ICON_GUARD_HEAD: // 1814
|
|
|
|
break;
|
|
|
|
case ICON_FIREBALL_LG_AMMO: // 3035
|
|
|
|
break;
|
|
|
|
case ICON_ROCKET: // 1843
|
|
|
|
break;
|
|
|
|
case ICON_SHOTGUN: // 1794
|
|
|
|
tspr->xrepeat = 57;
|
|
|
|
tspr->yrepeat = 58;
|
|
|
|
break;
|
|
|
|
case ICON_LG_ROCKET: // 1796
|
|
|
|
break;
|
|
|
|
case ICON_LG_SHOTSHELL: // 1823
|
|
|
|
break;
|
|
|
|
case ICON_MICRO_GUN: // 1818
|
|
|
|
break;
|
|
|
|
case ICON_MICRO_BATTERY: // 1800
|
|
|
|
break;
|
|
|
|
case ICON_GRENADE_LAUNCHER: // 1817
|
|
|
|
tspr->xrepeat = 54;
|
|
|
|
tspr->yrepeat = 52;
|
|
|
|
break;
|
|
|
|
case ICON_LG_GRENADE: // 1831
|
|
|
|
break;
|
|
|
|
case ICON_LG_MINE: // 1842
|
|
|
|
break;
|
|
|
|
case ICON_RAIL_GUN: // 1811
|
|
|
|
tspr->xrepeat = 50;
|
|
|
|
tspr->yrepeat = 54;
|
|
|
|
break;
|
|
|
|
case ICON_RAIL_AMMO: // 1812
|
|
|
|
break;
|
|
|
|
case ICON_SM_MEDKIT: // 1802
|
|
|
|
break;
|
|
|
|
case ICON_MEDKIT: // 1803
|
|
|
|
break;
|
|
|
|
case ICON_CHEMBOMB:
|
|
|
|
tspr->xrepeat = 64;
|
|
|
|
tspr->yrepeat = 47;
|
|
|
|
break;
|
|
|
|
case ICON_FLASHBOMB:
|
|
|
|
tspr->xrepeat = 32;
|
|
|
|
tspr->yrepeat = 34;
|
|
|
|
break;
|
|
|
|
case ICON_NUKE:
|
|
|
|
break;
|
|
|
|
case ICON_CALTROPS:
|
|
|
|
tspr->xrepeat = 37;
|
|
|
|
tspr->yrepeat = 30;
|
|
|
|
break;
|
|
|
|
case ICON_BOOSTER: // 1810
|
|
|
|
tspr->xrepeat = 30;
|
|
|
|
tspr->yrepeat = 38;
|
|
|
|
break;
|
|
|
|
case ICON_HEAT_CARD: // 1819
|
|
|
|
tspr->xrepeat = 46;
|
|
|
|
tspr->yrepeat = 47;
|
|
|
|
break;
|
|
|
|
case ICON_REPAIR_KIT: // 1813
|
|
|
|
break;
|
|
|
|
case ICON_EXPLOSIVE_BOX: // 1801
|
|
|
|
break;
|
|
|
|
case ICON_ENVIRON_SUIT: // 1837
|
|
|
|
break;
|
|
|
|
case ICON_FLY: // 1782
|
|
|
|
break;
|
|
|
|
case ICON_CLOAK: // 1826
|
|
|
|
break;
|
|
|
|
case ICON_NIGHT_VISION: // 3031
|
|
|
|
tspr->xrepeat = 59;
|
|
|
|
tspr->yrepeat = 71;
|
|
|
|
break;
|
|
|
|
case ICON_NAPALM: // 3046
|
|
|
|
break;
|
|
|
|
case ICON_RING: // 3050
|
|
|
|
break;
|
|
|
|
case ICON_RINGAMMO: // 3054
|
|
|
|
break;
|
|
|
|
case ICON_NAPALMAMMO: // 3058
|
|
|
|
break;
|
|
|
|
case ICON_GRENADE: // 3059
|
|
|
|
break;
|
|
|
|
case ICON_ARMOR: // 3030
|
|
|
|
tspr->xrepeat = 82;
|
|
|
|
tspr->yrepeat = 84;
|
|
|
|
break;
|
|
|
|
case BLUE_KEY: // 1766
|
|
|
|
break;
|
|
|
|
case RED_KEY: // 1770
|
|
|
|
break;
|
|
|
|
case GREEN_KEY: // 1774
|
|
|
|
break;
|
|
|
|
case YELLOW_KEY: // 1778
|
|
|
|
break;
|
|
|
|
case BLUE_CARD:
|
|
|
|
case RED_CARD:
|
|
|
|
case GREEN_CARD:
|
|
|
|
case YELLOW_CARD:
|
|
|
|
tspr->xrepeat = 36;
|
|
|
|
tspr->yrepeat = 33;
|
|
|
|
break;
|
|
|
|
case GOLD_SKELKEY:
|
|
|
|
case SILVER_SKELKEY:
|
|
|
|
case BRONZE_SKELKEY:
|
|
|
|
case RED_SKELKEY:
|
|
|
|
tspr->xrepeat = 39;
|
|
|
|
tspr->yrepeat = 45;
|
|
|
|
break;
|
|
|
|
case SKEL_LOCKED:
|
|
|
|
case SKEL_UNLOCKED:
|
|
|
|
tspr->xrepeat = 47;
|
|
|
|
tspr->yrepeat = 40;
|
|
|
|
break;
|
|
|
|
case RAMCARD_LOCKED:
|
|
|
|
case RAMCARD_UNLOCKED:
|
|
|
|
case CARD_LOCKED:
|
|
|
|
case CARD_UNLOCKED:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Rotation angles for sprites
|
|
|
|
short rotang = 0;
|
|
|
|
|
2019-12-26 06:27:48 +00:00
|
|
|
void
|
|
|
|
JAnalyzeSprites(tspriteptr_t tspr)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
rotang += 4;
|
|
|
|
if (rotang > 2047)
|
|
|
|
rotang = 0;
|
|
|
|
|
|
|
|
|
|
|
|
// Take care of autosizing
|
|
|
|
DoAutoSize(tspr);
|
|
|
|
|
2020-12-01 22:57:39 +00:00
|
|
|
if (md_tilehasmodel(tspr->picnum, 0) >= 0 && hw_models) return;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
// Check for voxels
|
|
|
|
//if (bVoxelsOn)
|
2019-10-27 15:53:00 +00:00
|
|
|
if (r_voxels)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-02-02 19:48:40 +00:00
|
|
|
if (aVoxelArray[tspr->picnum].Voxel >= 0 && !(spriteext[tspr->owner].flags & SPREXT_NOTMD))
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
// Turn on voxels
|
|
|
|
tspr->picnum = aVoxelArray[tspr->picnum].Voxel; // Get the voxel number
|
|
|
|
tspr->cstat |= 48; // Set stat to voxelize sprite
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (tspr->picnum)
|
|
|
|
{
|
|
|
|
case 764: // Gun barrel
|
|
|
|
|
2020-02-02 19:48:40 +00:00
|
|
|
if (!r_voxels || (spriteext[tspr->owner].flags & SPREXT_NOTMD))
|
|
|
|
{
|
|
|
|
tspr->cstat |= 16;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-05-19 21:54:34 +00:00
|
|
|
if (aVoxelArray[tspr->picnum].Voxel >= 0)
|
|
|
|
{
|
|
|
|
// Turn on voxels
|
|
|
|
tspr->picnum = aVoxelArray[tspr->picnum].Voxel; // Get the voxel number
|
|
|
|
tspr->cstat |= 48; // Set stat to voxelize sprite
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
void
|
2015-05-19 22:01:22 +00:00
|
|
|
UnlockKeyLock(short key_num, short hit_sprite)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
SPRITEp sp;
|
2020-10-15 16:07:35 +00:00
|
|
|
int SpriteNum = 0, color = 0;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
// Get palette by looking at key number
|
|
|
|
switch (key_num - 1)
|
|
|
|
{
|
|
|
|
case 0: // RED_KEY
|
|
|
|
color = PALETTE_PLAYER9;
|
|
|
|
break;
|
|
|
|
case 1: // BLUE_KEY
|
|
|
|
color = PALETTE_PLAYER7;
|
|
|
|
break;
|
|
|
|
case 2: // GREEN_KEY
|
|
|
|
color = PALETTE_PLAYER6;
|
|
|
|
break;
|
|
|
|
case 3: // YELLOW_KEY
|
|
|
|
color = PALETTE_PLAYER4;
|
|
|
|
break;
|
|
|
|
case 4: // SILVER_SKELKEY
|
|
|
|
color = PALETTE_PLAYER4;
|
|
|
|
break;
|
|
|
|
case 5: // GOLD_SKELKEY
|
|
|
|
color = PALETTE_PLAYER1;
|
|
|
|
break;
|
|
|
|
case 6: // BRONZE_SKELKEY
|
|
|
|
color = PALETTE_PLAYER8;
|
|
|
|
break;
|
|
|
|
case 7: // RED_SKELKEY
|
|
|
|
color = PALETTE_PLAYER9;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-10-15 16:07:35 +00:00
|
|
|
StatIterator it(STAT_DEFAULT);
|
|
|
|
while ((SpriteNum = it.NextIndex()) >= 0)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
|
|
|
sp = &sprite[SpriteNum];
|
|
|
|
|
|
|
|
switch (sp->picnum)
|
|
|
|
{
|
|
|
|
case SKEL_LOCKED:
|
|
|
|
if (sp->pal == color)
|
|
|
|
{
|
2019-12-18 10:09:01 +00:00
|
|
|
PlaySound(DIGI_UNLOCK, sp, v3df_doppler | v3df_dontpan);
|
2015-05-19 22:01:22 +00:00
|
|
|
if (SpriteNum == hit_sprite)
|
2015-05-19 21:54:34 +00:00
|
|
|
sp->picnum = SKEL_UNLOCKED;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RAMCARD_LOCKED:
|
|
|
|
if (sp->pal == color)
|
|
|
|
{
|
2019-12-18 10:09:01 +00:00
|
|
|
PlaySound(DIGI_CARDUNLOCK, sp, v3df_doppler | v3df_dontpan);
|
2015-05-19 21:54:34 +00:00
|
|
|
sp->picnum = RAMCARD_UNLOCKED;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CARD_LOCKED:
|
|
|
|
if (sp->pal == color)
|
|
|
|
{
|
2019-12-18 10:09:01 +00:00
|
|
|
PlaySound(DIGI_RAMUNLOCK, sp, v3df_doppler | v3df_dontpan);
|
2015-05-19 22:01:22 +00:00
|
|
|
if (SpriteNum == hit_sprite)
|
2015-05-19 21:54:34 +00:00
|
|
|
sp->picnum = CARD_UNLOCKED;
|
|
|
|
else
|
|
|
|
sp->picnum = CARD_UNLOCKED+1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2019-10-09 16:09:05 +00:00
|
|
|
END_SW_NS
|