dxx-rebirth/similar/main/mglobal.cpp

117 lines
3.6 KiB
C++
Raw Normal View History

2006-03-20 17:12:09 +00:00
/*
2014-06-01 17:55:23 +00:00
* Portions of this file are copyright Rebirth contributors and licensed as
* described in COPYING.txt.
* Portions of this file are copyright Parallax Software and licensed
* according to the Parallax license below.
* See COPYING.txt for license details.
2006-03-20 17:12:09 +00:00
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/
/*
*
* Global variables for main directory
*
*/
2012-07-01 02:54:33 +00:00
#include "maths.h"
2006-03-20 17:12:09 +00:00
#include "vecmat.h"
#include "inferno.h"
#include "segment.h"
2016-02-06 22:12:53 +00:00
#include "switch.h"
2006-03-20 17:12:09 +00:00
#include "object.h"
#include "bm.h"
#include "3d.h"
#include "game.h"
2014-02-09 18:09:54 +00:00
#include "textures.h"
#include "valptridx.tcc"
2016-02-06 22:12:54 +00:00
#include "wall.h"
2006-03-20 17:12:09 +00:00
2015-12-13 18:00:49 +00:00
namespace dcx {
2015-12-05 22:57:25 +00:00
unsigned Num_segments;
2006-03-20 17:12:09 +00:00
// Global array of vertices, common to one mine.
2014-10-02 03:02:34 +00:00
array<vertex, MAX_VERTICES> Vertices;
2015-12-05 22:57:25 +00:00
}
2014-08-08 03:02:43 +00:00
array<g3s_point, MAX_VERTICES> Segment_points;
2006-03-20 17:12:09 +00:00
namespace dcx {
2006-03-20 17:12:09 +00:00
fix FrameTime = 0x1000; // Time since last frame, in seconds
fix64 GameTime64 = 0; // Time in game, in seconds
2006-03-20 17:12:09 +00:00
int d_tick_count = 0; // increments every 33.33ms
int d_tick_step = 0; // true once every 33.33ms
2006-03-20 17:12:09 +00:00
// This is the global mine which create_new_mine returns.
//lsegment Lsegments[MAX_SEGMENTS];
// Number of vertices in current mine (ie, Vertices, pointed to by Vp)
// Translate table to get opposite side of a face on a segment.
2014-09-20 23:47:27 +00:00
unsigned Highest_vertex_index;
2006-03-20 17:12:09 +00:00
2015-12-05 22:57:25 +00:00
unsigned Num_vertices;
2015-10-18 21:01:20 +00:00
const array<uint8_t, MAX_SIDES_PER_SEGMENT> Side_opposite{{
2015-02-05 03:03:50 +00:00
WRIGHT, WBOTTOM, WLEFT, WTOP, WFRONT, WBACK
}};
2006-03-20 17:12:09 +00:00
#define TOLOWER(c) ((((c)>='A') && ((c)<='Z'))?((c)+('a'-'A')):(c))
2015-10-18 21:01:20 +00:00
const array<array<uint8_t, 4>, MAX_SIDES_PER_SEGMENT> Side_to_verts{{
2015-03-22 18:49:21 +00:00
{{7,6,2,3}}, // left
{{0,4,7,3}}, // top
{{0,1,5,4}}, // right
{{2,6,5,1}}, // bottom
{{4,5,6,7}}, // back
{{3,2,1,0}}, // front
2015-02-05 03:03:50 +00:00
}};
2006-03-20 17:12:09 +00:00
// Note, this MUST be the same as Side_to_verts, it is an int for speed reasons.
2015-10-18 21:01:20 +00:00
const array<array<unsigned, 4>, MAX_SIDES_PER_SEGMENT> Side_to_verts_int{{
2015-03-22 18:49:21 +00:00
{{7,6,2,3}}, // left
{{0,4,7,3}}, // top
{{0,1,5,4}}, // right
{{2,6,5,1}}, // bottom
{{4,5,6,7}}, // back
{{3,2,1,0}}, // front
2015-02-05 03:03:50 +00:00
}};
2006-03-20 17:12:09 +00:00
// Texture map stuff
fix64 Next_laser_fire_time; // Time at which player can next fire his selected laser.
fix64 Next_missile_fire_time; // Time at which player can next fire his selected missile.
2006-03-20 17:12:09 +00:00
//--unused-- fix Laser_delay_time = F1_0/6; // Delay between laser fires.
#define DEFAULT_DIFFICULTY 1
int Difficulty_level=DEFAULT_DIFFICULTY; // Difficulty level in 0..NDL-1, 0 = easiest, NDL-1 = hardest
}
2006-03-20 17:12:09 +00:00
#if DXX_HAVE_POISON_UNDEFINED
template <typename managed_type>
valptridx<managed_type>::array_managed_type::array_managed_type()
{
DXX_MAKE_MEM_UNDEFINED(this->begin(), this->end());
}
#endif
2015-12-13 18:00:49 +00:00
namespace dsx {
valptridx<object>::array_managed_type Objects;
valptridx<segment>::array_managed_type Segments;
2016-02-06 22:12:53 +00:00
valptridx<trigger>::array_managed_type Triggers;
2016-02-06 22:12:54 +00:00
valptridx<wall>::array_managed_type Walls;
2015-12-05 22:57:25 +00:00
}
template class valptridx<object>;
template class valptridx<segment>;
2016-02-06 22:12:53 +00:00
template class valptridx<trigger>;
2016-02-06 22:12:54 +00:00
template class valptridx<wall>;