mirror of
https://github.com/bearstonem/openmohaa-vr.git
synced 2026-10-17 22:00:21 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96bf729c54 | ||
|
|
edcf521506 | ||
|
|
9e7991f4b1 | ||
|
|
86e7a24b38 | ||
|
|
ff587a8444 | ||
|
|
c3e98ed681 | ||
|
|
cc2d698fe2 | ||
|
|
420161095f | ||
|
|
58b0d335e7 | ||
|
|
ce336e8962 | ||
|
|
5b72eb189a | ||
|
|
7600d3ca02 | ||
|
|
8c3be9d549 | ||
|
|
2ddb534321 | ||
|
|
21a1f61b04 | ||
|
|
7219848655 | ||
|
|
4695449fc7 | ||
|
|
af3dd2602b | ||
|
|
5bba5abece | ||
|
|
bdcb6c42b6 | ||
|
|
0fe01d23d6 | ||
|
|
fc675e4064 | ||
|
|
a29af7c3f6 | ||
|
|
732872f433 | ||
|
|
04b5fdb934 | ||
|
|
e23ce01d19 | ||
|
|
648dc395e7 | ||
|
|
ab2a26a14e | ||
|
|
238e94b4d5 | ||
|
|
0c18e0e26c | ||
|
|
7085d60d02 | ||
|
|
3933e63044 | ||
|
|
342552c349 | ||
|
|
9addff08ce | ||
|
|
2ff1071115 | ||
|
|
49f4ac66ab | ||
|
|
7761cbd74c | ||
|
|
103debcf6b | ||
|
|
526ab8071c | ||
|
|
ac45f20fa6 | ||
|
|
a45b36f2f3 | ||
|
|
bea35d28fc | ||
|
|
bb71f84985 | ||
|
|
2f62e61dc8 | ||
|
|
dceceb976d | ||
|
|
59bf9fbd54 | ||
|
|
a1cd6f2746 | ||
|
|
76178064a0 | ||
|
|
31ac3f7096 | ||
|
|
545dc19811 | ||
|
|
5f598cf1f9 | ||
|
|
4e66f2482f | ||
|
|
f873fd447f | ||
|
|
a4123f65b3 | ||
|
|
93e56d968e | ||
|
|
b4e22d3040 | ||
|
|
351f601986 | ||
|
|
41fdd28d8b | ||
|
|
d7c6cc0157 | ||
|
|
f1b83f1dab | ||
|
|
bb401d8d3c | ||
|
|
8bb9cd46f8 | ||
|
|
c27695247e | ||
|
|
7b9835a118 | ||
|
|
2dc75b7527 | ||
|
|
6c577a7251 | ||
|
|
5031402c2c | ||
|
|
a4bd37af8c | ||
|
|
4dc60b9aa4 | ||
|
|
ce89399824 | ||
|
|
b92d2972f6 | ||
|
|
f53680983b | ||
|
|
d6fd337a07 | ||
|
|
95230a8d0a | ||
|
|
04524e9de9 | ||
|
|
df4f6f9515 |
No files matched your search
@@ -2,22 +2,23 @@
|
||||
|
||||
| Path | Description |
|
||||
| ---------------------|-------------------------------------------------------------------
|
||||
| build/ | Output files |
|
||||
| code/ | OpenMoHAA source code |
|
||||
| code/cgame | Client game code |
|
||||
| code/client | Client (network stuff, snapshots, etc) |
|
||||
| code/game | Server game code (game logic stuff, etc) |
|
||||
| code/gamespy | Gamespy SDK |
|
||||
| code/mohui | MoHAA User Interface |
|
||||
| code/null | Null redirector (used by the OpenMoHAA Dedicated Server) |
|
||||
| code/parser | Flex/Bison parser |
|
||||
| code/qcommon | Global shared stuff such as maths |
|
||||
| code/renderer | OpenMoHAA renderer |
|
||||
| code/sdl(12) | SDL code |
|
||||
| code/script | Script engine |
|
||||
| code/server | Server code (networkn snapshots, handling clients etc) |
|
||||
| code/server | Server code (network, snapshots, handling clients etc) |
|
||||
| code/skeletor | Skeleton model engine |
|
||||
| code/sys | Main application system |
|
||||
| code/tiki | Complete TIKI engine |
|
||||
| code/uilib | UI library (Ubertools stuff) |
|
||||
| code/{win32,unix} | Platform-specific code |
|
||||
| docker | Docker files, for compiling on various linux versions |
|
||||
| docs | Documentation stuff |
|
||||
| misc/ | Project stuff, definition files and various resources stuff. |
|
||||
@@ -41,6 +41,8 @@ Here is the current working state for each part of the engine:
|
||||
| Server module (fgame) | | x | | | | | Actor, vehicle, and few gameplay bugs |
|
||||
| UI | | | | x | | | Has core features only (menu, widgets, console, hud, urc loading) |
|
||||
|
||||
NOTE: Both client and server version can be compiled to target **Medal of Honor: Spearhead** and **Medal of Honor: Breakthrough**.
|
||||
|
||||
## Running
|
||||
|
||||
Backup existing mohaa files, **cgamex86.dll** and **gamex86.dll** (set their extension to **.bak**)
|
||||
@@ -70,7 +72,9 @@ These are the tools required for all platforms :
|
||||
|
||||
The installation directory can be set to MOHAA directory.
|
||||
|
||||
The client build and successfully be built by adding `-DWITH_CLIENT=1` to the CMake command line.
|
||||
The client build can be built by adding `-DWITH_CLIENT=1` to the CMake command line. This will compile the cgame module and the full app with rendering, ui and sound suppport, alongside the dedicated server version.
|
||||
|
||||
To compile for either Spearhead or Breakthrough, append `-DTARGET_GAME_TYPE=x` where x can be 1 for Team Assault (Spearhead), and 2 for Team Tactics (Breakthrough). 2 is recommended because Team Tactics can connect to both Spearhead and Breakthrough servers.
|
||||
|
||||
### Linux
|
||||
|
||||
@@ -87,6 +91,7 @@ Visual Studio (2019 or 2022) is generally preferred.
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
|
||||
+171
-37
@@ -1795,6 +1795,10 @@ void ClientGameCommandManager::SetAlignStretch(Event* ev)
|
||||
void ClientGameCommandManager::SetDecalRadius(Event* ev)
|
||||
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spawnthing->cgd.decal_radius = ev->GetFloat(1);
|
||||
}
|
||||
|
||||
@@ -1806,6 +1810,10 @@ void ClientGameCommandManager::SetDecalOrientation(Event* ev)
|
||||
{
|
||||
str deg;
|
||||
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
deg = ev->GetString(1);
|
||||
|
||||
if (!deg.icmp("random")) {
|
||||
@@ -1820,6 +1828,10 @@ void ClientGameCommandManager::SetDecalOrientation(Event* ev)
|
||||
//===============
|
||||
void ClientGameCommandManager::SetBounceDecal(Event* ev)
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spawnthing->cgd.flags2 |= T2_BOUNCE_DECAL;
|
||||
if (ev->NumArgs() > 1) {
|
||||
m_spawnthing->cgd.maxbouncecount = ev->GetInteger(1);
|
||||
@@ -1837,8 +1849,11 @@ void ClientGameCommandManager::SetBounceDecal(Event* ev)
|
||||
// SetParallel
|
||||
//===============
|
||||
void ClientGameCommandManager::SetParallel(Event* ev)
|
||||
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spawnthing->cgd.flags2 |= T2_PARALLEL;
|
||||
}
|
||||
|
||||
@@ -1846,10 +1861,13 @@ void ClientGameCommandManager::SetParallel(Event* ev)
|
||||
// PhysicsRate
|
||||
//===============
|
||||
void ClientGameCommandManager::SetPhysicsRate(Event* ev)
|
||||
|
||||
{
|
||||
str rate;
|
||||
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
rate = ev->GetString(1);
|
||||
|
||||
if (!rate.icmp(rate, "every")) {
|
||||
@@ -1863,8 +1881,11 @@ void ClientGameCommandManager::SetPhysicsRate(Event* ev)
|
||||
// SetLightstyle
|
||||
//===============
|
||||
void ClientGameCommandManager::SetLightstyle(Event* ev)
|
||||
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spawnthing->cgd.lightstyle = CG_RegisterLightStyle(ev->GetString(1));
|
||||
}
|
||||
|
||||
@@ -1872,8 +1893,11 @@ void ClientGameCommandManager::SetLightstyle(Event* ev)
|
||||
// SetBeamSphere
|
||||
//===============
|
||||
void ClientGameCommandManager::SetBeamSphere(Event* ev)
|
||||
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spawnthing->numspherebeams = ev->GetInteger(1);
|
||||
m_spawnthing->beamflags = BEAM_SPHERE_EFFECT;
|
||||
}
|
||||
@@ -1882,8 +1906,11 @@ void ClientGameCommandManager::SetBeamSphere(Event* ev)
|
||||
// SetBeamSpread
|
||||
//===============
|
||||
void ClientGameCommandManager::SetSpread(Event* ev)
|
||||
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spawnthing->spreadx = ev->GetFloat(1);
|
||||
m_spawnthing->spready = ev->GetFloat(2);
|
||||
}
|
||||
@@ -1892,8 +1919,11 @@ void ClientGameCommandManager::SetSpread(Event* ev)
|
||||
// SetUseLastTraceEnd
|
||||
//===============
|
||||
void ClientGameCommandManager::SetUseLastTraceEnd(Event* ev)
|
||||
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spawnthing->use_last_trace_end = qtrue;
|
||||
}
|
||||
|
||||
@@ -1901,8 +1931,11 @@ void ClientGameCommandManager::SetUseLastTraceEnd(Event* ev)
|
||||
// SetSubdivisions
|
||||
//===============
|
||||
void ClientGameCommandManager::SetSubdivisions(Event* ev)
|
||||
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spawnthing->numSubdivisions = ev->GetInteger(1);
|
||||
}
|
||||
|
||||
@@ -1910,8 +1943,11 @@ void ClientGameCommandManager::SetSubdivisions(Event* ev)
|
||||
// SetBeamPersist
|
||||
//===============
|
||||
void ClientGameCommandManager::SetBeamPersist(Event* ev)
|
||||
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spawnthing->beamflags |= BEAM_PERSIST_EFFECT;
|
||||
}
|
||||
|
||||
@@ -1919,8 +1955,11 @@ void ClientGameCommandManager::SetBeamPersist(Event* ev)
|
||||
// SetBeamOffsetEndponts
|
||||
//===============
|
||||
void ClientGameCommandManager::SetBeamOffsetEndpoints(Event* ev)
|
||||
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spawnthing->beamflags |= BEAM_OFFSET_ENDPOINTS;
|
||||
}
|
||||
|
||||
@@ -1928,8 +1967,11 @@ void ClientGameCommandManager::SetBeamOffsetEndpoints(Event* ev)
|
||||
// SetBeamDelay
|
||||
//===============
|
||||
void ClientGameCommandManager::SetBeamDelay(Event* ev)
|
||||
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev->NumArgs() > 1) {
|
||||
str r = ev->GetString(1);
|
||||
if (r.icmp("random")) {
|
||||
@@ -1945,8 +1987,11 @@ void ClientGameCommandManager::SetBeamDelay(Event* ev)
|
||||
// SetBeamToggleDelay
|
||||
//===============
|
||||
void ClientGameCommandManager::SetBeamToggleDelay(Event* ev)
|
||||
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spawnthing->beamflags |= BEAM_TOGGLE;
|
||||
if (ev->NumArgs() > 1) {
|
||||
str r = ev->GetString(1);
|
||||
@@ -1964,8 +2009,11 @@ void ClientGameCommandManager::SetBeamToggleDelay(Event* ev)
|
||||
// SetBeamLength
|
||||
//===============
|
||||
void ClientGameCommandManager::SetLength(Event* ev)
|
||||
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spawnthing->length = ev->GetFloat(1);
|
||||
}
|
||||
|
||||
@@ -1973,8 +2021,11 @@ void ClientGameCommandManager::SetLength(Event* ev)
|
||||
// SetShader
|
||||
//===============
|
||||
void ClientGameCommandManager::SetShader(Event* ev)
|
||||
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spawnthing->cgd.shadername = ev->GetString(1);
|
||||
}
|
||||
|
||||
@@ -1982,8 +2033,11 @@ void ClientGameCommandManager::SetShader(Event* ev)
|
||||
// SetMinOffset
|
||||
//===============
|
||||
void ClientGameCommandManager::SetMinOffset(Event* ev)
|
||||
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spawnthing->min_offset = ev->GetInteger(1);
|
||||
}
|
||||
|
||||
@@ -1991,8 +2045,11 @@ void ClientGameCommandManager::SetMinOffset(Event* ev)
|
||||
// SetSubdivisions
|
||||
//===============
|
||||
void ClientGameCommandManager::SetMaxOffset(Event* ev)
|
||||
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spawnthing->max_offset = ev->GetInteger(1);
|
||||
}
|
||||
|
||||
@@ -2000,8 +2057,11 @@ void ClientGameCommandManager::SetMaxOffset(Event* ev)
|
||||
// SetAnim
|
||||
//===============
|
||||
void ClientGameCommandManager::SetAnim(Event* ev)
|
||||
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spawnthing->animName = ev->GetString(1);
|
||||
}
|
||||
|
||||
@@ -2009,8 +2069,11 @@ void ClientGameCommandManager::SetAnim(Event* ev)
|
||||
// AnimateOnce
|
||||
//===============
|
||||
void ClientGameCommandManager::AnimateOnce(Event* ev)
|
||||
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spawnthing->cgd.flags |= T_ANIMATEONCE;
|
||||
}
|
||||
|
||||
@@ -2018,8 +2081,11 @@ void ClientGameCommandManager::AnimateOnce(Event* ev)
|
||||
// EmitterStartOff
|
||||
//===============
|
||||
void ClientGameCommandManager::EmitterStartOff(Event* ev)
|
||||
|
||||
{
|
||||
if (!m_spawnthing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spawnthing->startoff = qtrue;
|
||||
}
|
||||
|
||||
@@ -4735,7 +4801,7 @@ void ClientGameCommandManager::SpawnTempModel(int mcount, int timeAlive)
|
||||
|
||||
// Make sure to not spawn the world model as a tempmodel
|
||||
// Of course it would become extremely confusing...
|
||||
if (!(p->cgd.flags & T_DLIGHT) && p->ent.reType == ET_MODELANIM_SKEL && !p->ent.hModel)
|
||||
if (!(p->cgd.flags & T_DLIGHT) && p->ent.reType == RT_MODEL && !p->ent.hModel)
|
||||
{
|
||||
Com_Printf("^~^~^ not spawning tempmodel because it is using the world as a brush model\n");
|
||||
FreeTempModel(p);
|
||||
@@ -5073,7 +5139,7 @@ void ClientGameCommandManager::LoopSound(Event* ev)
|
||||
|
||||
// Get the real sound to play
|
||||
|
||||
if (current_tiki) {
|
||||
if (current_tiki && current_tiki->a->alias_list) {
|
||||
name = cgi.Alias_ListFindRandom((AliasList_t*)current_tiki->a->alias_list,
|
||||
sound_name.c_str(), &soundAlias);
|
||||
}
|
||||
@@ -5102,7 +5168,7 @@ void CacheResource(const char* stuff)
|
||||
{
|
||||
str real_stuff;
|
||||
|
||||
if (!stuff) {
|
||||
if (!stuff || !stuff[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5160,10 +5226,37 @@ void AliasResource(dtiki_t* pmdl, const char* alias, const char* realname,
|
||||
}
|
||||
}
|
||||
|
||||
int bLoadForMap__FPCcT0(char* psMapsBuffer, char* name)
|
||||
qboolean bLoadForMap(const char* psMapsBuffer, const char* name)
|
||||
{
|
||||
// FIXME: stub
|
||||
return 0;
|
||||
const char* token;
|
||||
const char* mapname;
|
||||
const char* override;
|
||||
|
||||
mapname = cgs.mapname;
|
||||
if (!strncmp("test", mapname, strlen("test"))) {
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
token = COM_GetToken((char**)&psMapsBuffer, qtrue);
|
||||
override = token;
|
||||
if (token && *token)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
if (!Q_stricmpn(token, mapname, strlen(token)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
token = COM_GetToken((char**)&psMapsBuffer, qtrue);
|
||||
if (!token || !token[0]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Com_Printf("ERROR bLoadForMap: %s alias with empty maps specification.\n", name);
|
||||
return false;
|
||||
}
|
||||
|
||||
//===============
|
||||
@@ -5173,8 +5266,9 @@ void ClientGameCommandManager::AliasCache(Event* ev)
|
||||
|
||||
{
|
||||
int i;
|
||||
char parmbuffer[512]; // this holds the parameters to be passed into the
|
||||
char parmbuffer[2048]; // this holds the parameters to be passed into the
|
||||
// alias command
|
||||
const char* psMapsBuffer;
|
||||
|
||||
if (ev->NumArgs() < 2) {
|
||||
return;
|
||||
@@ -5185,14 +5279,23 @@ void ClientGameCommandManager::AliasCache(Event* ev)
|
||||
// any additional parameters are in arguments 3-n
|
||||
|
||||
parmbuffer[0] = 0;
|
||||
psMapsBuffer = NULL;
|
||||
|
||||
for (i = 3; i <= ev->NumArgs(); i++) {
|
||||
strcat(parmbuffer, ev->GetToken(i));
|
||||
strcat(parmbuffer, " ");
|
||||
if (strcmp(ev->GetToken(i).c_str(), "maps")) {
|
||||
strcat(parmbuffer, ev->GetToken(i));
|
||||
strcat(parmbuffer, " ");
|
||||
}
|
||||
else {
|
||||
psMapsBuffer = ev->GetToken(i++);
|
||||
}
|
||||
}
|
||||
|
||||
AliasResource(current_tiki, ev->GetString(1), ev->GetString(2), parmbuffer);
|
||||
CacheResource(ev->GetString(2));
|
||||
if (bLoadForMap(psMapsBuffer, ev->GetString(1)))
|
||||
{
|
||||
AliasResource(current_tiki, ev->GetString(1), ev->GetString(2), parmbuffer);
|
||||
CacheResource(ev->GetString(2));
|
||||
}
|
||||
}
|
||||
|
||||
//===============
|
||||
@@ -5202,8 +5305,10 @@ void ClientGameCommandManager::Alias(Event* ev)
|
||||
|
||||
{
|
||||
int i;
|
||||
char parmbuffer[512]; // this holds the parameters to be passed into the
|
||||
char parmbuffer[2048]; // this holds the parameters to be passed into the
|
||||
// alias command
|
||||
qboolean subtitle;
|
||||
const char* psMapsBuffer;
|
||||
|
||||
if (ev->NumArgs() < 2) {
|
||||
return;
|
||||
@@ -5213,14 +5318,43 @@ void ClientGameCommandManager::Alias(Event* ev)
|
||||
// real path is argument 2
|
||||
// any additional parameters are in arguments 3-n
|
||||
|
||||
parmbuffer[0] = 0;
|
||||
parmbuffer[0] = 0;
|
||||
subtitle = qfalse;
|
||||
psMapsBuffer = NULL;
|
||||
|
||||
for (i = 3; i <= ev->NumArgs(); i++) {
|
||||
strcat(parmbuffer, ev->GetToken(i));
|
||||
strcat(parmbuffer, " ");
|
||||
}
|
||||
for (i = 3; i <= ev->NumArgs(); i++)
|
||||
{
|
||||
if (strcmp(ev->GetToken(i).c_str(), "maps"))
|
||||
{
|
||||
if (!subtitle)
|
||||
{
|
||||
if (!Q_stricmp(ev->GetToken(i), "subtitle")) {
|
||||
subtitle = qtrue;
|
||||
strcat(parmbuffer, ev->GetToken(i));
|
||||
}
|
||||
else {
|
||||
strcat(parmbuffer, ev->GetToken(i));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat(parmbuffer, "\"");
|
||||
strcat(parmbuffer, ev->GetToken(i));
|
||||
strcat(parmbuffer, "\"");
|
||||
subtitle = qfalse;
|
||||
}
|
||||
|
||||
AliasResource(current_tiki, ev->GetString(1), ev->GetString(2), parmbuffer);
|
||||
strcat(parmbuffer, " ");
|
||||
}
|
||||
else {
|
||||
psMapsBuffer = ev->GetToken(i++);
|
||||
}
|
||||
}
|
||||
|
||||
if (bLoadForMap(psMapsBuffer, ev->GetString(1)))
|
||||
{
|
||||
AliasResource(current_tiki, ev->GetString(1), ev->GetString(2), parmbuffer);
|
||||
}
|
||||
}
|
||||
|
||||
void CacheAliasList(AliasList_t* alias_list, str& name)
|
||||
@@ -6414,7 +6548,7 @@ qboolean CG_Command_ProcessFile(const char* filename, qboolean quiet, dtiki_t *c
|
||||
|
||||
ev->AddToken(com_token);
|
||||
}
|
||||
commandManager.ProcessEvent(ev);
|
||||
commandManager.SelectProcessEvent(ev);
|
||||
}
|
||||
cgi.FS_FreeFile((void*)bufstart);
|
||||
|
||||
|
||||
@@ -273,7 +273,7 @@ enum class vsstypes_t : unsigned char {
|
||||
NUM_VSS_TYPES
|
||||
};
|
||||
|
||||
class cvssource_t : public Class
|
||||
class cvssource_t
|
||||
{
|
||||
public:
|
||||
cvssource_t* next;
|
||||
@@ -309,7 +309,7 @@ public:
|
||||
qboolean lastValid;
|
||||
};
|
||||
|
||||
class cvssourcestate_t : public Class
|
||||
class cvssourcestate_t
|
||||
{
|
||||
public:
|
||||
Vector origin;
|
||||
|
||||
@@ -558,8 +558,7 @@ int CG_WeaponCommandButtonBits(void)
|
||||
{
|
||||
int iShiftedWeaponCommand;
|
||||
|
||||
iShiftedWeaponCommand = cg.iWeaponCommand;
|
||||
if (!iShiftedWeaponCommand) {
|
||||
if (!cg.iWeaponCommand) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -568,5 +567,6 @@ int CG_WeaponCommandButtonBits(void)
|
||||
cg.iWeaponCommand = 0;
|
||||
}
|
||||
|
||||
return (iShiftedWeaponCommand << 7) & WEAPON_COMMAND_MASK;
|
||||
iShiftedWeaponCommand = cg.iWeaponCommand << 7;
|
||||
return iShiftedWeaponCommand & WEAPON_COMMAND_MASK;
|
||||
}
|
||||
@@ -1023,6 +1023,118 @@ void CG_DrawInstantMessageMenu()
|
||||
cgi.R_DrawStretchPic(x, y, w, h, 0.0, 0.0, 1.0, 1.0, handle);
|
||||
}
|
||||
|
||||
#if TARGET_GAME_PROTOCOL >= 15
|
||||
|
||||
void CG_DrawSpectatorView()
|
||||
{
|
||||
const char* pszString;
|
||||
int iKey1, iKey2;
|
||||
int iKey1b, iKey2b;
|
||||
float fX, fY;
|
||||
qboolean bOnTeam;
|
||||
|
||||
if (!(cg.predicted_player_state.pm_flags & PMF_SPECTATING)) {
|
||||
return;
|
||||
}
|
||||
|
||||
bOnTeam = qfalse;
|
||||
if (cg.snap->ps.stats[STAT_TEAM] == TEAM_ALLIES || cg.snap->ps.stats[STAT_TEAM] == TEAM_AXIS) {
|
||||
bOnTeam = 1;
|
||||
}
|
||||
|
||||
if (!bOnTeam)
|
||||
{
|
||||
cgi.Key_GetKeysForCommand("+attackprimary", &iKey1, &iKey2);
|
||||
pszString = cgi.LV_ConvertString(va("Press Fire(%s) to join the battle!", cgi.Key_KeynumToBindString(iKey1)));
|
||||
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
|
||||
fY = cgs.glconfig.vidHeight - 64.0;
|
||||
cgi.R_SetColor(NULL);
|
||||
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX, fY, -1, qfalse);
|
||||
}
|
||||
|
||||
if (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)
|
||||
{
|
||||
cgi.Key_GetKeysForCommand("+moveup", &iKey1, &iKey2);
|
||||
cgi.Key_GetKeysForCommand("+movedown", &iKey1b, &iKey2b);
|
||||
|
||||
pszString = cgi.LV_ConvertString(
|
||||
va(
|
||||
"Press Jump(%s) or Duck(%s) to follow a different player.",
|
||||
cgi.Key_KeynumToBindString(iKey1),
|
||||
cgi.Key_KeynumToBindString(iKey1b)
|
||||
)
|
||||
);
|
||||
|
||||
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
|
||||
fY = (float)cgs.glconfig.vidHeight - 40.0;
|
||||
cgi.R_SetColor(0);
|
||||
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX, fY, -1, 0);
|
||||
}
|
||||
|
||||
if (!bOnTeam && (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW))
|
||||
{
|
||||
cgi.Key_GetKeysForCommand("+use", &iKey1, &iKey2);
|
||||
pszString = cgi.LV_ConvertString(va("Press Use(%s) to enter free spectate mode.", cgi.Key_KeynumToBindString(iKey1)));
|
||||
|
||||
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
|
||||
fY = (float)cgs.glconfig.vidHeight - 24.0;
|
||||
cgi.R_SetColor(0);
|
||||
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX, fY, -1, 0);
|
||||
}
|
||||
|
||||
if (!(cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) {
|
||||
cgi.Key_GetKeysForCommand("+use", &iKey1, &iKey2);
|
||||
|
||||
pszString = cgi.LV_ConvertString(
|
||||
va(
|
||||
"Press Use(%s) to enter player following spectate mode.",
|
||||
cgi.Key_KeynumToBindString(iKey1)
|
||||
)
|
||||
);
|
||||
|
||||
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
|
||||
fY = (float)cgs.glconfig.vidHeight - 24.0;
|
||||
cgi.R_SetColor(0);
|
||||
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX, fY, -1, 0);
|
||||
}
|
||||
|
||||
if ((cg.predicted_player_state.pm_flags & 0x80) != 0 && cg.snap && cg.snap->ps.stats[STAT_INFOCLIENT] != -1)
|
||||
{
|
||||
int iClientNum;
|
||||
qhandle_t hShader;
|
||||
vec4_t color;
|
||||
char buf[128];
|
||||
|
||||
iClientNum = cg.snap->ps.stats[STAT_INFOCLIENT];
|
||||
sprintf(buf, "%s : %i", cg.clientinfo[iClientNum].name, cg.snap->ps.stats[STAT_INFOCLIENT_HEALTH]);
|
||||
|
||||
color[0] = 0.5;
|
||||
color[1] = 1.0;
|
||||
color[2] = 0.5;
|
||||
color[3] = 1.0;
|
||||
|
||||
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) - 16) * 0.5;
|
||||
fY = (float)cgs.glconfig.vidHeight - 80.0;
|
||||
cgi.R_SetColor(color);
|
||||
cgi.R_DrawString(cgs.media.attackerFont, buf, fX, fY, -1, 0);
|
||||
|
||||
if (cg.clientinfo[iClientNum].team == TEAM_ALLIES) {
|
||||
hShader = cgi.R_RegisterShader("textures/hud/allies");
|
||||
} else if (cg.clientinfo[iClientNum].team == TEAM_AXIS) {
|
||||
hShader = cgi.R_RegisterShader("textures/hud/axis");
|
||||
}
|
||||
|
||||
if (hShader)
|
||||
{
|
||||
fX -= 20.0;
|
||||
cgi.R_SetColor(NULL);
|
||||
cgi.R_DrawStretchPic(fX, fY, 16.0, 16.0, 0.0, 0.0, 1.0, 1.0, hShader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void CG_DrawSpectatorView()
|
||||
{
|
||||
const char* pszString;
|
||||
@@ -1083,6 +1195,8 @@ void CG_DrawSpectatorView()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
==============
|
||||
CG_Draw2D
|
||||
|
||||
@@ -495,7 +495,7 @@ void CG_SetLightStyle( int num, const char *s )
|
||||
cg_lightstyle[ num ].map[ k ][ 1 ] = t / 255.0f;
|
||||
k++;
|
||||
}
|
||||
n = max( n, k );
|
||||
n = Q_max( n, k );
|
||||
}
|
||||
while( k < MAX_LIGHTSTYLE_LENGTH )
|
||||
{
|
||||
@@ -518,7 +518,7 @@ void CG_SetLightStyle( int num, const char *s )
|
||||
cg_lightstyle[ num ].map[ k ][ 2 ] = t / 255.0f;
|
||||
k++;
|
||||
}
|
||||
n = max( n, k );
|
||||
n = Q_max( n, k );
|
||||
}
|
||||
while( k < MAX_LIGHTSTYLE_LENGTH )
|
||||
{
|
||||
@@ -541,7 +541,7 @@ void CG_SetLightStyle( int num, const char *s )
|
||||
cg_lightstyle[ num ].map[ k ][ 3 ] = t / 255.0f;
|
||||
k++;
|
||||
}
|
||||
n = max( n, k );
|
||||
n = Q_max( n, k );
|
||||
}
|
||||
while( k < MAX_LIGHTSTYLE_LENGTH )
|
||||
{
|
||||
|
||||
+14
-5
@@ -160,6 +160,7 @@ typedef struct markPoly_s
|
||||
#define MAX_CUSTOM_SOUNDS 32
|
||||
typedef struct {
|
||||
int team;
|
||||
char name[64];
|
||||
} clientInfo_t;
|
||||
|
||||
typedef struct cobjective_s {
|
||||
@@ -297,15 +298,21 @@ typedef struct {
|
||||
qboolean testGun;
|
||||
|
||||
// farplane parameters
|
||||
float farplane_distance;
|
||||
float farplane_distance;
|
||||
float farplane_bias;
|
||||
vec3_t farplane_color;
|
||||
qboolean farplane_cull;
|
||||
qboolean farplane_cull;
|
||||
int skyboxFarplane;
|
||||
qboolean renderTerrain;
|
||||
float farclipOverride;
|
||||
vec3_t farplaneColorOverride;
|
||||
|
||||
// portal sky parameters
|
||||
qboolean sky_portal;
|
||||
float sky_alpha;
|
||||
vec3_t sky_origin;
|
||||
vec3_t sky_axis[3]; // rotation vectors
|
||||
vec3_t sky_axis[3]; // rotation vectors
|
||||
int skyboxSpeed;
|
||||
|
||||
// weapon viewkick recoil
|
||||
float viewkick[2];
|
||||
@@ -371,8 +378,9 @@ typedef struct {
|
||||
int fraglimit;
|
||||
int timelimit;
|
||||
int maxclients;
|
||||
int cinematic;
|
||||
char mapname[MAX_QPATH];
|
||||
int cinematic;
|
||||
int mapChecksum;
|
||||
char mapname[MAX_QPATH];
|
||||
|
||||
//
|
||||
// locally derived information from gamestate
|
||||
@@ -475,6 +483,7 @@ int CG_LastAttacker( void );
|
||||
void CG_Init( clientGameImport_t *imported, int serverMessageNum, int serverCommandSequence, int clientNum );
|
||||
void CG_Shutdown( void );
|
||||
void CG_ServerRestarted( void );
|
||||
void CG_ParseFogInfo(const char* str);
|
||||
|
||||
//
|
||||
// cg_modelanim.cpp
|
||||
|
||||
+61
-10
@@ -300,16 +300,7 @@ void CG_ProcessConfigString(int num)
|
||||
cg.matchStartTime = atoi(str);
|
||||
return;
|
||||
case CS_FOGINFO:
|
||||
sscanf
|
||||
(
|
||||
str,
|
||||
"%d %f %f %f %f",
|
||||
&cg.farplane_cull,
|
||||
&cg.farplane_distance,
|
||||
&cg.farplane_color[0],
|
||||
&cg.farplane_color[1],
|
||||
&cg.farplane_color[2]
|
||||
);
|
||||
CG_ParseFogInfo(str);
|
||||
return;
|
||||
case CS_SKYINFO:
|
||||
sscanf
|
||||
@@ -382,6 +373,25 @@ void CG_ProcessConfigString(int num)
|
||||
{
|
||||
CG_SetLightStyle(num - CS_LIGHTSTYLES, str);
|
||||
}
|
||||
else if (num >= CS_PLAYERS && num < CS_PLAYERS + MAX_CLIENTS)
|
||||
{
|
||||
const char* value;
|
||||
|
||||
value = Info_ValueForKey(str, "name");
|
||||
if (value) {
|
||||
strncpy(cg.clientinfo[num - CS_PLAYERS].name, value, sizeof(cg.clientinfo[num - CS_PLAYERS].name));
|
||||
}
|
||||
else {
|
||||
strncpy(cg.clientinfo[num - CS_PLAYERS].name, "UnnamedSoldier", sizeof(cg.clientinfo[num - CS_PLAYERS].name));
|
||||
}
|
||||
|
||||
value = Info_ValueForKey(str, "team");
|
||||
if (value) {
|
||||
cg.clientinfo[num - CS_PLAYERS].team = atoi(value);
|
||||
} else {
|
||||
cg.clientinfo[num - CS_PLAYERS].team = TEAM_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===================================================================================
|
||||
@@ -776,4 +786,45 @@ void Com_Printf( const char *msg, ... ) {
|
||||
|
||||
#endif
|
||||
|
||||
#if TARGET_GAME_PROTOCOL >= 15
|
||||
|
||||
void CG_ParseFogInfo(const char* str) {
|
||||
sscanf(
|
||||
str,
|
||||
"%d %f %f %f %f %f %f %f %d %f %f %f %f",
|
||||
&cg.farplane_cull,
|
||||
&cg.farplane_distance,
|
||||
&cg.farplane_bias,
|
||||
&cg.skyboxFarplane,
|
||||
&cg.skyboxSpeed,
|
||||
&cg.farplane_color[0],
|
||||
&cg.farplane_color[1],
|
||||
&cg.farplane_color[2],
|
||||
&cg.renderTerrain,
|
||||
&cg.farclipOverride,
|
||||
&cg.farplaneColorOverride[0],
|
||||
&cg.farplaneColorOverride[1],
|
||||
&cg.farplaneColorOverride[2]
|
||||
);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void CG_ParseFogInfo(const char* str) {
|
||||
cg.farclipOverride = 0.0;
|
||||
cg.farplaneColorOverride[0] = -1.0;
|
||||
cg.farplaneColorOverride[1] = -1.0;
|
||||
cg.farplaneColorOverride[2] = -1.0;
|
||||
sscanf
|
||||
(
|
||||
str,
|
||||
"%d %f %f %f %f",
|
||||
&cg.farplane_cull,
|
||||
&cg.farplane_distance,
|
||||
&cg.farplane_color[0],
|
||||
&cg.farplane_color[1],
|
||||
&cg.farplane_color[2]
|
||||
);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -28,6 +28,183 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
void CG_PlayerTeamUpdate(refEntity_t* pModel, entityState_t* pPlayerState)
|
||||
{
|
||||
qboolean bInArtillery, bInTeam, bSpecialIcon;
|
||||
|
||||
#if TARGET_GAME_PROTOCOL < 15
|
||||
if (pPlayerState->eFlags & EF_ALLIES)
|
||||
{
|
||||
cg.clientinfo[pPlayerState->number].team = TEAM_ALLIES;
|
||||
} else if (pPlayerState->eFlags & EF_AXIS) {
|
||||
cg.clientinfo[pPlayerState->number].team = TEAM_AXIS;
|
||||
} else {
|
||||
cg.clientinfo[pPlayerState->number].team = TEAM_NONE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pPlayerState->number == cg.snap->ps.clientNum) {
|
||||
return;
|
||||
}
|
||||
|
||||
bInTeam = qfalse;
|
||||
bSpecialIcon = qfalse;
|
||||
if (cgs.gametype > GT_FFA
|
||||
&& (cg.snap->ps.stats[STAT_TEAM] == TEAM_ALLIES && (pPlayerState->eFlags & EF_ALLIES)
|
||||
|| cg.snap->ps.stats[STAT_TEAM] == TEAM_AXIS && (pPlayerState->eFlags & EF_AXIS)
|
||||
|| cg.snap->ps.stats[STAT_TEAM] != TEAM_AXIS && cg.snap->ps.stats[STAT_TEAM] != TEAM_ALLIES && (pPlayerState->eFlags & EF_ANY_TEAM) != 0))
|
||||
{
|
||||
bInTeam = qtrue;
|
||||
}
|
||||
|
||||
if (cgs.gametype <= GT_FFA) {
|
||||
return;
|
||||
}
|
||||
|
||||
bInArtillery = qfalse;
|
||||
if (pPlayerState->eFlags & EF_PLAYER_ARTILLERY) {
|
||||
bInArtillery = qtrue;
|
||||
}
|
||||
|
||||
if (bInTeam || (pPlayerState->eFlags & (EF_PLAYER_IN_MENU | EF_PLAYER_TALKING)) || bInArtillery)
|
||||
{
|
||||
int i;
|
||||
int iTag;
|
||||
float fAlpha;
|
||||
float fDist;
|
||||
vec3_t vTmp;
|
||||
refEntity_t iconEnt;
|
||||
|
||||
memset(&iconEnt, 0, sizeof(iconEnt));
|
||||
if ((pPlayerState->eFlags & EF_PLAYER_TALKING) != 0 && ((cg.time >> 8) & 1) != 0)
|
||||
{
|
||||
iconEnt.hModel = cgi.R_RegisterModel("textures/hud/talking_headicon.spr");
|
||||
bSpecialIcon = 1;
|
||||
}
|
||||
else if ((pPlayerState->eFlags & EF_PLAYER_IN_MENU) != 0)
|
||||
{
|
||||
iconEnt.hModel = cgi.R_RegisterModel("textures/hud/inmenu_headicon.spr");
|
||||
bSpecialIcon = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!bInTeam) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (bInArtillery)
|
||||
{
|
||||
iconEnt.hModel = cgi.R_RegisterModel("textures/hud/inmenu_artilleryicon.spr");
|
||||
bSpecialIcon = qtrue;
|
||||
}
|
||||
else if ((pPlayerState->eFlags & 0x80) != 0)
|
||||
{
|
||||
iconEnt.hModel = cgi.R_RegisterModel("textures/hud/allies_headicon.spr");
|
||||
}
|
||||
else
|
||||
{
|
||||
iconEnt.hModel = cgi.R_RegisterModel("textures/hud/axis_headicon.spr");
|
||||
}
|
||||
}
|
||||
|
||||
memset(vTmp, 0, sizeof(vTmp));
|
||||
AnglesToAxis(vTmp, iconEnt.axis);
|
||||
|
||||
iconEnt.scale = 0.5;
|
||||
iconEnt.renderfx = 0;
|
||||
iconEnt.reType = RT_SPRITE;
|
||||
iconEnt.shaderTime = 0.0;
|
||||
iconEnt.frameInfo[0].index = 0;
|
||||
iconEnt.shaderRGBA[0] = -1;
|
||||
iconEnt.shaderRGBA[1] = -1;
|
||||
iconEnt.shaderRGBA[2] = -1;
|
||||
VectorCopy(pModel->origin, iconEnt.origin);
|
||||
|
||||
iTag = cgi.Tag_NumForName(pModel->tiki, "eyes bone");
|
||||
if (iTag == -1)
|
||||
{
|
||||
iconEnt.origin[2] = iconEnt.origin[2] + 96.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
orientation_t oEyes = cgi.TIKI_Orientation(pModel, iTag);
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
VectorMA(iconEnt.origin, oEyes.origin[i], pModel->axis[i], iconEnt.origin);
|
||||
}
|
||||
|
||||
iconEnt.origin[2] = iconEnt.origin[2] + 20.0;
|
||||
}
|
||||
|
||||
VectorSubtract(iconEnt.origin, cg.refdef.vieworg, vTmp);
|
||||
fDist = VectorLength(vTmp);
|
||||
|
||||
if (fDist >= 256)
|
||||
{
|
||||
if (fDist > 512.0) {
|
||||
iconEnt.scale = (fDist - 512.0) / 2560.0 + 0.5;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iconEnt.scale = fDist / 853.0 + 0.2;
|
||||
}
|
||||
|
||||
if (iconEnt.scale > 1.0) {
|
||||
iconEnt.scale = 1.0;
|
||||
}
|
||||
|
||||
if (fDist > 256.0) {
|
||||
fAlpha = 1.0;
|
||||
}
|
||||
else if (fDist >= 72.0) {
|
||||
fAlpha = (fDist - 72.0) / 184.0;
|
||||
}
|
||||
else {
|
||||
fAlpha = 0.0;
|
||||
}
|
||||
|
||||
if (cg.snap->ps.stats[STAT_TEAM] == 4 || cg.snap->ps.stats[STAT_TEAM] == 3) {
|
||||
fAlpha = fAlpha * 0.65;
|
||||
}
|
||||
else {
|
||||
fAlpha = fAlpha * 0.4;
|
||||
}
|
||||
|
||||
if (bSpecialIcon)
|
||||
{
|
||||
int value = (int)((fAlpha + 0.60000002) * 255.0);
|
||||
if (value > 255) value = 255;
|
||||
iconEnt.shaderRGBA[3] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
iconEnt.shaderRGBA[3] = (int)(fAlpha * 255.0);
|
||||
}
|
||||
|
||||
if (fAlpha > 0.0 || bSpecialIcon)
|
||||
{
|
||||
if (bSpecialIcon)
|
||||
{
|
||||
VectorMA(iconEnt.origin, -2.0, cg.refdef.viewaxis[0], iconEnt.origin);
|
||||
iconEnt.scale = iconEnt.scale + 0.05;
|
||||
}
|
||||
|
||||
cgi.R_AddRefSpriteToScene(&iconEnt);
|
||||
|
||||
if (bSpecialIcon && bInTeam && fAlpha > 0.0)
|
||||
{
|
||||
if (pPlayerState->eFlags & EF_ALLIES) {
|
||||
iconEnt.hModel = cgi.R_RegisterModel("textures/hud/allies_headicon.spr");
|
||||
}
|
||||
else {
|
||||
iconEnt.hModel = cgi.R_RegisterModel("textures/hud/axis_headicon.spr");
|
||||
}
|
||||
VectorMA(iconEnt.origin, 4.0, cg.refdef.viewaxis[0], iconEnt.origin);
|
||||
iconEnt.scale = iconEnt.scale - 0.1;
|
||||
iconEnt.shaderRGBA[3] = (int)(fAlpha * 255.0);
|
||||
cgi.R_AddRefSpriteToScene(&iconEnt);
|
||||
}
|
||||
}
|
||||
}
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
|
||||
+467
-6
@@ -64,7 +64,7 @@ static void CG_MakeBulletHole(vec3_t i_vPos, vec3_t i_vNorm, int iLarge, trace_t
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
static void CG_MakeBubbleTrail(vec3_t i_vStart, vec3_t i_vEnd, int iLarge)
|
||||
static void CG_MakeBubbleTrail(vec3_t i_vStart, vec3_t i_vEnd, int iLarge, float alpha = 1.0f)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
@@ -79,7 +79,7 @@ static void CG_MakeBulletTracerInternal(vec3_t i_vBarrel, vec3_t i_vStart, vec3_
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
static void CG_MakeBulletTracer(vec3_t i_vBarrel, vec3_t i_vStart, vec3_t* i_vEnd, int i_iNumBullets, qboolean iLarge, int iTracerVisible, qboolean bIgnoreEntities) {
|
||||
static void CG_MakeBulletTracer(vec3_t i_vBarrel, vec3_t i_vStart, vec3_t* i_vEnd, int i_iNumBullets, qboolean iLarge, int iTracerVisible, qboolean bIgnoreEntities, float alpha = 1.0f) {
|
||||
bullet_tracer_t* bullet_tracer;
|
||||
int i;
|
||||
|
||||
@@ -306,6 +306,463 @@ void CG_MakeVehicleEffect(vec3_t i_vStart, vec3_t i_vEnd , vec3_t i_vDir) {
|
||||
cgi.R_DebugLine(vFrom, trace.endpos, 1.0, 1.0, 1.0, 1.0);
|
||||
}
|
||||
|
||||
#if TARGET_GAME_PROTOCOL >= 15
|
||||
|
||||
void CG_ParseCGMessage()
|
||||
{
|
||||
int i;
|
||||
int iType;
|
||||
int iLarge;
|
||||
int iInfo;
|
||||
int iCount;
|
||||
char* szTmp;
|
||||
vec3_t vStart, vEnd, vTmp;
|
||||
vec3_t vEndArray[MAX_IMPACTS];
|
||||
float alpha;
|
||||
int value;
|
||||
|
||||
qboolean bMoreCGameMessages = qtrue;
|
||||
while (bMoreCGameMessages) {
|
||||
iType = cgi.MSG_ReadBits(6);
|
||||
|
||||
switch (iType)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 5:
|
||||
if (iType == 1)
|
||||
{
|
||||
vTmp[0] = cgi.MSG_ReadCoord();
|
||||
vTmp[1] = cgi.MSG_ReadCoord();
|
||||
vTmp[2] = cgi.MSG_ReadCoord();
|
||||
}
|
||||
vStart[0] = cgi.MSG_ReadCoord();
|
||||
vStart[1] = cgi.MSG_ReadCoord();
|
||||
vStart[2] = cgi.MSG_ReadCoord();
|
||||
|
||||
if (iType != 1)
|
||||
{
|
||||
vTmp[0] = vStart[0];
|
||||
vTmp[1] = vStart[1];
|
||||
vTmp[2] = vStart[2];
|
||||
}
|
||||
|
||||
vEndArray[0][0] = cgi.MSG_ReadCoord();
|
||||
vEndArray[0][1] = cgi.MSG_ReadCoord();
|
||||
vEndArray[0][2] = cgi.MSG_ReadCoord();
|
||||
iLarge = cgi.MSG_ReadBits(2);
|
||||
if (cgi.MSG_ReadBits(1)) {
|
||||
int iAlpha = cgi.MSG_ReadBits(10);
|
||||
alpha = (float)iAlpha / 512.0;
|
||||
if (alpha < 0.002) {
|
||||
alpha = 0.002;
|
||||
}
|
||||
} else {
|
||||
alpha = 1.0f;
|
||||
}
|
||||
|
||||
if (iType == 1) {
|
||||
CG_MakeBulletTracer(vTmp, vStart, vEndArray, 1, iLarge, qfalse, qtrue, alpha);
|
||||
}
|
||||
else if (iType == 2) {
|
||||
CG_MakeBulletTracer(vTmp, vStart, vEndArray, 1, iLarge, qfalse, qtrue, alpha);
|
||||
}
|
||||
else {
|
||||
CG_MakeBubbleTrail(vStart, vEndArray[0], iLarge, alpha);
|
||||
}
|
||||
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
if (iType == 3)
|
||||
{
|
||||
vTmp[0] = cgi.MSG_ReadCoord();
|
||||
vTmp[1] = cgi.MSG_ReadCoord();
|
||||
vTmp[2] = cgi.MSG_ReadCoord();
|
||||
iInfo = cgi.MSG_ReadBits(6);
|
||||
}
|
||||
else
|
||||
{
|
||||
iInfo = 0;
|
||||
}
|
||||
|
||||
vStart[0] = cgi.MSG_ReadCoord();
|
||||
vStart[1] = cgi.MSG_ReadCoord();
|
||||
vStart[2] = cgi.MSG_ReadCoord();
|
||||
iLarge = cgi.MSG_ReadBits(2);
|
||||
if (cgi.MSG_ReadBits(1)) {
|
||||
int iAlpha = cgi.MSG_ReadBits(10);
|
||||
alpha = (float)iAlpha / 512.0;
|
||||
if (alpha < 0.002) {
|
||||
alpha = 0.002;
|
||||
}
|
||||
} else {
|
||||
alpha = 1.0f;
|
||||
}
|
||||
|
||||
iCount = cgi.MSG_ReadBits(6);
|
||||
for (i = 0; i < iCount; ++i)
|
||||
{
|
||||
vEndArray[i][0] = cgi.MSG_ReadCoord();
|
||||
vEndArray[i][1] = cgi.MSG_ReadCoord();
|
||||
vEndArray[i][2] = cgi.MSG_ReadCoord();
|
||||
}
|
||||
|
||||
if (iCount) {
|
||||
CG_MakeBulletTracer(vTmp, vStart, vEndArray, iCount, iLarge, iInfo, qtrue, alpha);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
vStart[0] = cgi.MSG_ReadCoord();
|
||||
vStart[1] = cgi.MSG_ReadCoord();
|
||||
vStart[2] = cgi.MSG_ReadCoord();
|
||||
cgi.MSG_ReadDir(vEnd);
|
||||
iLarge = cgi.MSG_ReadBits(2);
|
||||
|
||||
switch (iType)
|
||||
{
|
||||
case 6:
|
||||
if (wall_impact_count < MAX_IMPACTS)
|
||||
{
|
||||
VectorCopy(vStart, wall_impact_pos[wall_impact_count]);
|
||||
VectorCopy(vEnd, wall_impact_norm[wall_impact_count]);
|
||||
wall_impact_large[wall_impact_count] = iLarge;
|
||||
wall_impact_type[wall_impact_count] = -1;
|
||||
wall_impact_count++;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if (wall_impact_count < MAX_IMPACTS)
|
||||
{
|
||||
VectorCopy(vStart, wall_impact_pos[wall_impact_count]);
|
||||
VectorCopy(vEnd, wall_impact_norm[wall_impact_count]);
|
||||
wall_impact_large[wall_impact_count] = iLarge;
|
||||
wall_impact_type[wall_impact_count] = 6;
|
||||
wall_impact_count++;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
if (flesh_impact_count < MAX_IMPACTS)
|
||||
{
|
||||
// negative
|
||||
VectorNegate(vEnd, vEnd);
|
||||
VectorCopy(vStart, flesh_impact_pos[flesh_impact_count]);
|
||||
VectorCopy(vEnd, flesh_impact_norm[flesh_impact_count]);
|
||||
flesh_impact_large[flesh_impact_count] = iLarge;
|
||||
flesh_impact_count++;
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if (flesh_impact_count < MAX_IMPACTS)
|
||||
{
|
||||
// negative
|
||||
VectorNegate(vEnd, vEnd);
|
||||
VectorCopy(vStart, flesh_impact_pos[flesh_impact_count]);
|
||||
VectorCopy(vEnd, flesh_impact_norm[flesh_impact_count]);
|
||||
flesh_impact_large[flesh_impact_count] = iLarge;
|
||||
flesh_impact_count++;
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
if (wall_impact_count < MAX_IMPACTS)
|
||||
{
|
||||
VectorCopy(vStart, wall_impact_pos[wall_impact_count]);
|
||||
VectorCopy(vEnd, wall_impact_norm[wall_impact_count]);
|
||||
wall_impact_large[wall_impact_count] = iLarge;
|
||||
wall_impact_type[wall_impact_count] = 2;
|
||||
wall_impact_count++;
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
if (wall_impact_count < MAX_IMPACTS)
|
||||
{
|
||||
VectorCopy(vStart, wall_impact_pos[wall_impact_count]);
|
||||
VectorCopy(vEnd, wall_impact_norm[wall_impact_count]);
|
||||
wall_impact_large[wall_impact_count] = iLarge;
|
||||
wall_impact_type[wall_impact_count] = 4;
|
||||
wall_impact_count++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
case 12:
|
||||
vStart[0] = cgi.MSG_ReadCoord();
|
||||
vStart[1] = cgi.MSG_ReadCoord();
|
||||
vStart[2] = cgi.MSG_ReadCoord();
|
||||
vEnd[0] = cgi.MSG_ReadCoord();
|
||||
vEnd[1] = cgi.MSG_ReadCoord();
|
||||
vEnd[2] = cgi.MSG_ReadCoord();
|
||||
CG_MeleeImpact(vStart, vEnd);
|
||||
break;
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
case 16:
|
||||
vStart[0] = cgi.MSG_ReadCoord();
|
||||
vStart[1] = cgi.MSG_ReadCoord();
|
||||
vStart[2] = cgi.MSG_ReadCoord();
|
||||
CG_MakeExplosionEffect(vStart, iType);
|
||||
break;
|
||||
case 18:
|
||||
case 19:
|
||||
case 20:
|
||||
case 21:
|
||||
case 22:
|
||||
case 23:
|
||||
case 24:
|
||||
case 25:
|
||||
vStart[0] = cgi.MSG_ReadCoord();
|
||||
vStart[1] = cgi.MSG_ReadCoord();
|
||||
vStart[2] = cgi.MSG_ReadCoord();
|
||||
cgi.MSG_ReadDir(vEnd);
|
||||
|
||||
sfxManager.MakeEffect_Normal(iType + 67, vStart, vEnd);
|
||||
break;
|
||||
|
||||
case 26:
|
||||
case 27:
|
||||
{
|
||||
str sEffect;
|
||||
char cTmp[8];
|
||||
vec3_t axis[3];
|
||||
|
||||
vStart[0] = cgi.MSG_ReadCoord();
|
||||
vStart[1] = cgi.MSG_ReadCoord();
|
||||
vStart[2] = cgi.MSG_ReadCoord();
|
||||
iLarge = cgi.MSG_ReadByte();
|
||||
// get the integer as string
|
||||
snprintf(cTmp, sizeof(cTmp), "%d", iLarge);
|
||||
|
||||
if (iType == 23) {
|
||||
sEffect = "models/fx/crates/debris_";
|
||||
}
|
||||
else {
|
||||
sEffect = "models/fx/windows/debris_";
|
||||
}
|
||||
|
||||
sEffect += cTmp;
|
||||
sEffect += ".tik";
|
||||
|
||||
VectorSet(axis[0], 0, 0, 1);
|
||||
VectorSet(axis[1], 0, 1, 0);
|
||||
VectorSet(axis[2], 1, 0, 0);
|
||||
|
||||
cgi.R_SpawnEffectModel(sEffect.c_str(), vStart, axis);
|
||||
}
|
||||
break;
|
||||
|
||||
case 28:
|
||||
vTmp[0] = cgi.MSG_ReadCoord();
|
||||
vTmp[1] = cgi.MSG_ReadCoord();
|
||||
vTmp[2] = cgi.MSG_ReadCoord();
|
||||
vStart[0] = cgi.MSG_ReadCoord();
|
||||
vStart[1] = cgi.MSG_ReadCoord();
|
||||
vStart[2] = cgi.MSG_ReadCoord();
|
||||
vEndArray[0][0] = cgi.MSG_ReadCoord();
|
||||
vEndArray[0][1] = cgi.MSG_ReadCoord();
|
||||
vEndArray[0][2] = cgi.MSG_ReadCoord();
|
||||
iLarge = cgi.MSG_ReadBits(2);
|
||||
if (cgi.MSG_ReadBits(1)) {
|
||||
int iAlpha = cgi.MSG_ReadBits(10);
|
||||
alpha = (float)iAlpha / 512.0;
|
||||
if (alpha < 0.002) {
|
||||
alpha = 0.002;
|
||||
}
|
||||
} else {
|
||||
alpha = 1.0f;
|
||||
}
|
||||
|
||||
CG_MakeBulletTracer(vTmp, vStart, vEndArray, 1, iLarge, qtrue, qtrue, alpha);
|
||||
break;
|
||||
|
||||
case 29:
|
||||
memset(vTmp, 0, sizeof(vTmp));
|
||||
vStart[0] = cgi.MSG_ReadCoord();
|
||||
vStart[1] = cgi.MSG_ReadCoord();
|
||||
vStart[2] = cgi.MSG_ReadCoord();
|
||||
vEndArray[0][0] = cgi.MSG_ReadCoord();
|
||||
vEndArray[0][1] = cgi.MSG_ReadCoord();
|
||||
vEndArray[0][2] = cgi.MSG_ReadCoord();
|
||||
iLarge = cgi.MSG_ReadBits(1);
|
||||
if (cgi.MSG_ReadBits(1)) {
|
||||
int iAlpha = cgi.MSG_ReadBits(10);
|
||||
alpha = (float)iAlpha / 512.0;
|
||||
if (alpha < 0.002) {
|
||||
alpha = 0.002;
|
||||
}
|
||||
} else {
|
||||
alpha = 1.0f;
|
||||
}
|
||||
|
||||
CG_MakeBulletTracer(vTmp, vStart, vEndArray, 1, iLarge, qfalse, qtrue, alpha);
|
||||
break;
|
||||
|
||||
case 30:
|
||||
iInfo = cgi.MSG_ReadByte();
|
||||
strcpy(cgi.HudDrawElements[iInfo].shaderName, cgi.MSG_ReadString());
|
||||
cgi.HudDrawElements[iInfo].string[0] = 0;
|
||||
cgi.HudDrawElements[iInfo].pFont = NULL;
|
||||
cgi.HudDrawElements[iInfo].fontName[0] = 0;
|
||||
// set the shader
|
||||
CG_HudDrawShader(iInfo);
|
||||
break;
|
||||
|
||||
case 31:
|
||||
iInfo = cgi.MSG_ReadByte();
|
||||
cgi.HudDrawElements[iInfo].iHorizontalAlign = cgi.MSG_ReadBits(2);
|
||||
cgi.HudDrawElements[iInfo].iVerticalAlign = cgi.MSG_ReadBits(2);
|
||||
break;
|
||||
|
||||
case 32:
|
||||
iInfo = cgi.MSG_ReadByte();
|
||||
cgi.HudDrawElements[iInfo].iX = cgi.MSG_ReadShort();
|
||||
cgi.HudDrawElements[iInfo].iY = cgi.MSG_ReadShort();
|
||||
cgi.HudDrawElements[iInfo].iWidth = cgi.MSG_ReadShort();
|
||||
cgi.HudDrawElements[iInfo].iHeight = cgi.MSG_ReadShort();
|
||||
break;
|
||||
|
||||
case 33:
|
||||
iInfo = cgi.MSG_ReadByte();
|
||||
cgi.HudDrawElements[iInfo].bVirtualScreen = cgi.MSG_ReadBits(1);
|
||||
break;
|
||||
|
||||
case 34:
|
||||
iInfo = cgi.MSG_ReadByte();
|
||||
cgi.HudDrawElements[iInfo].vColor[0] = cgi.MSG_ReadByte() / 255.0;
|
||||
cgi.HudDrawElements[iInfo].vColor[1] = cgi.MSG_ReadByte() / 255.0;
|
||||
cgi.HudDrawElements[iInfo].vColor[2] = cgi.MSG_ReadByte() / 255.0;
|
||||
break;
|
||||
|
||||
case 35:
|
||||
iInfo = cgi.MSG_ReadByte();
|
||||
cgi.HudDrawElements[iInfo].vColor[3] = cgi.MSG_ReadByte() / 255.0;
|
||||
break;
|
||||
|
||||
case 36:
|
||||
iInfo = cgi.MSG_ReadByte();
|
||||
cgi.HudDrawElements[iInfo].hShader = 0;
|
||||
strcpy(cgi.HudDrawElements[iInfo].string, cgi.MSG_ReadString());
|
||||
break;
|
||||
|
||||
case 37:
|
||||
iInfo = cgi.MSG_ReadByte();
|
||||
strcpy(cgi.HudDrawElements[iInfo].fontName, cgi.MSG_ReadString());
|
||||
cgi.HudDrawElements[iInfo].hShader = 0;
|
||||
cgi.HudDrawElements[iInfo].shaderName[0] = 0;
|
||||
// load the font
|
||||
CG_HudDrawFont(iInfo);
|
||||
break;
|
||||
|
||||
case 38:
|
||||
case 39:
|
||||
{
|
||||
int iOldEnt;
|
||||
|
||||
iOldEnt = current_entity_number;
|
||||
current_entity_number = cg.snap->ps.clientNum;
|
||||
if (iType == 36) {
|
||||
commandManager.PlaySound(
|
||||
"dm_kill_notify",
|
||||
NULL,
|
||||
CHAN_LOCAL,
|
||||
2.0,
|
||||
-1,
|
||||
-1,
|
||||
1
|
||||
);
|
||||
}
|
||||
else {
|
||||
commandManager.PlaySound(
|
||||
"dm_hit_notify",
|
||||
NULL,
|
||||
CHAN_LOCAL,
|
||||
2.0,
|
||||
-1,
|
||||
-1,
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
current_entity_number = iOldEnt;
|
||||
}
|
||||
break;
|
||||
|
||||
case 40:
|
||||
{
|
||||
int iOldEnt;
|
||||
|
||||
vStart[0] = cgi.MSG_ReadCoord();
|
||||
vStart[1] = cgi.MSG_ReadCoord();
|
||||
vStart[2] = cgi.MSG_ReadCoord();
|
||||
iLarge = cgi.MSG_ReadBits(1);
|
||||
iInfo = cgi.MSG_ReadBits(6);
|
||||
szTmp = cgi.MSG_ReadString();
|
||||
|
||||
iOldEnt = current_entity_number;
|
||||
|
||||
if (iLarge) {
|
||||
current_entity_number = iInfo;
|
||||
|
||||
commandManager.PlaySound(
|
||||
szTmp,
|
||||
vStart,
|
||||
CHAN_LOCAL,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
0
|
||||
);
|
||||
}
|
||||
else {
|
||||
current_entity_number = cg.snap->ps.clientNum;
|
||||
|
||||
commandManager.PlaySound(
|
||||
szTmp,
|
||||
vStart,
|
||||
CHAN_AUTO,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
current_entity_number = iOldEnt;
|
||||
}
|
||||
break;
|
||||
case 41:
|
||||
vStart[0] = cgi.MSG_ReadCoord();
|
||||
vStart[1] = cgi.MSG_ReadCoord();
|
||||
vStart[2] = cgi.MSG_ReadCoord();
|
||||
vEnd[0] = cgi.MSG_ReadCoord();
|
||||
vEnd[1] = cgi.MSG_ReadCoord();
|
||||
vEnd[2] = cgi.MSG_ReadCoord();
|
||||
cgi.MSG_ReadByte();
|
||||
cgi.MSG_ReadByte();
|
||||
VectorSubtract(vEnd, vStart, vTmp);
|
||||
|
||||
// FIXME: unimplemented
|
||||
// ?? can't figure out what is this
|
||||
break;
|
||||
default:
|
||||
cgi.Error(ERR_DROP, "CG_ParseCGMessage: Unknown CGM message type");
|
||||
break;
|
||||
}
|
||||
|
||||
bMoreCGameMessages = cgi.MSG_ReadBits(1);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void CG_ParseCGMessage()
|
||||
{
|
||||
int i;
|
||||
@@ -580,13 +1037,15 @@ void CG_ParseCGMessage()
|
||||
cgi.HudDrawElements[iInfo].bVirtualScreen = cgi.MSG_ReadBits(1);
|
||||
break;
|
||||
|
||||
case 31:
|
||||
case 31:
|
||||
iInfo = cgi.MSG_ReadByte();
|
||||
cgi.HudDrawElements[iInfo].vColor[0] = cgi.MSG_ReadByte() / 255.0;
|
||||
cgi.HudDrawElements[iInfo].vColor[1] = cgi.MSG_ReadByte() / 255.0;
|
||||
cgi.HudDrawElements[iInfo].vColor[2] = cgi.MSG_ReadByte() / 255.0;
|
||||
break;
|
||||
|
||||
case 32:
|
||||
case 32:
|
||||
iInfo = cgi.MSG_ReadByte();
|
||||
cgi.HudDrawElements[iInfo].vColor[3] = cgi.MSG_ReadByte() / 255.0;
|
||||
break;
|
||||
|
||||
@@ -682,10 +1141,12 @@ void CG_ParseCGMessage()
|
||||
current_entity_number = iOldEnt;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
cgi.Error(ERR_DROP, "CG_ParseCGMessage: Unknown CGM message type");
|
||||
break;
|
||||
}
|
||||
|
||||
bMoreCGameMessages = cgi.MSG_ReadBits(1);
|
||||
}
|
||||
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
#endif
|
||||
@@ -404,7 +404,7 @@ typedef struct {
|
||||
// FIXME
|
||||
//prof_cgame_t* profStruct;
|
||||
|
||||
qboolean (*CG_Command_ProcessFile)(char* name, qboolean quiet, dtiki_t* curTiki);
|
||||
qboolean (*CG_Command_ProcessFile)(const char* name, qboolean quiet, dtiki_t* curTiki);
|
||||
|
||||
} clientGameExport_t;
|
||||
|
||||
|
||||
+428
-72
@@ -54,63 +54,419 @@ int CG_GetScoreBoardDrawHeader()
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* CG_GetColumnName(int iColumnNum, int* iColumnWidth)
|
||||
{
|
||||
int iReturnWidth;
|
||||
const char* pszReturnString;
|
||||
|
||||
switch (iColumnNum) {
|
||||
case 0:
|
||||
iReturnWidth = 128;
|
||||
pszReturnString = "Name";
|
||||
break;
|
||||
case 1:
|
||||
iReturnWidth = 64;
|
||||
pszReturnString = "Kills";
|
||||
break;
|
||||
case 2:
|
||||
iReturnWidth = 64;
|
||||
pszReturnString = "Deaths";
|
||||
if (cgs.gametype > GT_TEAM) {
|
||||
pszReturnString = "Total";
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
iReturnWidth = 64;
|
||||
pszReturnString = "Time";
|
||||
break;
|
||||
case 4:
|
||||
iReturnWidth = 64;
|
||||
pszReturnString = "Ping";
|
||||
break;
|
||||
default:
|
||||
iReturnWidth = 0;
|
||||
pszReturnString = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (iColumnWidth) {
|
||||
*iColumnWidth = iReturnWidth;
|
||||
}
|
||||
|
||||
return pszReturnString;
|
||||
}
|
||||
|
||||
void CG_PrepScoreBoardInfo()
|
||||
{
|
||||
switch (cgs.gametype) {
|
||||
switch (cgs.gametype) {
|
||||
case GT_TEAM_ROUNDS:
|
||||
strcpy(cg.scoresMenuName, "DM_Round_Scoreboard");
|
||||
break;
|
||||
case GT_OBJECTIVE:
|
||||
strcpy(cg.scoresMenuName, "Obj_Scoreboard");
|
||||
break;
|
||||
case GT_TEAM_ROUNDS:
|
||||
strcpy(cg.scoresMenuName, "DM_Round_Scoreboard");
|
||||
break;
|
||||
break;
|
||||
case GT_TOW:
|
||||
strcpy(cg.scoresMenuName, "Tow_Scoreboard");
|
||||
break;
|
||||
case GT_LIBERATION:
|
||||
strcpy(cg.scoresMenuName, "Lib_Scoreboard");
|
||||
break;
|
||||
default:
|
||||
strcpy(cg.scoresMenuName, "DM_Scoreboard");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if TARGET_GAME_PROTOCOL >= 15
|
||||
|
||||
const char* CG_GetColumnName(int iColumnNum, int* iColumnWidth)
|
||||
{
|
||||
int iReturnWidth;
|
||||
const char* pszReturnString;
|
||||
|
||||
switch (iColumnNum) {
|
||||
case 0:
|
||||
iReturnWidth = 24;
|
||||
pszReturnString = "#";
|
||||
break;
|
||||
case 1:
|
||||
iReturnWidth = 128;
|
||||
pszReturnString = "Name";
|
||||
break;
|
||||
case 2:
|
||||
iReturnWidth = 64;
|
||||
pszReturnString = "Kills";
|
||||
break;
|
||||
case 3:
|
||||
iReturnWidth = 64;
|
||||
pszReturnString = "Deaths";
|
||||
if (cgs.gametype > GT_TEAM) {
|
||||
pszReturnString = "Total";
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
iReturnWidth = 64;
|
||||
pszReturnString = "Time";
|
||||
break;
|
||||
case 5:
|
||||
iReturnWidth = 64;
|
||||
pszReturnString = "Ping";
|
||||
break;
|
||||
default:
|
||||
iReturnWidth = 0;
|
||||
pszReturnString = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (iColumnWidth) {
|
||||
*iColumnWidth = iReturnWidth;
|
||||
}
|
||||
|
||||
return pszReturnString;
|
||||
}
|
||||
|
||||
void CG_ParseScores()
|
||||
{
|
||||
int i;
|
||||
int iEntryCount;
|
||||
int iClientTeam, iClientNum;
|
||||
int iDatumCount;
|
||||
int iMatchTeam;
|
||||
int iCurrentEntry;
|
||||
qboolean bIsDead, bIsHeader;
|
||||
char szString2[MAX_STRING_TOKENS];
|
||||
char szString3[MAX_STRING_TOKENS];
|
||||
char szString4[MAX_STRING_TOKENS];
|
||||
char szString5[MAX_STRING_TOKENS];
|
||||
char szString6[MAX_STRING_TOKENS];
|
||||
char szString7[MAX_STRING_TOKENS];
|
||||
float vSameTeamTextColor[4];
|
||||
float vSameTeamBackColor[4];
|
||||
float vOtherTeamTextColor[4];
|
||||
float vOtherTeamBackColor[4];
|
||||
float vNoTeamTextColor[4];
|
||||
float vNoTeamBackColor[4];
|
||||
float vThisClientTextColor[4];
|
||||
float vThisClientBackColor[4];
|
||||
float vDeadTextColorDead[4];
|
||||
float* pItemTextColor;
|
||||
float* pItemBackColor;
|
||||
|
||||
iMatchTeam = -1;
|
||||
vSameTeamTextColor[0] = 1.0f;
|
||||
vSameTeamTextColor[1] = 1.0f;
|
||||
vSameTeamTextColor[2] = 1.0f;
|
||||
vSameTeamTextColor[3] = 1.0f;
|
||||
vSameTeamBackColor[0] = 0.1f;
|
||||
vSameTeamBackColor[1] = 0.5f;
|
||||
vSameTeamBackColor[2] = 0.1f;
|
||||
vSameTeamBackColor[3] = 0.4f;
|
||||
vOtherTeamTextColor[0] = 1.0f;
|
||||
vOtherTeamTextColor[1] = 1.0f;
|
||||
vOtherTeamTextColor[2] = 1.0f;
|
||||
vOtherTeamTextColor[3] = 1.0f;
|
||||
vOtherTeamBackColor[0] = 0.5f;
|
||||
vOtherTeamBackColor[1] = 0.1f;
|
||||
vOtherTeamBackColor[2] = 0.1f;
|
||||
vOtherTeamBackColor[3] = 0.4f;
|
||||
vNoTeamTextColor[0] = 1.0f;
|
||||
vNoTeamTextColor[1] = 1.0f;
|
||||
vNoTeamTextColor[2] = 1.0f;
|
||||
vNoTeamTextColor[3] = 1.0f;
|
||||
vNoTeamBackColor[0] = 0.1f;
|
||||
vNoTeamBackColor[1] = 0.1f;
|
||||
vNoTeamBackColor[2] = 0.1f;
|
||||
vNoTeamBackColor[3] = 0.4f;
|
||||
vDeadTextColorDead[0] = 1.0f;
|
||||
vDeadTextColorDead[1] = 0.1f;
|
||||
vDeadTextColorDead[2] = 0.1f;
|
||||
vDeadTextColorDead[3] = 1.0f;
|
||||
|
||||
vThisClientTextColor[0] = 0.0f;
|
||||
vThisClientTextColor[1] = 0.0f;
|
||||
vThisClientTextColor[2] = 0.0f;
|
||||
vThisClientTextColor[3] = 1.0f;
|
||||
|
||||
if (cgs.gametype > GT_FFA)
|
||||
{
|
||||
vThisClientBackColor[0] = 0.5f;
|
||||
vThisClientBackColor[1] = 0.75f;
|
||||
vThisClientBackColor[2] = 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
vThisClientBackColor[0] = 0.75f;
|
||||
vThisClientBackColor[1] = 0.75f;
|
||||
vThisClientBackColor[2] = 0.75f;
|
||||
}
|
||||
|
||||
vThisClientBackColor[3] = 0.8f;
|
||||
|
||||
iCurrentEntry = 1;
|
||||
if (cgs.gametype > GT_FFA)
|
||||
{
|
||||
iDatumCount = 6;
|
||||
iMatchTeam = cg.snap->ps.stats[STAT_TEAM];
|
||||
if (iMatchTeam != TEAM_ALLIES && iMatchTeam != TEAM_AXIS)
|
||||
{
|
||||
iMatchTeam = TEAM_ALLIES;
|
||||
vThisClientTextColor[0] = 0.0f;
|
||||
vThisClientTextColor[1] = 0.0f;
|
||||
vThisClientTextColor[2] = 0.0f;
|
||||
vThisClientBackColor[0] = 0.75f;
|
||||
vThisClientBackColor[1] = 0.75f;
|
||||
vThisClientBackColor[2] = 0.75f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// free-for-all
|
||||
iDatumCount = 5;
|
||||
}
|
||||
|
||||
iEntryCount = atoi(cgi.Argv(iCurrentEntry++));
|
||||
if (iEntryCount > MAX_CLIENTS) {
|
||||
iEntryCount = MAX_CLIENTS;
|
||||
}
|
||||
|
||||
if (cgs.gametype == GT_TOW)
|
||||
{
|
||||
cgi.Cvar_Set("tow_allied_obj1", va("%i", cgi.Argv(iCurrentEntry++)));
|
||||
cgi.Cvar_Set("tow_allied_obj2", va("%i", cgi.Argv(iCurrentEntry++)));
|
||||
cgi.Cvar_Set("tow_allied_obj3", va("%i", cgi.Argv(iCurrentEntry++)));
|
||||
cgi.Cvar_Set("tow_allied_obj4", va("%i", cgi.Argv(iCurrentEntry++)));
|
||||
cgi.Cvar_Set("tow_allied_obj5", va("%i", cgi.Argv(iCurrentEntry++)));
|
||||
cgi.Cvar_Set("tow_axis_obj1", va("%i", cgi.Argv(iCurrentEntry++)));
|
||||
cgi.Cvar_Set("tow_axis_obj2", va("%i", cgi.Argv(iCurrentEntry++)));
|
||||
cgi.Cvar_Set("tow_axis_obj3", va("%i", cgi.Argv(iCurrentEntry++)));
|
||||
cgi.Cvar_Set("tow_axis_obj4", va("%i", cgi.Argv(iCurrentEntry++)));
|
||||
cgi.Cvar_Set("tow_axis_obj5", va("%i", cgi.Argv(iCurrentEntry++)));
|
||||
}
|
||||
|
||||
if (cgs.gametype == GT_LIBERATION)
|
||||
{
|
||||
cgi.Cvar_Set("scoreboard_toggle1", va("%i", cgi.Argv(iCurrentEntry++)));
|
||||
cgi.Cvar_Set("scoreboard_toggle2", va("%i", cgi.Argv(iCurrentEntry++)));
|
||||
}
|
||||
|
||||
for (i = 0; i < iEntryCount; ++i)
|
||||
{
|
||||
bIsHeader = qfalse;
|
||||
if (cgs.gametype > GT_FFA)
|
||||
{
|
||||
iClientNum = atoi(cgi.Argv(iCurrentEntry + iDatumCount * i));
|
||||
iClientTeam = atoi(cgi.Argv(1 + iCurrentEntry + iDatumCount * i));
|
||||
if (iClientTeam >= 0) {
|
||||
bIsDead = qfalse;
|
||||
}
|
||||
else {
|
||||
bIsDead = qtrue;
|
||||
iClientTeam = -iClientTeam;
|
||||
}
|
||||
|
||||
if (iClientNum == -1)
|
||||
{
|
||||
szString2[0] = 0;
|
||||
bIsHeader = qtrue;
|
||||
|
||||
switch (iClientTeam)
|
||||
{
|
||||
case 1:
|
||||
strcpy(szString3, cgi.LV_ConvertString("Spectators"));
|
||||
break;
|
||||
case 2:
|
||||
strcpy(szString3, cgi.LV_ConvertString("Free-For-Allers"));
|
||||
break;
|
||||
case 3:
|
||||
sprintf(
|
||||
szString3,
|
||||
"%s - %d %s",
|
||||
cgi.LV_ConvertString("Allies"),
|
||||
atoi(cgi.Argv(2 + iCurrentEntry + iDatumCount * i)),
|
||||
cgi.LV_ConvertString("Players")
|
||||
);
|
||||
iCurrentEntry++;
|
||||
break;
|
||||
case 4:
|
||||
sprintf(
|
||||
szString3,
|
||||
"%s - %d %s",
|
||||
cgi.LV_ConvertString("Axis"),
|
||||
atoi(cgi.Argv(2 + iCurrentEntry + iDatumCount * i)),
|
||||
cgi.LV_ConvertString("Players")
|
||||
);
|
||||
iCurrentEntry++;
|
||||
break;
|
||||
default:
|
||||
strcpy(szString3, cgi.LV_ConvertString("No Team"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (iClientNum == -2)
|
||||
{
|
||||
// spectating
|
||||
szString2[0] = 0;
|
||||
szString3[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(szString2, va("%i", iClientNum));
|
||||
strcpy(szString3, cg.clientinfo[iClientNum].name);
|
||||
}
|
||||
|
||||
strcpy(szString4, cgi.Argv(2 + iCurrentEntry + iDatumCount * i));
|
||||
strcpy(szString5, cgi.Argv(3 + iCurrentEntry + iDatumCount * i));
|
||||
strcpy(szString6, cgi.Argv(4 + iCurrentEntry + iDatumCount * i));
|
||||
strcpy(szString7, cgi.Argv(5 + iCurrentEntry + iDatumCount * i));
|
||||
|
||||
if (cgs.gametype >= GT_TEAM_ROUNDS && iClientNum == -1 && iClientTeam == TEAM_ALLIES || iClientTeam == TEAM_AXIS)
|
||||
{
|
||||
strcat(szString4, va(" %s", cgi.LV_ConvertString("Wins")));
|
||||
szString5[0] = 0;
|
||||
}
|
||||
|
||||
if (iClientNum == cg.snap->ps.clientNum)
|
||||
{
|
||||
pItemTextColor = vThisClientTextColor;
|
||||
pItemBackColor = vThisClientBackColor;
|
||||
}
|
||||
else if (iClientNum == -2)
|
||||
{
|
||||
pItemTextColor = vNoTeamTextColor;
|
||||
pItemBackColor = vNoTeamBackColor;
|
||||
}
|
||||
else if (iClientTeam == TEAM_ALLIES || iClientTeam == TEAM_AXIS)
|
||||
{
|
||||
if (iClientTeam == iMatchTeam)
|
||||
{
|
||||
pItemTextColor = vSameTeamTextColor;
|
||||
pItemBackColor = vSameTeamBackColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
pItemTextColor = vOtherTeamTextColor;
|
||||
pItemBackColor = vOtherTeamBackColor;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pItemTextColor = vNoTeamTextColor;
|
||||
pItemBackColor = vNoTeamBackColor;
|
||||
}
|
||||
|
||||
if (bIsDead) {
|
||||
pItemTextColor = vDeadTextColorDead;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iClientNum = atoi(cgi.Argv(iDatumCount * i));
|
||||
if (iClientNum >= 0)
|
||||
{
|
||||
strcpy(szString2, va("%i", iClientNum));
|
||||
strcpy(szString3, cg.clientinfo[iClientNum].name);
|
||||
strcpy(szString4, cgi.Argv(1 + iCurrentEntry + iDatumCount * i));
|
||||
strcpy(szString5, cgi.Argv(2 + iCurrentEntry + iDatumCount * i));
|
||||
strcpy(szString6, cgi.Argv(3 + iCurrentEntry + iDatumCount * i));
|
||||
strcpy(szString7, cgi.Argv(4 + iCurrentEntry + iDatumCount * i));
|
||||
}
|
||||
else
|
||||
{
|
||||
szString2[0] = 0;
|
||||
if (iClientNum == -3)
|
||||
{
|
||||
strcpy(szString2, cgi.LV_ConvertString("Players"));
|
||||
bIsHeader = qtrue;
|
||||
}
|
||||
else if (iClientNum == -2)
|
||||
{
|
||||
strcpy(szString2, cgi.LV_ConvertString("Spectators"));
|
||||
bIsHeader = qtrue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// unknown
|
||||
szString3[0] = 0;
|
||||
}
|
||||
szString4[0] = 0;
|
||||
szString5[0] = 0;
|
||||
szString6[0] = 0;
|
||||
szString7[0] = 0;
|
||||
}
|
||||
|
||||
if (iClientNum == cg.snap->ps.clientNum)
|
||||
{
|
||||
pItemTextColor = vThisClientTextColor;
|
||||
pItemBackColor = vThisClientBackColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
pItemTextColor = vNoTeamTextColor;
|
||||
pItemBackColor = vNoTeamBackColor;
|
||||
}
|
||||
}
|
||||
|
||||
cgi.UI_SetScoreBoardItem(
|
||||
i,
|
||||
szString2,
|
||||
szString3,
|
||||
szString4,
|
||||
szString5,
|
||||
szString6,
|
||||
szString7,
|
||||
NULL,
|
||||
NULL,
|
||||
pItemTextColor,
|
||||
pItemBackColor,
|
||||
bIsHeader
|
||||
);
|
||||
}
|
||||
|
||||
cgi.UI_DeleteScoreBoardItems(iEntryCount);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
const char* CG_GetColumnName(int iColumnNum, int* iColumnWidth)
|
||||
{
|
||||
int iReturnWidth;
|
||||
const char* pszReturnString;
|
||||
|
||||
switch (iColumnNum) {
|
||||
case 0:
|
||||
iReturnWidth = 128;
|
||||
pszReturnString = "Name";
|
||||
break;
|
||||
case 1:
|
||||
iReturnWidth = 64;
|
||||
pszReturnString = "Kills";
|
||||
break;
|
||||
case 2:
|
||||
iReturnWidth = 64;
|
||||
pszReturnString = "Deaths";
|
||||
if (cgs.gametype > GT_TEAM) {
|
||||
pszReturnString = "Total";
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
iReturnWidth = 64;
|
||||
pszReturnString = "Time";
|
||||
break;
|
||||
case 4:
|
||||
iReturnWidth = 64;
|
||||
pszReturnString = "Ping";
|
||||
break;
|
||||
default:
|
||||
iReturnWidth = 0;
|
||||
pszReturnString = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (iColumnWidth) {
|
||||
*iColumnWidth = iReturnWidth;
|
||||
}
|
||||
|
||||
return pszReturnString;
|
||||
}
|
||||
|
||||
void CG_ParseScores()
|
||||
{
|
||||
int i;
|
||||
@@ -118,13 +474,13 @@ void CG_ParseScores()
|
||||
int iClientTeam, iClientNum;
|
||||
int iDatumCount;
|
||||
int iMatchTeam;
|
||||
int iCurrentEntry;
|
||||
qboolean bIsDead, bIsHeader;
|
||||
char szString2[MAX_STRING_TOKENS];
|
||||
char szString3[MAX_STRING_TOKENS];
|
||||
char szString4[MAX_STRING_TOKENS];
|
||||
char szString5[MAX_STRING_TOKENS];
|
||||
char szString6[MAX_STRING_TOKENS];
|
||||
const char* pszClientInfo;
|
||||
float vSameTeamTextColor[4];
|
||||
float vSameTeamBackColor[4];
|
||||
float vOtherTeamTextColor[4];
|
||||
@@ -187,6 +543,7 @@ void CG_ParseScores()
|
||||
|
||||
vThisClientBackColor[3] = 0.8f;
|
||||
|
||||
iCurrentEntry = 1;
|
||||
if (cgs.gametype > GT_FFA)
|
||||
{
|
||||
iDatumCount = 6;
|
||||
@@ -208,7 +565,7 @@ void CG_ParseScores()
|
||||
iDatumCount = 5;
|
||||
}
|
||||
|
||||
iEntryCount = atoi(cgi.Argv(1));
|
||||
iEntryCount = atoi(cgi.Argv(iCurrentEntry++));
|
||||
if (iEntryCount > MAX_CLIENTS) {
|
||||
iEntryCount = MAX_CLIENTS;
|
||||
}
|
||||
@@ -218,8 +575,8 @@ void CG_ParseScores()
|
||||
bIsHeader = qfalse;
|
||||
if (cgs.gametype > GT_FFA)
|
||||
{
|
||||
iClientNum = atoi(cgi.Argv(2 + iDatumCount * i));
|
||||
iClientTeam = atoi(cgi.Argv(3 + iDatumCount * i));
|
||||
iClientNum = atoi(cgi.Argv(iCurrentEntry + iDatumCount * i));
|
||||
iClientTeam = atoi(cgi.Argv(1 + iCurrentEntry + iDatumCount * i));
|
||||
if (iClientTeam >= 0) {
|
||||
bIsDead = qfalse;
|
||||
}
|
||||
@@ -235,19 +592,19 @@ void CG_ParseScores()
|
||||
switch (iClientTeam)
|
||||
{
|
||||
case 1:
|
||||
strcpy(szString2, "Spectators");
|
||||
strcpy(szString2, cgi.LV_ConvertString("Spectators"));
|
||||
break;
|
||||
case 2:
|
||||
strcpy(szString2, "Free-For-Allers");
|
||||
strcpy(szString2, cgi.LV_ConvertString("Free-For-Allers"));
|
||||
break;
|
||||
case 3:
|
||||
strcpy(szString2, "Allies");
|
||||
strcpy(szString2, cgi.LV_ConvertString("Allies"));
|
||||
break;
|
||||
case 4:
|
||||
strcpy(szString2, "Axis");
|
||||
strcpy(szString2, cgi.LV_ConvertString("Axis"));
|
||||
break;
|
||||
default:
|
||||
strcpy(szString2, "No Team");
|
||||
strcpy(szString2, cgi.LV_ConvertString("No Team"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -257,15 +614,14 @@ void CG_ParseScores()
|
||||
szString2[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pszClientInfo = CG_ConfigString(CS_PLAYERS + iClientNum);
|
||||
strcpy(szString2, Info_ValueForKey(pszClientInfo, "name"));
|
||||
{
|
||||
strcpy(szString2, cg.clientinfo[iClientNum].name);
|
||||
}
|
||||
|
||||
strcpy(szString3, cgi.Argv(4 + iDatumCount * i));
|
||||
strcpy(szString4, cgi.Argv(5 + iDatumCount * i));
|
||||
strcpy(szString5, cgi.Argv(6 + iDatumCount * i));
|
||||
strcpy(szString6, cgi.Argv(7 + iDatumCount * i));
|
||||
strcpy(szString3, cgi.Argv(2 + iCurrentEntry + iDatumCount * i));
|
||||
strcpy(szString4, cgi.Argv(3 + iCurrentEntry + iDatumCount * i));
|
||||
strcpy(szString5, cgi.Argv(4 + iCurrentEntry + iDatumCount * i));
|
||||
strcpy(szString6, cgi.Argv(5 + iCurrentEntry + iDatumCount * i));
|
||||
|
||||
if (iClientNum == cg.snap->ps.clientNum)
|
||||
{
|
||||
@@ -302,26 +658,25 @@ void CG_ParseScores()
|
||||
}
|
||||
else
|
||||
{
|
||||
iClientNum = atoi(cgi.Argv(2 + iDatumCount * i));
|
||||
iClientNum = atoi(cgi.Argv(iCurrentEntry + iDatumCount * i));
|
||||
if (iClientNum >= 0)
|
||||
{
|
||||
pszClientInfo = CG_ConfigString(CS_PLAYERS + iClientNum);
|
||||
strcpy(szString2, Info_ValueForKey(pszClientInfo, "name"));
|
||||
strcpy(szString3, cgi.Argv(3 + iDatumCount * i));
|
||||
strcpy(szString4, cgi.Argv(4 + iDatumCount * i));
|
||||
strcpy(szString5, cgi.Argv(5 + iDatumCount * i));
|
||||
strcpy(szString6, cgi.Argv(6 + iDatumCount * i));
|
||||
strcpy(szString2, cg.clientinfo[iClientNum].name);
|
||||
strcpy(szString3, cgi.Argv(1 + iCurrentEntry + iDatumCount * i));
|
||||
strcpy(szString4, cgi.Argv(2 + iCurrentEntry + iDatumCount * i));
|
||||
strcpy(szString5, cgi.Argv(3 + iCurrentEntry + iDatumCount * i));
|
||||
strcpy(szString6, cgi.Argv(4 + iCurrentEntry + iDatumCount * i));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iClientNum == -3)
|
||||
{
|
||||
strcpy(szString2, "Players");
|
||||
strcpy(szString2, cgi.LV_ConvertString("Players"));
|
||||
bIsHeader = qtrue;
|
||||
}
|
||||
else if (iClientNum == -2)
|
||||
{
|
||||
strcpy(szString2, "Spectators");
|
||||
strcpy(szString2, cgi.LV_ConvertString("Spectators"));
|
||||
bIsHeader = qtrue;
|
||||
}
|
||||
else
|
||||
@@ -365,3 +720,4 @@ void CG_ParseScores()
|
||||
|
||||
cgi.UI_DeleteScoreBoardItems(iEntryCount);
|
||||
}
|
||||
#endif
|
||||
@@ -25,6 +25,58 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "cg_local.h"
|
||||
|
||||
static const char* IsWeaponAllowed(int dmFlags, int flags) {
|
||||
return (dmFlags & flags) ? "0" : "1";
|
||||
}
|
||||
|
||||
static qboolean QueryLandminesAllowed2(const char* mapname, int dmflags) {
|
||||
if (dmflags & DF_WEAPON_NO_LANDMINE) {
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if (dmflags & DF_WEAPON_LANDMINE_ALWAYS) {
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
if (!Q_stricmpn(mapname, "obj/obj_", 8u))
|
||||
return qfalse;
|
||||
if (!Q_stricmpn(mapname, "dm/mohdm", 8u))
|
||||
return qfalse;
|
||||
if (!Q_stricmp(mapname, "DM/MP_Bahnhof_DM"))
|
||||
return qfalse;
|
||||
if (!Q_stricmp(mapname, "obj/MP_Ardennes_TOW"))
|
||||
return qfalse;
|
||||
if (!Q_stricmp(mapname, "DM/MP_Bazaar_DM"))
|
||||
return qfalse;
|
||||
if (!Q_stricmp(mapname, "obj/MP_Berlin_TOW"))
|
||||
return qfalse;
|
||||
if (!Q_stricmp(mapname, "DM/MP_Brest_DM"))
|
||||
return qfalse;
|
||||
if (!Q_stricmp(mapname, "obj/MP_Druckkammern_TOW"))
|
||||
return qfalse;
|
||||
if (!Q_stricmp(mapname, "DM/MP_Gewitter_DM"))
|
||||
return qfalse;
|
||||
if (!Q_stricmp(mapname, "obj/MP_Flughafen_TOW"))
|
||||
return qfalse;
|
||||
if (!Q_stricmp(mapname, "DM/MP_Holland_DM"))
|
||||
return qfalse;
|
||||
if (!Q_stricmp(mapname, "DM/MP_Malta_DM"))
|
||||
return qfalse;
|
||||
if (!Q_stricmp(mapname, "DM/MP_Stadt_DM"))
|
||||
return qfalse;
|
||||
if (!Q_stricmp(mapname, "DM/MP_Unterseite_DM"))
|
||||
return qfalse;
|
||||
if (!Q_stricmp(mapname, "DM/MP_Verschneit_DM"))
|
||||
return qfalse;
|
||||
if (!Q_stricmp(mapname, "lib/mp_ship_lib"))
|
||||
return qfalse;
|
||||
if (!Q_stricmp(mapname, "DM/MP_Verschneit_DM"))
|
||||
return qfalse;
|
||||
if (!Q_stricmp(mapname, "lib/mp_ship_lib"))
|
||||
return qfalse;
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CG_ParseServerinfo
|
||||
@@ -39,6 +91,7 @@ void CG_ParseServerinfo(void)
|
||||
const char* mapname;
|
||||
char map[MAX_QPATH];
|
||||
char* spawnpos;
|
||||
const char* version;
|
||||
|
||||
info = CG_ConfigString(CS_SERVERINFO);
|
||||
cgs.gametype = atoi(Info_ValueForKey(info, "g_gametype"));
|
||||
@@ -48,6 +101,13 @@ void CG_ParseServerinfo(void)
|
||||
cgs.timelimit = atoi(Info_ValueForKey(info, "timelimit"));
|
||||
cgs.maxclients = atoi(Info_ValueForKey(info, "sv_maxclients"));
|
||||
|
||||
version = Info_ValueForKey(info, "version");
|
||||
if (strstr(version, "Spearhead")) {
|
||||
cgi.Cvar_Set("g_servertype", "1");
|
||||
} else {
|
||||
cgi.Cvar_Set("g_servertype", "2");
|
||||
}
|
||||
|
||||
cgi.Cvar_Set("cg_gametype", Info_ValueForKey(info, "g_gametype"));
|
||||
cgi.Cvar_Set("cg_fraglimit", Info_ValueForKey(info, "fraglimit"));
|
||||
cgi.Cvar_Set("cg_timelimit", Info_ValueForKey(info, "timelimit"));
|
||||
@@ -60,9 +120,18 @@ void CG_ParseServerinfo(void)
|
||||
cgi.Cvar_Set("cg_obj_axistext3", Info_ValueForKey(info, "cg_obj_axistext3"));
|
||||
cgi.Cvar_Set("cg_scoreboardpic", Info_ValueForKey(info, "g_scoreboardpic"));
|
||||
cgi.Cvar_Set("cg_scoreboardpicover", Info_ValueForKey(info, "g_scoreboardpicover"));
|
||||
cgs.mapChecksum = atoi(Info_ValueForKey(info, "sv_mapChecksum"));
|
||||
|
||||
mapname = Info_ValueForKey(info, "mapname");
|
||||
|
||||
cgi.Cvar_Set("cg_weapon_rifle", IsWeaponAllowed(cgs.dmflags, DF_WEAPON_NO_RIFLE));
|
||||
cgi.Cvar_Set("cg_weapon_sniper", IsWeaponAllowed(cgs.dmflags, DF_WEAPON_NO_SNIPER));
|
||||
cgi.Cvar_Set("cg_weapon_mg", IsWeaponAllowed(cgs.dmflags, DF_WEAPON_NO_MG));
|
||||
cgi.Cvar_Set("cg_weapon_smg", IsWeaponAllowed(cgs.dmflags, DF_WEAPON_NO_SMG));
|
||||
cgi.Cvar_Set("cg_weapon_rocket", IsWeaponAllowed(cgs.dmflags, DF_WEAPON_NO_ROCKET));
|
||||
cgi.Cvar_Set("cg_weapon_shotgun", IsWeaponAllowed(cgs.dmflags, DF_WEAPON_NO_SHOTGUN));
|
||||
cgi.Cvar_Set("cg_weapon_landmine", QueryLandminesAllowed2(mapname, cgs.dmflags) ? "1" : "0");
|
||||
|
||||
spawnpos = strchr(mapname, '$');
|
||||
if (spawnpos) {
|
||||
Q_strncpyz(map, mapname, spawnpos - mapname + 1);
|
||||
@@ -152,7 +221,7 @@ CG_Stopwatch_f
|
||||
*/
|
||||
static void CG_Stopwatch_f()
|
||||
{
|
||||
if (cgi.Argc() != 3) {
|
||||
if (cgi.Argc() < 3) {
|
||||
Com_Error(1, "stopwatch didn't have 2 parameters");
|
||||
}
|
||||
|
||||
|
||||
+179
-12
@@ -46,7 +46,40 @@ static const char* AnimPrefixList[] =
|
||||
"bazooka",
|
||||
"panzerschreck",
|
||||
"shotgun",
|
||||
"unarmed"
|
||||
"unarmed",
|
||||
//
|
||||
// Team Assault and Team Tactics weapons
|
||||
"mg42portable",
|
||||
"webley",
|
||||
"nagantrev",
|
||||
"beretta",
|
||||
"enfield",
|
||||
"svt",
|
||||
"mosin",
|
||||
"g43",
|
||||
"enfieldl42a1",
|
||||
"carcano",
|
||||
"delisle",
|
||||
"thompson",
|
||||
"sten",
|
||||
"ppsh",
|
||||
"moschetto",
|
||||
"fg42",
|
||||
"vickers",
|
||||
"breda",
|
||||
"f1grenade",
|
||||
"millsgrenade",
|
||||
"nebelhandgranate",
|
||||
"m18smokegrenade",
|
||||
"rdg1smokegrenade",
|
||||
"bomba",
|
||||
"bombabreda",
|
||||
"mine",
|
||||
"minedetector",
|
||||
"minedetectoraxis",
|
||||
"detonator",
|
||||
"kar98mortar",
|
||||
"PIAT"
|
||||
};
|
||||
|
||||
enum animPrefix_e
|
||||
@@ -69,7 +102,39 @@ enum animPrefix_e
|
||||
WPREFIX_BAZOOKA,
|
||||
WPREFIX_PANZERSCHRECK,
|
||||
WPREFIX_SHOTGUN,
|
||||
WPREFIX_UNARMED
|
||||
WPREFIX_UNARMED,
|
||||
//
|
||||
// Team Assault and Team Tactics weapons
|
||||
WPREFIX_MG42_PORTABLE,
|
||||
WPREFIX_WEBLEY,
|
||||
WPREFIX_NAGANTREV,
|
||||
WPREFIX_BERETTA,
|
||||
WPREFIX_ENFIELD,
|
||||
WPREFIX_SVT,
|
||||
WPREFIX_MOSIN,
|
||||
WPREFIX_G43,
|
||||
WPREFIX_ENFIELDL42A,
|
||||
WPREFIX_CARCANO,
|
||||
WPREFIX_DELISLE,
|
||||
WPREFIX_STEN,
|
||||
WPREFIX_PPSH,
|
||||
WPREFIX_MOSCHETTO,
|
||||
WPREFIX_FG42,
|
||||
WPREFIX_VICKERS,
|
||||
WPREFIX_BREDA,
|
||||
WPREFIX_F1_GRENADE,
|
||||
WPREFIX_MILLS_GRENADE,
|
||||
WPREFIX_NEBELHANDGRANATE,
|
||||
WPREFIX_M18_SMOKE_GRENADE,
|
||||
WPREFIX_RDG1_SMOKE_GRENADE,
|
||||
WPREFIX_BOMBA,
|
||||
WPREFIX_BOMBA_BREDA,
|
||||
WPREFIX_MINE,
|
||||
WPREFIX_MINE_DETECTOR,
|
||||
WPREFIX_MINE_DETECTOR_AXIS,
|
||||
WPREFIX_DETONATOR,
|
||||
WPREFIX_KAR98_MORTAR,
|
||||
WPREFIX_PIAT
|
||||
};
|
||||
|
||||
int CG_GetVMAnimPrefixIndex()
|
||||
@@ -83,7 +148,9 @@ int CG_GetVMAnimPrefixIndex()
|
||||
if (iWeaponClass & WEAPON_CLASS_ANY_ITEM)
|
||||
{
|
||||
if (!Q_stricmp(szWeaponName, "Papers"))
|
||||
return WPREFIX_PAPERS;
|
||||
return WPREFIX_PAPERS;
|
||||
if (!Q_stricmp(szWeaponName, "Packed MG42 Turret"))
|
||||
return WPREFIX_MG42_PORTABLE;
|
||||
}
|
||||
else if (iWeaponClass & WEAPON_CLASS_PISTOL)
|
||||
{
|
||||
@@ -92,7 +159,19 @@ int CG_GetVMAnimPrefixIndex()
|
||||
if (!Q_stricmp(szWeaponName, "Walther P38"))
|
||||
return WPREFIX_P38;
|
||||
if (!Q_stricmp(szWeaponName, "Hi-Standard Silenced"))
|
||||
return WPREFIX_HISTANDARD;
|
||||
return WPREFIX_HISTANDARD;
|
||||
|
||||
//
|
||||
// Team Assault and Team Tactics
|
||||
//
|
||||
if (!Q_stricmp(szWeaponName, "Webley Revolver"))
|
||||
return WPREFIX_WEBLEY;
|
||||
if (!Q_stricmp(szWeaponName, "Nagant Revolver"))
|
||||
return WPREFIX_NAGANTREV;
|
||||
if (!Q_stricmp(szWeaponName, "Beretta"))
|
||||
return WPREFIX_BERETTA;
|
||||
|
||||
return WPREFIX_COLT45;
|
||||
}
|
||||
else if (iWeaponClass & WEAPON_CLASS_RIFLE)
|
||||
{
|
||||
@@ -103,28 +182,97 @@ int CG_GetVMAnimPrefixIndex()
|
||||
if (!Q_stricmp(szWeaponName, "KAR98 - Sniper"))
|
||||
return WPREFIX_KAR98SNIPER;
|
||||
if (!Q_stricmp(szWeaponName, "Springfield '03 Sniper"))
|
||||
return WPREFIX_SPRINGFIELD;
|
||||
return WPREFIX_SPRINGFIELD;
|
||||
|
||||
//
|
||||
// Team Assault and Team Tactics
|
||||
//
|
||||
if (!Q_stricmp(szWeaponName, "Lee-Enfield"))
|
||||
return WPREFIX_SPRINGFIELD;
|
||||
if (!Q_stricmp(szWeaponName, "SVT 40"))
|
||||
return WPREFIX_SVT;
|
||||
if (!Q_stricmp(szWeaponName, "Mosin Nagant Rifle"))
|
||||
return WPREFIX_MOSIN;
|
||||
if (!Q_stricmp(szWeaponName, "G 43"))
|
||||
return WPREFIX_G43;
|
||||
if (!Q_stricmp(szWeaponName, "Enfield L42A1"))
|
||||
return WPREFIX_ENFIELD;
|
||||
if (!Q_stricmp(szWeaponName, "Carcano"))
|
||||
return WPREFIX_CARCANO;
|
||||
if (!Q_stricmp(szWeaponName, "DeLisle"))
|
||||
return WPREFIX_DELISLE;
|
||||
|
||||
return WPREFIX_GARAND;
|
||||
}
|
||||
else if (iWeaponClass & WEAPON_CLASS_SMG)
|
||||
{
|
||||
if (!Q_stricmp(szWeaponName, "Thompson"))
|
||||
return WPREFIX_THOMPSON;
|
||||
if (!Q_stricmp(szWeaponName, "MP40"))
|
||||
return WPREFIX_MP40;
|
||||
return WPREFIX_MP40;
|
||||
//
|
||||
// Team Assault and Team Tactics
|
||||
//
|
||||
if (!Q_stricmp(szWeaponName, "Sten Mark II"))
|
||||
return WPREFIX_STEN;
|
||||
if (!Q_stricmp(szWeaponName, "PPSH SMG"))
|
||||
return WPREFIX_PPSH;
|
||||
if (!Q_stricmp(szWeaponName, "Moschetto"))
|
||||
return WPREFIX_MOSCHETTO;
|
||||
|
||||
return WPREFIX_THOMPSON;
|
||||
}
|
||||
else if (iWeaponClass & WEAPON_CLASS_MG)
|
||||
{
|
||||
if (!Q_stricmp(szWeaponName, "BAR"))
|
||||
return WPREFIX_BAR;
|
||||
if (!Q_stricmp(szWeaponName, "StG 44"))
|
||||
return WPREFIX_MP44;
|
||||
return WPREFIX_MP44;
|
||||
//
|
||||
// Team Assault and Team Tactics
|
||||
//
|
||||
if (!Q_stricmp(szWeaponName, "FG 42"))
|
||||
return WPREFIX_MP44;
|
||||
if (!Q_stricmp(szWeaponName, "Vickers-Berthier"))
|
||||
return WPREFIX_MP44;
|
||||
if (!Q_stricmp(szWeaponName, "Breda"))
|
||||
return WPREFIX_MP44;
|
||||
|
||||
return WPREFIX_BAR;
|
||||
}
|
||||
else if (iWeaponClass & WEAPON_CLASS_GRENADE)
|
||||
{
|
||||
if (!Q_stricmp(szWeaponName, "Frag Grenade"))
|
||||
return WPREFIX_FRAGGRENADE;
|
||||
if (!Q_stricmp(szWeaponName, "Stielhandgranate"))
|
||||
return WPREFIX_STIELHANDGRANATE;
|
||||
return WPREFIX_STIELHANDGRANATE;
|
||||
//
|
||||
// Team Assault and Team Tactics
|
||||
//
|
||||
if (!Q_stricmp(szWeaponName, "F1 Grenade"))
|
||||
return WPREFIX_F1_GRENADE;
|
||||
if (!Q_stricmp(szWeaponName, "Mills Grenade"))
|
||||
return WPREFIX_MILLS_GRENADE;
|
||||
if (!Q_stricmp(szWeaponName, "Nebelhandgranate"))
|
||||
return WPREFIX_NEBELHANDGRANATE;
|
||||
if (!Q_stricmp(szWeaponName, "M18 Smoke Grenade"))
|
||||
return WPREFIX_M18_SMOKE_GRENADE;
|
||||
if (!Q_stricmp(szWeaponName, "RDG-1 Smoke Grenade"))
|
||||
return WPREFIX_RDG1_SMOKE_GRENADE;
|
||||
if (!Q_stricmp(szWeaponName, "Bomba A Mano"))
|
||||
return WPREFIX_BOMBA;
|
||||
if (!Q_stricmp(szWeaponName, "Bomba A Mano Breda"))
|
||||
return WPREFIX_BOMBA_BREDA;
|
||||
if (!Q_stricmp(szWeaponName, "LandmineAllies"))
|
||||
return WPREFIX_MINE;
|
||||
if (!Q_stricmp(szWeaponName, "LandmineAxis"))
|
||||
return WPREFIX_MINE;
|
||||
if (!Q_stricmp(szWeaponName, "Minensuchgerat"))
|
||||
return WPREFIX_MINE_DETECTOR_AXIS;
|
||||
if (!Q_stricmp(szWeaponName, "Minedetector"))
|
||||
return WPREFIX_MINE_DETECTOR;
|
||||
|
||||
return WPREFIX_FRAGGRENADE;
|
||||
}
|
||||
else if (iWeaponClass & WEAPON_CLASS_HEAVY)
|
||||
{
|
||||
@@ -133,7 +281,14 @@ int CG_GetVMAnimPrefixIndex()
|
||||
if (!Q_stricmp(szWeaponName, "Panzerschreck"))
|
||||
return WPREFIX_PANZERSCHRECK;
|
||||
if (!Q_stricmp(szWeaponName, "Shotgun"))
|
||||
return WPREFIX_SHOTGUN;
|
||||
return WPREFIX_SHOTGUN;
|
||||
//
|
||||
// Team Assault and Team Tactics
|
||||
//
|
||||
if (!Q_stricmp(szWeaponName, "PIAT"))
|
||||
return WPREFIX_PIAT;
|
||||
|
||||
return WPREFIX_BAZOOKA;
|
||||
}
|
||||
|
||||
return WPREFIX_UNARMED;
|
||||
@@ -226,10 +381,22 @@ void CG_ViewModelAnimation(refEntity_t* pModel)
|
||||
case VM_ANIM_LADDERSTEP:
|
||||
pszAnimSuffix = "ladderstep";
|
||||
break;
|
||||
case VM_ANIM_IDLE:
|
||||
case VM_ANIM_IDLE_0:
|
||||
pszAnimSuffix = "idle0";
|
||||
break;
|
||||
case VM_ANIM_IDLE_1:
|
||||
pszAnimSuffix = "idle1";
|
||||
break;
|
||||
case VM_ANIM_IDLE_2:
|
||||
pszAnimSuffix = "idle2";
|
||||
break;
|
||||
case VM_ANIM_DISABLED:
|
||||
pszAnimSuffix = "disabled";
|
||||
break;
|
||||
default:
|
||||
pszAnimSuffix = "idle";
|
||||
break;
|
||||
case VM_ANIM_IDLE:
|
||||
pszAnimSuffix = "idle";
|
||||
break;
|
||||
}
|
||||
|
||||
sprintf(szAnimName, "%s_%s", AnimPrefixList[iAnimPrefixIndex], pszAnimSuffix);
|
||||
|
||||
@@ -145,18 +145,23 @@ void VSS_AddRepulsion(cvssource_t* pA, cvssource_t* pB)
|
||||
|
||||
cvssource_t* ClientGameCommandManager::AllocateVSSSource()
|
||||
{
|
||||
m_free_vsssources = m_free_vsssources;
|
||||
cvssource_t* pNew;
|
||||
|
||||
if (!m_free_vsssources) {
|
||||
FreeVSSSource(m_active_vsssources.prev);
|
||||
}
|
||||
|
||||
pNew = m_free_vsssources;
|
||||
m_free_vsssources = m_free_vsssources->next;
|
||||
memset(m_free_vsssources, 0, sizeof(cvssource_t));
|
||||
memset(pNew, 0, sizeof(cvssource_t));
|
||||
|
||||
m_free_vsssources->next = m_active_vsssources.next;
|
||||
m_free_vsssources->prev = &m_active_vsssources;
|
||||
pNew->next = m_active_vsssources.next;
|
||||
pNew->prev = &m_active_vsssources;
|
||||
|
||||
m_active_vsssources.next->prev = m_free_vsssources;
|
||||
m_active_vsssources.next = m_free_vsssources;
|
||||
m_active_vsssources.next->prev = pNew;
|
||||
m_active_vsssources.next = pNew;
|
||||
|
||||
return m_free_vsssources;
|
||||
return pNew;
|
||||
}
|
||||
|
||||
void ClientGameCommandManager::FreeVSSSource(cvssource_t* p)
|
||||
@@ -201,7 +206,7 @@ void ClientGameCommandManager::ResetVSSSources()
|
||||
}
|
||||
|
||||
m_vsssources = (cvssource_t*)cgi.Malloc(sizeof(cvssource_t) * m_iAllocatedvsssources);
|
||||
memset(m_vsssources, 0, sizeof(sizeof(cvssource_t) * m_iAllocatedvsssources));
|
||||
memset(m_vsssources, 0, sizeof(cvssource_t) * m_iAllocatedvsssources);
|
||||
|
||||
m_active_vsssources.next = &m_active_vsssources;
|
||||
m_active_vsssources.prev = &m_active_vsssources;
|
||||
|
||||
@@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
// refdef flags
|
||||
#define RDF_NOWORLDMODEL 1 // used for player configuration screen
|
||||
#define RDF_FULLBRIGHT 2 // fullbright intensity
|
||||
#define RDF_HYPERSPACE 4 // teleportation effect
|
||||
|
||||
typedef struct
|
||||
|
||||
@@ -595,11 +595,11 @@ void CL_CmdButtons( usercmd_t *cmd ) {
|
||||
// allow the game to know if any key at all is
|
||||
// currently pressed, even if it isn't bound to anything
|
||||
if ( anykeydown && Key_GetCatcher() == 0) {
|
||||
cmd->buttons |= BUTTON_ANY;
|
||||
cmd->buttons |= BUTTON_ANY2;
|
||||
}
|
||||
|
||||
if (anykeydown) {
|
||||
cmd->buttons |= BUTTON_ANY2;
|
||||
cmd->buttons |= BUTTON_ANY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -865,7 +865,7 @@ void CL_WritePacket( void ) {
|
||||
for ( i = clc.reliableAcknowledge + 1 ; i <= clc.reliableSequence ; i++ ) {
|
||||
MSG_WriteByte( &buf, clc_clientCommand );
|
||||
MSG_WriteLong( &buf, i );
|
||||
MSG_WriteString( &buf, clc.reliableCommands[ i & (MAX_RELIABLE_COMMANDS-1) ] );
|
||||
MSG_WriteScrambledString( &buf, clc.reliableCommands[ i & (MAX_RELIABLE_COMMANDS-1) ] );
|
||||
}
|
||||
|
||||
// we want to send all the usercmds that were generated in the last
|
||||
@@ -934,7 +934,7 @@ void CL_WritePacket( void ) {
|
||||
clc.lastPacketSentTime = cls.realtime;
|
||||
|
||||
if ( cl_showSend->integer ) {
|
||||
Com_Printf( "%i ", buf.cursize );
|
||||
Com_Printf( "%zu ", buf.cursize );
|
||||
}
|
||||
|
||||
CL_Netchan_Transmit (&clc.netchan, &buf);
|
||||
|
||||
@@ -51,8 +51,8 @@ qboolean alt_down;
|
||||
qboolean ctrl_down;
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
int keynum;
|
||||
const char *name;
|
||||
int keynum;
|
||||
} keyname_t;
|
||||
|
||||
|
||||
@@ -466,7 +466,7 @@ void Key_SetCtrlBinding( int keynum, const char *binding ) {
|
||||
Key_GetBinding
|
||||
===================
|
||||
*/
|
||||
char *Key_GetBinding( int keynum ) {
|
||||
const char *Key_GetBinding( int keynum ) {
|
||||
if ( keynum < 0 || keynum >= K_LASTKEY ) {
|
||||
return "";
|
||||
}
|
||||
@@ -521,7 +521,7 @@ Key_GetKeysForCommand
|
||||
void Key_GetKeysForCommand( const char *command, int *key1, int *key2 ) {
|
||||
int i;
|
||||
|
||||
*key1 = *key2 = 0;
|
||||
*key1 = *key2 = -1;
|
||||
|
||||
for( i = 0; i < K_LASTKEY; i++ ) {
|
||||
if( !keys[ i ].binding ) {
|
||||
|
||||
+56
-32
@@ -32,6 +32,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include "../sys/sys_loadlib.h"
|
||||
#endif
|
||||
|
||||
#include "gcdkeyc.h"
|
||||
|
||||
cvar_t *cl_nodelta;
|
||||
cvar_t *cl_debugMove;
|
||||
|
||||
@@ -97,6 +99,7 @@ cvar_t *wombat;
|
||||
cvar_t *cl_r_fullscreen;
|
||||
|
||||
cvar_t *cl_consoleKeys;
|
||||
cvar_t *name;
|
||||
|
||||
cvar_t* j_pitch;
|
||||
cvar_t* j_yaw;
|
||||
@@ -218,7 +221,7 @@ CL_ChangeReliableCommand
|
||||
======================
|
||||
*/
|
||||
void CL_ChangeReliableCommand( void ) {
|
||||
int r, index, l;
|
||||
size_t r, index, l;
|
||||
|
||||
r = clc.reliableSequence - (random() * 5);
|
||||
index = clc.reliableSequence & ( MAX_RELIABLE_COMMANDS - 1 );
|
||||
@@ -246,7 +249,7 @@ Dumps the current net message, prefixed by the length
|
||||
====================
|
||||
*/
|
||||
void CL_WriteDemoMessage ( msg_t *msg, int headerBytes ) {
|
||||
int len, swlen;
|
||||
size_t len, swlen;
|
||||
|
||||
// write the packet sequence
|
||||
len = clc.serverMessageSequence;
|
||||
@@ -325,7 +328,7 @@ void CL_Record_f( void ) {
|
||||
byte bufData[MAX_MSGLEN];
|
||||
msg_t buf;
|
||||
int i;
|
||||
int len;
|
||||
size_t len;
|
||||
entityState_t *ent;
|
||||
entityState_t nullstate;
|
||||
char *s;
|
||||
@@ -557,7 +560,7 @@ CL_ReadDemoMessage
|
||||
=================
|
||||
*/
|
||||
void CL_ReadDemoMessage( void ) {
|
||||
int r;
|
||||
size_t r;
|
||||
msg_t buf;
|
||||
byte bufData[ MAX_MSGLEN ];
|
||||
int s;
|
||||
@@ -1058,7 +1061,8 @@ in anyway.
|
||||
*/
|
||||
void CL_RequestAuthorization( void ) {
|
||||
char nums[64];
|
||||
int i, j, l;
|
||||
int i, j;
|
||||
size_t l;
|
||||
cvar_t *fs;
|
||||
|
||||
if ( !cls.authorizeServer.port ) {
|
||||
@@ -1421,6 +1425,10 @@ void CL_ResetPureClientAtServer( void ) {
|
||||
CL_AddReliableCommand( va("vdr") );
|
||||
}
|
||||
|
||||
qboolean CL_Allowed_Vid_Restart() {
|
||||
return cls.state == CA_DISCONNECTED || cls.state == CA_ACTIVE;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_Vid_Restart_f
|
||||
@@ -1432,33 +1440,30 @@ because the renderer doesn't know what graphics to reload
|
||||
=================
|
||||
*/
|
||||
void CL_Vid_Restart_f( void ) {
|
||||
|
||||
// Settings may have changed so stop recording now
|
||||
if( CL_VideoRecording( ) ) {
|
||||
CL_CloseAVI( );
|
||||
if (!CL_Allowed_Vid_Restart()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(clc.demorecording)
|
||||
CL_StopRecord_f();
|
||||
Com_Printf("-------- CL_Vid_Restart_f --------\n");
|
||||
cls.vid_restart = qtrue;
|
||||
|
||||
// don't let them loop during the restart
|
||||
S_StopAllSounds( qtrue );
|
||||
S_StopAllSounds(qtrue);
|
||||
|
||||
SV_ClearSvsTimeFixups();
|
||||
|
||||
S_BeginRegistration();
|
||||
|
||||
// shutdown the renderer and clear the renderer interface
|
||||
CL_ShutdownRef();
|
||||
// shutdown the CGame
|
||||
CL_ShutdownCGame();
|
||||
// initialize the renderer interface
|
||||
CL_InitRef();
|
||||
// client is no longer pure untill new checksums are sent
|
||||
CL_ResetPureClientAtServer();
|
||||
// clear pak references
|
||||
FS_ClearPakReferences( FS_UI_REF | FS_CGAME_REF );
|
||||
// reinitialize the filesystem if the game directory or checksum has changed
|
||||
FS_ConditionalRestart( clc.checksumFeed );
|
||||
// initialize the ui library
|
||||
UI_ResolutionChange();
|
||||
|
||||
cls.rendererRegistered = qfalse;
|
||||
cls.uiStarted = qfalse;
|
||||
cls.cgameStarted = qfalse;
|
||||
|
||||
// unpause so the cgame definately gets a snapshot and renders a frame
|
||||
Com_Unpause();
|
||||
@@ -1469,6 +1474,8 @@ void CL_Vid_Restart_f( void ) {
|
||||
|
||||
S_Init();
|
||||
|
||||
cls.vid_restart = qfalse;
|
||||
Com_Printf("----- finished CL_Vid_Restart_f ----\n");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1804,7 +1811,11 @@ void CL_CheckForResend( void ) {
|
||||
// }
|
||||
NET_OutOfBandPrint(NS_CLIENT, clc.serverAddress, "getchallenge");
|
||||
break;
|
||||
|
||||
case CA_AUTHORIZING:
|
||||
// resend the cd key authorization
|
||||
gcd_compute_response(cl_cdkey, Cmd_Argv(1), cls.gcdResponse, CDResponseMethod_REAUTH);
|
||||
NET_OutOfBandPrint(NS_CLIENT, clc.serverAddress, "authorizeThis %s", cls.gcdResponse);
|
||||
break;
|
||||
case CA_CHALLENGING:
|
||||
/*
|
||||
wombat: sending conect here: an example connect string from MOHAA looks like this:
|
||||
@@ -1817,7 +1828,11 @@ wombat: sending conect here: an example connect string from MOHAA looks like thi
|
||||
Q_strncpyz( info, Cvar_InfoString( CVAR_USERINFO ), sizeof( info ) );
|
||||
Info_SetValueForKey( info, "protocol", va("%i", PROTOCOL_VERSION ) );
|
||||
Info_SetValueForKey( info, "qport", va("%i", port ) );
|
||||
Info_SetValueForKey( info, "challenge", va("%i", clc.challenge ) );
|
||||
Info_SetValueForKey(info, "challenge", va("%i", clc.challenge));
|
||||
Info_SetValueForKey(info, "version", TARGET_GAME_VERSION);
|
||||
#if TARGET_GAME_PROTOCOL >= 15
|
||||
Info_SetValueForKey(info, "clientType", "Breakthrough");
|
||||
#endif
|
||||
|
||||
strcpy(data, "connect ");
|
||||
// TTimo adding " " around the userinfo string to avoid truncated userinfo on the server
|
||||
@@ -2076,7 +2091,7 @@ void CL_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
|
||||
|
||||
// challenge from the server we are connecting to
|
||||
if ( !Q_stricmp(c, "challengeResponse") ) {
|
||||
if ( cls.state != CA_CONNECTING ) {
|
||||
if ( cls.state != CA_CONNECTING && cls.state != CA_AUTHORIZING ) {
|
||||
Com_Printf( "Unwanted challenge response received. Ignored.\n" );
|
||||
} else {
|
||||
// start sending challenge repsonse instead of challenge request packets
|
||||
@@ -2141,8 +2156,10 @@ void CL_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
|
||||
}
|
||||
|
||||
// cd check
|
||||
if ( !Q_stricmp(c, "keyAuthorize") ) {
|
||||
// we don't use these now, so dump them on the floor
|
||||
if ( !Q_stricmp(c, "getKey") ) {
|
||||
cls.state = CA_AUTHORIZING;
|
||||
gcd_compute_response(cl_cdkey, Cmd_Argv(1), cls.gcdResponse, CDResponseMethod_NEWAUTH);
|
||||
NET_OutOfBandPrint(NS_CLIENT, from, "authorizeThis %s", cls.gcdResponse);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2274,7 +2291,7 @@ qboolean CL_CheckPaused(void)
|
||||
// if paused->modified is set, the cvar has only been changed in
|
||||
// this frame. Keep paused in this frame to ensure the server doesn't
|
||||
// lag behind.
|
||||
if(paused->integer || paused->modified)
|
||||
if(paused->integer)
|
||||
return qtrue;
|
||||
|
||||
return qfalse;
|
||||
@@ -2289,6 +2306,8 @@ CL_CheckUserinfo
|
||||
==================
|
||||
*/
|
||||
void CL_CheckUserinfo( void ) {
|
||||
char szSanitizedName[MAX_NAME_LENGTH];
|
||||
|
||||
// don't add reliable commands when not yet connected
|
||||
if(cls.state < CA_CHALLENGING)
|
||||
return;
|
||||
@@ -2300,6 +2319,10 @@ void CL_CheckUserinfo( void ) {
|
||||
// send a reliable userinfo update if needed
|
||||
if(cvar_modifiedFlags & CVAR_USERINFO)
|
||||
{
|
||||
if (Com_SanitizeName(name->string, szSanitizedName)) {
|
||||
Cvar_Set("name", szSanitizedName);
|
||||
}
|
||||
|
||||
cvar_modifiedFlags &= ~CVAR_USERINFO;
|
||||
CL_AddReliableCommand( va("userinfo \"%s\"", Cvar_InfoString( CVAR_USERINFO ) ) );
|
||||
}
|
||||
@@ -3101,7 +3124,7 @@ void CL_Init( void ) {
|
||||
cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "~ ` 0x7e 0x60", CVAR_ARCHIVE );
|
||||
|
||||
// userinfo
|
||||
Cvar_Get ("name", "UnnamedSoldier", CVAR_USERINFO | CVAR_ARCHIVE );
|
||||
name = Cvar_Get ("name", "UnnamedSoldier", CVAR_USERINFO | CVAR_ARCHIVE );
|
||||
Cvar_Get ("rate", "5000", CVAR_USERINFO | CVAR_ARCHIVE );
|
||||
Cvar_Get ("snaps", "20", CVAR_USERINFO | CVAR_ARCHIVE );
|
||||
Cvar_Get ("password", "", CVAR_USERINFO);
|
||||
@@ -3294,7 +3317,7 @@ CL_ServerInfoPacket
|
||||
void CL_ServerInfoPacket( netadr_t from, msg_t *msg ) {
|
||||
int i, type;
|
||||
char info[MAX_INFO_STRING];
|
||||
char* str;
|
||||
const char* str;
|
||||
char *infoString;
|
||||
int prot;
|
||||
|
||||
@@ -3490,10 +3513,10 @@ CL_ServerStatusResponse
|
||||
===================
|
||||
*/
|
||||
void CL_ServerStatusResponse( netadr_t from, msg_t *msg ) {
|
||||
char *s;
|
||||
const char *s;
|
||||
char info[MAX_INFO_STRING];
|
||||
int i, l, score, ping;
|
||||
int len;
|
||||
size_t len;
|
||||
serverStatus_t *serverStatus;
|
||||
|
||||
serverStatus = NULL;
|
||||
@@ -3583,7 +3606,7 @@ CL_LocalServers_f
|
||||
==================
|
||||
*/
|
||||
void CL_LocalServers_f( void ) {
|
||||
char *message;
|
||||
const char *message;
|
||||
int i, j;
|
||||
netadr_t to;
|
||||
|
||||
@@ -4252,7 +4275,8 @@ qboolean CL_CDKeyValidate( const char *key, const char *checksum ) {
|
||||
char ch;
|
||||
byte sum;
|
||||
char chs[3];
|
||||
int i, len;
|
||||
int i;
|
||||
size_t len;
|
||||
|
||||
len = strlen(key);
|
||||
if( len != CDKEY_LEN ) {
|
||||
|
||||
+37
-17
@@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include "client.h"
|
||||
#include "cl_ui.h"
|
||||
|
||||
char *svc_strings[256] = {
|
||||
const char *svc_strings[256] = {
|
||||
"svc_bad",
|
||||
|
||||
"svc_nop",
|
||||
@@ -41,7 +41,7 @@ char *svc_strings[256] = {
|
||||
|
||||
msg_t *cl_currentMSG;
|
||||
|
||||
void SHOWNET( msg_t *msg, char *s) {
|
||||
void SHOWNET( msg_t *msg, const char *s) {
|
||||
if ( cl_shownet->integer >= 2) {
|
||||
Com_Printf ("%3i:%s\n", msg->readcount-1, s);
|
||||
}
|
||||
@@ -75,8 +75,7 @@ void CL_DeltaEntity (msg_t *msg, clSnapshot_t *frame, int newnum, entityState_t
|
||||
if ( unchanged ) {
|
||||
*state = *old;
|
||||
} else {
|
||||
// FIXME: frametime
|
||||
MSG_ReadDeltaEntity( msg, old, state, newnum, 0.0);
|
||||
MSG_ReadDeltaEntity( msg, old, state, newnum, cls.serverFrameTime);
|
||||
}
|
||||
|
||||
if ( state->number == (MAX_GENTITIES-1) ) {
|
||||
@@ -117,7 +116,7 @@ void CL_ParsePacketEntities( msg_t *msg, clSnapshot_t *oldframe, clSnapshot_t *n
|
||||
|
||||
while ( 1 ) {
|
||||
// read the entity index number
|
||||
newnum = MSG_ReadBits( msg, GENTITYNUM_BITS );
|
||||
newnum = MSG_ReadEntityNum(msg);
|
||||
|
||||
if ( newnum == (MAX_GENTITIES-1) ) {
|
||||
break;
|
||||
@@ -274,11 +273,10 @@ void CL_ParseSnapshot( msg_t *msg ) {
|
||||
|
||||
// read playerinfo
|
||||
SHOWNET(msg, "playerstate");
|
||||
// FIXME: frametime
|
||||
if ( old ) {
|
||||
MSG_ReadDeltaPlayerstate( msg, &old->ps, &newSnap.ps, 0.0 );
|
||||
MSG_ReadDeltaPlayerstate( msg, &old->ps, &newSnap.ps, cls.serverFrameTime );
|
||||
} else {
|
||||
MSG_ReadDeltaPlayerstate( msg, NULL, &newSnap.ps, 0.0);
|
||||
MSG_ReadDeltaPlayerstate( msg, NULL, &newSnap.ps, cls.serverFrameTime);
|
||||
}
|
||||
|
||||
// read packet entities
|
||||
@@ -446,6 +444,28 @@ static void CL_ParseServerInfo(void)
|
||||
sizeof(clc.sv_dlURL));
|
||||
}
|
||||
|
||||
#if TARGET_GAME_PROTOCOL >= 15
|
||||
|
||||
char* MSG_ReadGameStateChar(msg_t* msg) {
|
||||
return MSG_ReadScrambledBigString(msg);
|
||||
}
|
||||
|
||||
float MSG_ReadServerFrameTime(msg_t* msg) {
|
||||
return MSG_ReadFloat(msg);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
char* MSG_ReadGameStateChar(msg_t* msg) {
|
||||
return MSG_ReadString(msg);
|
||||
}
|
||||
|
||||
float MSG_ReadServerFrameTime(msg_t* msg) {
|
||||
return 1.f / atof(Info_ValueForKey(cl.gameState.stringData + cl.gameState.stringOffsets[CS_SYSTEMINFO], "sv_fps"));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_ParseGamestate
|
||||
@@ -488,7 +508,7 @@ void CL_ParseGamestate( msg_t *msg ) {
|
||||
if ( i < 0 || i >= MAX_CONFIGSTRINGS ) {
|
||||
Com_Error( ERR_DROP, "configstring > MAX_CONFIGSTRINGS" );
|
||||
}
|
||||
s = MSG_ReadString( msg );
|
||||
s = MSG_ReadGameStateChar( msg );
|
||||
len = strlen( s );
|
||||
|
||||
if ( len + 1 + cl.gameState.dataCount > MAX_GAMESTATE_CHARS ) {
|
||||
@@ -499,7 +519,7 @@ void CL_ParseGamestate( msg_t *msg ) {
|
||||
Com_Memcpy( cl.gameState.stringData + cl.gameState.dataCount, s, len + 1 );
|
||||
cl.gameState.dataCount += len + 1;
|
||||
} else if ( cmd == svc_baseline ) {
|
||||
newnum = MSG_ReadBits( msg, GENTITYNUM_BITS );
|
||||
newnum = MSG_ReadEntityNum(msg);
|
||||
if ( newnum < 0 || newnum >= MAX_GENTITIES ) {
|
||||
Com_Error( ERR_DROP, "Baseline number out of range: %i", newnum );
|
||||
}
|
||||
@@ -516,6 +536,7 @@ void CL_ParseGamestate( msg_t *msg ) {
|
||||
clc.clientNum = MSG_ReadLong(msg);
|
||||
// read the checksum feed
|
||||
clc.checksumFeed = MSG_ReadLong( msg );
|
||||
cls.serverFrameTime = MSG_ReadServerFrameTime(msg);
|
||||
|
||||
// parse serverId and other cvars
|
||||
CL_SystemInfoChanged();
|
||||
@@ -727,7 +748,7 @@ void CL_ParseCommandString( msg_t *msg ) {
|
||||
int index;
|
||||
|
||||
seq = MSG_ReadLong( msg );
|
||||
s = MSG_ReadString( msg );
|
||||
s = MSG_ReadScrambledString( msg );
|
||||
|
||||
// see if we have already executed stored it off
|
||||
if ( clc.serverCommandSequence >= seq ) {
|
||||
@@ -764,10 +785,9 @@ void CL_ParseLocationprint( msg_t *msg ) {
|
||||
|
||||
x = MSG_ReadShort( msg );
|
||||
y = MSG_ReadShort( msg );
|
||||
string = MSG_ReadString(msg);
|
||||
string = MSG_ReadScrambledString(msg);
|
||||
|
||||
// FIXME
|
||||
//UI_UpdateLocationPrint( x, y, string, 1.0 );
|
||||
UI_UpdateLocationPrint( x, y, string, 1.0 );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -778,10 +798,10 @@ CL_ParseCenterprint
|
||||
void CL_ParseCenterprint( msg_t *msg ) {
|
||||
char *string;
|
||||
|
||||
string = MSG_ReadString( msg );
|
||||
string = MSG_ReadScrambledString( msg );
|
||||
|
||||
// FIXME
|
||||
//UI_UpdateCenterPrintf( string, 1.0 );
|
||||
UI_UpdateCenterPrint( string, 1.0 );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -793,7 +813,7 @@ void CL_ParseServerMessage( msg_t *msg ) {
|
||||
int cmd;
|
||||
//Com_Printf( "ParseServerMessage: %i\n", msg->cursize );
|
||||
if ( cl_shownet->integer == 1 ) {
|
||||
Com_Printf ("%i ",msg->cursize);
|
||||
Com_Printf ("%zu ",msg->cursize);
|
||||
} else if ( cl_shownet->integer >= 2 ) {
|
||||
Com_Printf ("------------------\n");
|
||||
}
|
||||
|
||||
@@ -877,7 +877,7 @@ Key_GetBindingBuf
|
||||
====================
|
||||
*/
|
||||
static void Key_GetBindingBuf( int keynum, char *buf, int buflen ) {
|
||||
char *value;
|
||||
const char *value;
|
||||
|
||||
value = Key_GetBinding( keynum );
|
||||
if ( value ) {
|
||||
@@ -1119,7 +1119,7 @@ getNewConsole
|
||||
====================
|
||||
*/
|
||||
UIFloatingConsole* getNewConsole() {
|
||||
static constexpr char CONSOLE_NAME[] = PRODUCT_NAME_FULL " - " PRODUCT_VERSION_FULL;
|
||||
static constexpr char CONSOLE_NAME[] = PRODUCT_NAME " console version " PRODUCT_VERSION;
|
||||
|
||||
UIFloatingConsole* console = new UIFloatingConsole;
|
||||
console->Create(NULL, getDefaultConsoleRectangle(), CONSOLE_NAME, UWindowColor, UHudColor);
|
||||
@@ -3638,8 +3638,8 @@ void UI_WantsKeyboard() {
|
||||
}
|
||||
|
||||
struct widgettrans_s {
|
||||
char *src;
|
||||
char *dst;
|
||||
const char *src;
|
||||
const char *dst;
|
||||
};
|
||||
|
||||
static widgettrans_s s_widgettrans[ 2 ] =
|
||||
@@ -4885,7 +4885,7 @@ static void SaveConsoleRectangle( void ) {
|
||||
if( !fakk_console->IsMinimized() ) {
|
||||
r = fakk_console->getFrame();
|
||||
|
||||
Cvar_Set( "ui_consoleposition", va( "%d %d %d %d", r.pos.x, r.pos.y, r.size.width, r.size.height ) );
|
||||
Cvar_Set( "ui_consoleposition", va( "%d %d %d %d", (int)r.pos.x, (int)r.pos.y, (int)r.size.width, (int)r.size.height ) );
|
||||
|
||||
if( wasMinimized ) {
|
||||
fakk_console->ProcessEvent( UIFloatingWindow::W_MinimizePressed );
|
||||
@@ -5492,7 +5492,7 @@ qboolean UI_IsResourceLoaded( const char *name ) {
|
||||
case 104:
|
||||
return TIKI_FindTikiAnim( name + 1 ) != NULL;
|
||||
case 103:
|
||||
return SkeletorCacheFindFilename( name + 1, NULL ) != NULL;
|
||||
return SkeletorCacheFindFilename( name + 1, NULL );
|
||||
case 107:
|
||||
return S_IsSoundRegistered( name + 1 );
|
||||
case 110:
|
||||
|
||||
@@ -189,11 +189,13 @@ void UIDMBox::RemoveTopItem( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < m_numitems - 1; i++) {
|
||||
m_items[i] = m_items[i + 1];
|
||||
}
|
||||
if (m_numitems > 0) {
|
||||
for (i = 0; i < m_numitems - 1; i++) {
|
||||
m_items[i] = m_items[i + 1];
|
||||
}
|
||||
|
||||
m_numitems--;
|
||||
m_numitems--;
|
||||
}
|
||||
}
|
||||
|
||||
str UIDMBox::CalculateBreaks( UIFont *font, str text, float max_width )
|
||||
|
||||
@@ -186,11 +186,13 @@ void UIGMBox::RemoveTopItem( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < m_numitems - 1; i++) {
|
||||
m_items[i] = m_items[i + 1];
|
||||
}
|
||||
if (m_numitems > 0) {
|
||||
for (i = 0; i < m_numitems - 1; i++) {
|
||||
m_items[i] = m_items[i + 1];
|
||||
}
|
||||
|
||||
m_numitems--;
|
||||
m_numitems--;
|
||||
}
|
||||
}
|
||||
|
||||
str UIGMBox::CalculateBreaks( UIFont *font, str text, float max_width )
|
||||
|
||||
@@ -29,8 +29,8 @@ public:
|
||||
|
||||
SoundPickerClass();
|
||||
|
||||
void FileSelected( str ¤tDirectory, str &partialName, str &fullname );
|
||||
void FileChosen( str ¤tDirectory, str &partialName, str &fullname );
|
||||
void FileSelected( str ¤tDirectory, str &partialName, str &fullname ) override;
|
||||
void FileChosen( str ¤tDirectory, str &partialName, str &fullname ) override;
|
||||
};
|
||||
|
||||
#endif /* __CL_UISOUNDPICKER_H__ */
|
||||
@@ -519,7 +519,8 @@ void UIFakkLabel::DrawStatbar( float frac )
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -574,6 +575,8 @@ void UIFakkLabel::DrawStatbar( float frac )
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -603,6 +606,8 @@ void UIFakkLabel::DrawStatbar( float frac )
|
||||
1.0
|
||||
);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
void UpdateLocationPrint( int x, int y, const char *s, float alpha );
|
||||
qboolean LetterboxActive( void );
|
||||
void InitSubtitle( void );
|
||||
void FrameInitialized( void );
|
||||
void FrameInitialized( void ) override;
|
||||
virtual void Pressed( Event *ev );
|
||||
};
|
||||
|
||||
|
||||
@@ -303,6 +303,7 @@ typedef struct {
|
||||
|
||||
int framecount;
|
||||
int frametime; // msec since last frame
|
||||
float serverFrameTime;
|
||||
|
||||
int realtime; // ignores pause
|
||||
int realFrametime; // ignoring pause, so console always works
|
||||
@@ -345,6 +346,11 @@ typedef struct {
|
||||
hdelement_t HudDrawElements[ MAX_HUDDRAW_ELEMENTS ];
|
||||
clientAnim_t anim;
|
||||
stopWatch_t stopwatch;
|
||||
void* savedCgameState;
|
||||
int savedCgameStateSize;
|
||||
char gcdResponse[73];
|
||||
int unknown3_0;
|
||||
int currentRate;
|
||||
qhandle_t charSetShader;
|
||||
qhandle_t whiteShader;
|
||||
qhandle_t consoleShader;
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ extern int chat_playerNum;
|
||||
int Key_StringToKeynum( const char *str );
|
||||
void Key_WriteBindings( fileHandle_t f );
|
||||
void Key_SetBinding( int keynum, const char *binding );
|
||||
char *Key_GetBinding( int keynum );
|
||||
const char *Key_GetBinding( int keynum );
|
||||
qboolean Key_IsDown( int keynum );
|
||||
qboolean Key_GetOverstrikeMode( void );
|
||||
void Key_SetOverstrikeMode( qboolean state );
|
||||
|
||||
+121
-6
@@ -66,6 +66,34 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#define CS_MOTD 4 // g_motd string for server message of the day
|
||||
#define CS_WARMUP 5 // server time when the match will be restarted
|
||||
|
||||
#if TARGET_GAME_PROTOCOL >= 15
|
||||
#define CS_MUSIC 6 // MUSIC_NewSoundtrack(cs)
|
||||
#define CS_FOGINFO 7 // cg.farplane_cull cg.farplane_distance cg.farplane_color[3]
|
||||
#define CS_SKYINFO 8 // cg.sky_alpha cg.sky_portal
|
||||
|
||||
#define CS_GAME_VERSION 9
|
||||
#define CS_LEVEL_START_TIME 10 // so the timer only shows the current level cgs.levelStartTime
|
||||
|
||||
#define CS_CURRENT_OBJECTIVE 11
|
||||
|
||||
#define CS_RAIN_DENSITY 12 // cg.rain
|
||||
#define CS_RAIN_SPEED 13
|
||||
#define CS_RAIN_SPEEDVARY 14
|
||||
#define CS_RAIN_SLANT 15
|
||||
#define CS_RAIN_LENGTH 16
|
||||
#define CS_RAIN_MINDIST 17
|
||||
#define CS_RAIN_WIDTH 18
|
||||
#define CS_RAIN_SHADER 19
|
||||
#define CS_RAIN_NUMSHADERS 20
|
||||
|
||||
#define CS_VOTE_TIME 21
|
||||
#define CS_VOTE_STRING 22
|
||||
#define CS_VOTE_YES 23
|
||||
#define CS_VOTE_NO 24
|
||||
#define CS_VOTE_UNDECIDED 25
|
||||
|
||||
#else
|
||||
|
||||
#define CS_MUSIC 8 // MUSIC_NewSoundtrack(cs)
|
||||
#define CS_FOGINFO 9 // cg.farplane_cull cg.farplane_distance cg.farplane_color[3]
|
||||
#define CS_SKYINFO 10 // cg.sky_alpha cg.sky_portal
|
||||
@@ -85,6 +113,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#define CS_RAIN_SHADER 21
|
||||
#define CS_RAIN_NUMSHADERS 22
|
||||
|
||||
#endif
|
||||
|
||||
#define CS_MATCHEND 26 // cgs.matchEndTime
|
||||
|
||||
#define CS_MODELS 32
|
||||
@@ -98,11 +128,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#define CS_PLAYERS (CS_LIGHTSTYLES+MAX_LIGHTSTYLES) // 1684
|
||||
|
||||
#define CS_WEAPONS (CS_PLAYERS+MAX_CLIENTS) // su44 was here
|
||||
#define CS_TEAMS 1876
|
||||
#define CS_GENERAL_STRINGS 1877
|
||||
#define CS_SPECTATORS 1878
|
||||
#define CS_ALLIES 1879
|
||||
#define CS_AXIS 1880
|
||||
#define CS_TEAMS 1892
|
||||
#define CS_GENERAL_STRINGS 1893
|
||||
#define CS_SPECTATORS 1894
|
||||
#define CS_ALLIES 1895
|
||||
#define CS_AXIS 1896
|
||||
#define CS_SOUNDTRACK 1881
|
||||
|
||||
#define CS_TEAMINFO 1
|
||||
@@ -122,6 +152,10 @@ typedef enum {
|
||||
GT_TEAM, // team deathmatch
|
||||
GT_TEAM_ROUNDS,
|
||||
GT_OBJECTIVE,
|
||||
// Team Assault game mode
|
||||
GT_TOW,
|
||||
// Team Tactics game mode
|
||||
GT_LIBERATION,
|
||||
GT_MAX_GAME_TYPE
|
||||
} gametype_t;
|
||||
|
||||
@@ -231,6 +265,28 @@ typedef enum {
|
||||
#define PMF_LEVELEXIT (1<<20) // use camera view instead of ps view
|
||||
#endif
|
||||
|
||||
#if TARGET_GAME_PROTOCOL >= 15
|
||||
|
||||
// moh pm_flags
|
||||
#define PMF_DUCKED (1<<0)
|
||||
#define PMF_VIEW_PRONE (1<<1)
|
||||
#define PMF_SPECTATING (1<<2)
|
||||
#define PMF_RESPAWNED (1<<3)
|
||||
#define PMF_NO_PREDICTION (1<<4)
|
||||
#define PMF_FROZEN (1<<5)
|
||||
#define PMF_INTERMISSION (1<<6)
|
||||
#define PMF_SPECTATE_FOLLOW (1<<7)
|
||||
#define PMF_CAMERA_VIEW (1<<7) // use camera view instead of ps view
|
||||
#define PMF_NO_MOVE (1<<8)
|
||||
#define PMF_VIEW_DUCK_RUN (1<<9)
|
||||
#define PMF_VIEW_JUMP_START (1<<10)
|
||||
#define PMF_LEVELEXIT (1<<11)
|
||||
#define PMF_NO_GRAVITY (1<<12)
|
||||
#define PMF_NO_HUD (1<<13)
|
||||
#define PMF_UNKNOWN (1<<14)
|
||||
|
||||
#else
|
||||
|
||||
// moh pm_flags
|
||||
#define PMF_DUCKED (1<<0)
|
||||
#define PMF_VIEW_PRONE (1<<1)
|
||||
@@ -249,6 +305,8 @@ typedef enum {
|
||||
#define PMF_NO_HUD (1<<15)
|
||||
#define PMF_UNKNOWN (1<<16)
|
||||
|
||||
#endif
|
||||
|
||||
// moveposflags
|
||||
#define MPF_POSITION_STANDING (1<<0)
|
||||
#define MPF_POSITION_CROUCHING (1<<1)
|
||||
@@ -395,6 +453,12 @@ typedef enum {
|
||||
#define EF_AXIS 0x00000100 // su44: this player is in axis team
|
||||
#define EF_ANY_TEAM (EF_ALLIES | EF_AXIS)
|
||||
#define EF_DEAD 0x00000200 // don't draw a foe marker over players with EF_DEAD
|
||||
//
|
||||
// Team assault flags
|
||||
//
|
||||
#define EF_PLAYER_IN_MENU 0x00000400 // Player is in menu
|
||||
#define EF_PLAYER_TALKING 0x00000800 // Player is talking
|
||||
#define EF_PLAYER_ARTILLERY 0x00002000 // Player is using an artillery
|
||||
|
||||
|
||||
// su44: q3 remnants
|
||||
@@ -528,6 +592,15 @@ extern const char *means_of_death_strings[];
|
||||
#define DF_NO_DROP_WEAPONS (1<<16)
|
||||
#define DF_NO_FOOTSTEPS (1<<17)
|
||||
|
||||
#define DF_WEAPON_LANDMINE_ALWAYS (1<<21)
|
||||
#define DF_WEAPON_NO_RIFLE (1<<22)
|
||||
#define DF_WEAPON_NO_SNIPER (1<<23)
|
||||
#define DF_WEAPON_NO_SMG (1<<24)
|
||||
#define DF_WEAPON_NO_MG (1<<25)
|
||||
#define DF_WEAPON_NO_ROCKET (1<<26)
|
||||
#define DF_WEAPON_NO_SHOTGUN (1<<27)
|
||||
#define DF_WEAPON_NO_LANDMINE (1<<28)
|
||||
|
||||
#define DM_FLAG( flag ) ( g_gametype->integer && ( ( int )dmflags->integer & ( flag ) ) )
|
||||
|
||||
// content masks
|
||||
@@ -612,7 +685,49 @@ typedef enum {
|
||||
void BG_EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t result );
|
||||
|
||||
void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean snap );
|
||||
void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s, int time, qboolean snap );
|
||||
void BG_PlayerStateToEntityStateExtraPolate(playerState_t* ps, entityState_t* s, int time, qboolean snap);
|
||||
|
||||
#if TARGET_GAME_PROTOCOL >= 15
|
||||
|
||||
enum vmAnim_e {
|
||||
VM_ANIM_DISABLED,
|
||||
VM_ANIM_IDLE,
|
||||
VM_ANIM_CHARGE,
|
||||
VM_ANIM_FIRE,
|
||||
VM_ANIM_FIRE_SECONDARY,
|
||||
VM_ANIM_RECHAMBER,
|
||||
VM_ANIM_RELOAD,
|
||||
VM_ANIM_RELOAD_SINGLE,
|
||||
VM_ANIM_RELOAD_END,
|
||||
VM_ANIM_PULLOUT,
|
||||
VM_ANIM_PUTAWAY,
|
||||
VM_ANIM_LADDERSTEP,
|
||||
VM_ANIM_IDLE_0,
|
||||
VM_ANIM_IDLE_1,
|
||||
VM_ANIM_IDLE_2,
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
enum vmAnim_e {
|
||||
VM_ANIM_IDLE,
|
||||
VM_ANIM_CHARGE,
|
||||
VM_ANIM_FIRE,
|
||||
VM_ANIM_FIRE_SECONDARY,
|
||||
VM_ANIM_RECHAMBER,
|
||||
VM_ANIM_RELOAD,
|
||||
VM_ANIM_RELOAD_SINGLE,
|
||||
VM_ANIM_RELOAD_END,
|
||||
VM_ANIM_PULLOUT,
|
||||
VM_ANIM_PUTAWAY,
|
||||
VM_ANIM_LADDERSTEP,
|
||||
VM_ANIM_IDLE_0,
|
||||
VM_ANIM_IDLE_1,
|
||||
VM_ANIM_IDLE_2,
|
||||
VM_ANIM_DISABLED,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ void State::ParseAndProcessCommand
|
||||
{
|
||||
int argc;
|
||||
const char *argv[ MAX_COMMANDS ];
|
||||
char args[ MAX_COMMANDS ][ MAXTOKEN ];
|
||||
char args[ MAX_COMMANDS ][ SCRIPT_MAXTOKEN ];
|
||||
Script script;
|
||||
Event *event;
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ typedef struct gameImport_s
|
||||
void ( *AddCommand )( const char *cmdName, xcommand_t cmdFunction );
|
||||
int ( *FS_ReadFile )( const char *qpath, void **buffer, qboolean quiet );
|
||||
void ( *FS_FreeFile )( void *buffer );
|
||||
size_t( *FS_WriteFile )( const char *qpath, const void *buffer, size_t size );
|
||||
int ( *FS_WriteFile )( const char *qpath, const void *buffer, int size );
|
||||
fileHandle_t ( *FS_FOpenFileWrite )( const char *fileName );
|
||||
fileHandle_t ( *FS_FOpenFileAppend )( const char *fileName );
|
||||
const char *( *FS_PrepFileWrite )( const char *fileName );
|
||||
|
||||
@@ -3666,6 +3666,49 @@ qboolean Player::checkimmediateswitch( Conditional &condition )
|
||||
return ( g_gametype->integer && g_immediateswitch->integer );
|
||||
}
|
||||
|
||||
|
||||
qboolean Player::checkmovementspeed(Conditional& condition)
|
||||
{
|
||||
int speed = atoi(condition.getParm(1));
|
||||
return client->ps.speed >= speed;
|
||||
}
|
||||
|
||||
qboolean Player::checkabletodefuse(Conditional& condition)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
return true;
|
||||
}
|
||||
|
||||
qboolean Player::checkonlandmine(Conditional& condition)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
return false;
|
||||
}
|
||||
|
||||
qboolean Player::checknearlandmine(Conditional& condition)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
return false;
|
||||
}
|
||||
|
||||
qboolean Player::CondCanPlaceLandmine(Conditional& condition)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
return false;
|
||||
}
|
||||
|
||||
qboolean Player::CondWeaponCurrentFireAnim(Conditional& condition)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
return false;
|
||||
}
|
||||
|
||||
qboolean Player::CondVehicleType(Conditional& condition)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
return false;
|
||||
}
|
||||
|
||||
qboolean Player::CondAnimDoneVM( Conditional &condition )
|
||||
{
|
||||
return animDoneVM;
|
||||
@@ -4024,6 +4067,13 @@ Condition<Player> Player::Conditions[] =
|
||||
{ "MIN_CHARGE_TIME_MET", &Player::checkminchargetimemet },
|
||||
{ "MAX_CHARGE_TIME_MET", &Player::checkmaxchargetimemet },
|
||||
{ "IMMEDIATE_SWITCH", &Player::checkimmediateswitch },
|
||||
{ "CHECK_MOVEMENT_SPEED", &Player::checkmovementspeed },
|
||||
{ "ABLE_TO_DEFUSE", &Player::checkabletodefuse },
|
||||
{ "ON_LANDMINE", &Player::checkonlandmine },
|
||||
{ "NEAR_LANDMINE", &Player::checknearlandmine },
|
||||
{ "CAN_PLACE_LANDMINE", &Player::CondCanPlaceLandmine },
|
||||
{ "WEAPON_CURRENT_FIRE_ANIM", &Player::CondWeaponCurrentFireAnim },
|
||||
{ "VEHICLE_TYPE", &Player::CondVehicleType },
|
||||
{ "ANIMDONE_VM", &Player::CondAnimDoneVM },
|
||||
{ "CLIENT_COMMAND", &Player::CondClientCommand },
|
||||
{ "IS_VM_ANIM", &Player::CondVMAnim },
|
||||
|
||||
@@ -443,6 +443,13 @@ public:
|
||||
qboolean checkminchargetimemet( Conditional &condition );
|
||||
qboolean checkmaxchargetimemet( Conditional &condition );
|
||||
qboolean checkimmediateswitch( Conditional &condition );
|
||||
qboolean checkmovementspeed( Conditional &condition );
|
||||
qboolean checkabletodefuse( Conditional &condition );
|
||||
qboolean checkonlandmine( Conditional &condition );
|
||||
qboolean checknearlandmine( Conditional &condition );
|
||||
qboolean CondCanPlaceLandmine( Conditional &condition );
|
||||
qboolean CondWeaponCurrentFireAnim( Conditional &condition );
|
||||
qboolean CondVehicleType( Conditional &condition );
|
||||
qboolean CondAnimDoneVM( Conditional &condition );
|
||||
qboolean CondClientCommand( Conditional &condition );
|
||||
qboolean CondVMAnim( Conditional &condition );
|
||||
|
||||
+97
-159
@@ -200,168 +200,109 @@ void Alias_ListAddParms(AliasListNode_t* node, const char* parameters)
|
||||
return;
|
||||
}
|
||||
|
||||
while (1)
|
||||
for (;;)
|
||||
{
|
||||
while (1)
|
||||
token = nptr = COM_GetToken((char**)¶meters, qtrue);
|
||||
if (!token || !token[0])
|
||||
{
|
||||
while (1)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!Q_stricmp(token, "stop"))
|
||||
{
|
||||
node->stop_flag = 1;
|
||||
}
|
||||
else if (!Q_stricmp(token, "soundparms"))
|
||||
{
|
||||
node->volume = getTokenFloat(¶meters, "volume", node);
|
||||
node->volumeMod = getTokenFloat(¶meters, "volumeMod", node);
|
||||
node->pitch = getTokenFloat(¶meters, "pitch", node);
|
||||
node->pitchMod = getTokenFloat(¶meters, "pitchMod", node);
|
||||
node->dist = getTokenFloat(¶meters, "dist", node);
|
||||
node->maxDist = getTokenFloat(¶meters, "maxDist", node);
|
||||
|
||||
token = COM_GetToken((char**)¶meters, qtrue);
|
||||
if (!token || !*token)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
token = nptr = COM_GetToken((char**)¶meters, qtrue);
|
||||
if (!token || !*token)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Q_stricmp(nptr, "weight"))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
node->stop_flag = 1;
|
||||
}
|
||||
|
||||
if (Q_stricmp(nptr, "weight"))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
token = COM_GetToken((char**)¶meters, 1);
|
||||
if (!token || !*token)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
temp_float = atof(token);
|
||||
|
||||
if (temp_float < 0.0f)
|
||||
{
|
||||
Com_Printf("Weight value out of range in %s alias\n", node->alias_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
node->weight = temp_float;
|
||||
}
|
||||
|
||||
if (Q_stricmp(nptr, "soundparms"))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
node->volume = getTokenFloat(¶meters, "volume", node);
|
||||
node->volumeMod = getTokenFloat(¶meters, "volumeMod", node);
|
||||
node->pitch = getTokenFloat(¶meters, "pitch", node);
|
||||
node->pitchMod = getTokenFloat(¶meters, "pitchMod", node);
|
||||
node->dist = getTokenFloat(¶meters, "dist", node);
|
||||
node->maxDist = getTokenFloat(¶meters, "maxDist", node);
|
||||
|
||||
token = COM_GetToken((char**)¶meters, 1);
|
||||
if (!token || !*token)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
node->channel = S_ChannelNameToNum(token);
|
||||
if (node->channel == -1)
|
||||
{
|
||||
Com_Printf("%s is not avalid channel on %s alias.\n", token, node->alias_name);
|
||||
node->channel = 0;
|
||||
}
|
||||
|
||||
token = COM_GetToken((char**)¶meters, 1);
|
||||
if (!token || !*token)
|
||||
{
|
||||
Com_Printf("ERROR: defaulting %s to not streamed - please setup alias properly.\n", node->alias_name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Q_stricmp(token, "streamed"))
|
||||
{
|
||||
node->streamed = 1;
|
||||
}
|
||||
else if (!Q_stricmp(token, "loaded"))
|
||||
{
|
||||
node->streamed = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Com_Printf("ERROR: Expecting streamed or loaded in ubersound and got %s on alias %s\n", token, node->alias_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (Q_stricmp(nptr, "subtitle"))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
token = COM_GetToken((char**)¶meters, qtrue);
|
||||
if (!token || !*token)
|
||||
{
|
||||
Com_Printf("NULL subtitle on %s alias.\n", node->alias_name);
|
||||
return;
|
||||
}
|
||||
|
||||
node->subtitle = Z_TagMalloc(strlen(token) + 1, TAG_TIKI);
|
||||
strcpy(node->subtitle, token);
|
||||
}
|
||||
|
||||
if (Q_stricmp(nptr, "pitch"))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
token = COM_GetToken((char**)¶meters, qtrue);
|
||||
if (!token || !*token)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
temp_float = atof(token);
|
||||
if (temp_float < 0.0f)
|
||||
{
|
||||
Com_Printf("Pitch value out of range in %s alias\n", node->alias_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
node->pitch = temp_float;
|
||||
}
|
||||
|
||||
if (Q_stricmp(nptr, "pitchmod"))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
token = COM_GetToken((char**)¶meters, qtrue);
|
||||
if (!token || !*token)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
temp_float = atof(token);
|
||||
if (temp_float < 0.0f)
|
||||
{
|
||||
Com_Printf("PitchMod value out of range in %s alias\n", node->alias_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
node->pitchMod = temp_float;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Q_stricmp(nptr, "volumemod"))
|
||||
node->channel = S_ChannelNameToNum(token);
|
||||
if (node->channel == -1)
|
||||
{
|
||||
break;
|
||||
Com_Printf("%s is not avalid channel on %s alias.\n", token, node->alias_name);
|
||||
node->channel = 0;
|
||||
}
|
||||
|
||||
token = COM_GetToken((char**)¶meters, qtrue);
|
||||
if (!token || !*token)
|
||||
{
|
||||
Com_Printf("ERROR: defaulting %s to not streamed - please setup alias properly.\n", node->alias_name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Q_stricmp(token, "streamed"))
|
||||
{
|
||||
node->streamed = qtrue;
|
||||
}
|
||||
else if (!Q_stricmp(token, "loaded"))
|
||||
{
|
||||
node->streamed = qfalse;
|
||||
}
|
||||
else
|
||||
{
|
||||
Com_Printf("ERROR: Expecting streamed or loaded in ubersound and got %s on alias %s\n", token, node->alias_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (!Q_stricmp(token, "subtitle"))
|
||||
{
|
||||
token = COM_GetToken((char**)¶meters, qtrue);
|
||||
if (!token || !*token)
|
||||
{
|
||||
Com_Printf("NULL subtitle on %s alias.\n", node->alias_name);
|
||||
return;
|
||||
}
|
||||
|
||||
node->subtitle = Z_TagMalloc(strlen(token) + 1, TAG_TIKI);
|
||||
strcpy(node->subtitle, token);
|
||||
}
|
||||
else if (!Q_stricmp(token, "pitch"))
|
||||
{
|
||||
token = COM_GetToken((char**)¶meters, qtrue);
|
||||
if (!token || !*token)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
temp_float = atof(token);
|
||||
if (temp_float < 0.0f)
|
||||
{
|
||||
Com_Printf("Pitch value out of range in %s alias\n", node->alias_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
node->pitch = temp_float;
|
||||
}
|
||||
else if (!Q_stricmp(token, "pitchmod"))
|
||||
{
|
||||
token = COM_GetToken((char**)¶meters, qtrue);
|
||||
if (!token || !*token)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
temp_float = atof(token);
|
||||
if (temp_float < 0.0f)
|
||||
{
|
||||
Com_Printf("PitchMod value out of range in %s alias\n", node->alias_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
node->pitchMod = temp_float;
|
||||
}
|
||||
else if (!Q_stricmp(token, "volumemod"))
|
||||
{
|
||||
token = COM_GetToken((char**)¶meters, qtrue);
|
||||
if (!token || !*token)
|
||||
{
|
||||
@@ -377,8 +318,7 @@ void Alias_ListAddParms(AliasListNode_t* node, const char* parameters)
|
||||
|
||||
node->volumeMod = temp_float;
|
||||
}
|
||||
|
||||
if (!Q_stricmp(nptr, "dist"))
|
||||
else if (!Q_stricmp(token, "dist"))
|
||||
{
|
||||
token = COM_GetToken((char**)¶meters, qtrue);
|
||||
if (!token || !*token)
|
||||
@@ -396,7 +336,7 @@ void Alias_ListAddParms(AliasListNode_t* node, const char* parameters)
|
||||
|
||||
node->dist = temp_float;
|
||||
}
|
||||
else if (!Q_stricmp(nptr, "channel"))
|
||||
else if (!Q_stricmp(token, "channel"))
|
||||
{
|
||||
token = COM_GetToken((char**)¶meters, qtrue);
|
||||
if (!token || !*token)
|
||||
@@ -418,8 +358,6 @@ void Alias_ListAddParms(AliasListNode_t* node, const char* parameters)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: stub
|
||||
}
|
||||
|
||||
qboolean Alias_ListAdd(AliasList_t* list, const char* alias, const char* name, const char* parameters)
|
||||
|
||||
@@ -882,9 +882,9 @@ void CM_LoadMap( const char *name, qboolean clientload, int *checksum ) {
|
||||
((int *)&header)[i] = LittleLong ( ((int *)&header)[i]);
|
||||
}
|
||||
|
||||
if ( header.version != BSP_VERSION ) {
|
||||
Com_Error (ERR_DROP, "CM_LoadMap: %s has wrong version number (%i should be %i)"
|
||||
, name, header.version, BSP_VERSION );
|
||||
if ( header.version < BSP_MIN_VERSION || header.version > BSP_MAX_VERSION ) {
|
||||
Com_Error (ERR_DROP, "CM_LoadMap: %s has wrong version number (%i should be between %i and %i)"
|
||||
, name, header.version, BSP_MIN_VERSION, BSP_MAX_VERSION );
|
||||
}
|
||||
|
||||
cmod_base = ( byte * )&header;
|
||||
|
||||
+12
-6
@@ -3068,7 +3068,7 @@ static void FS_ReorderPurePaks( void )
|
||||
FS_Startup
|
||||
================
|
||||
*/
|
||||
static void FS_Startup( const char *gameName )
|
||||
static void FS_Startup(const char* gameName, const char* extensionName)
|
||||
{
|
||||
const char* homePath;
|
||||
|
||||
@@ -3087,10 +3087,16 @@ static void FS_Startup( const char *gameName )
|
||||
fs_gamedirvar = Cvar_Get( "fs_game", "", CVAR_INIT | CVAR_SYSTEMINFO );
|
||||
fs_restrict = Cvar_Get( "fs_restrict", "", CVAR_INIT );
|
||||
|
||||
FS_AddGameDirectory( fs_basepath->string, gameName );
|
||||
if (gameName) {
|
||||
FS_AddGameDirectory(fs_basepath->string, gameName);
|
||||
}
|
||||
|
||||
if( *fs_gamedirvar->string && !Q_stricmp( gameName, "main" ) && Q_stricmp( fs_gamedirvar->string, gameName ) ) {
|
||||
FS_AddGameDirectory( fs_basepath->string, fs_gamedirvar->string );
|
||||
if (Q_stricmp(gameName, extensionName)) {
|
||||
FS_AddGameDirectory(fs_basepath->string, extensionName);
|
||||
}
|
||||
|
||||
if (*fs_gamedirvar->string && !Q_stricmp(gameName, GAME_EXTENSION_BASE) && Q_stricmp(fs_gamedirvar->string, gameName)) {
|
||||
FS_AddGameDirectory(fs_basepath->string, fs_gamedirvar->string);
|
||||
}
|
||||
|
||||
fs_mapdir = Cvar_Get( "mapdir", "", 0 );
|
||||
@@ -3594,7 +3600,7 @@ void FS_InitFilesystem( void ) {
|
||||
Com_StartupVariable( "fs_homepath" );
|
||||
|
||||
// try to start up normally
|
||||
FS_Startup( BASEGAME );
|
||||
FS_Startup( BASEGAME, GAME_EXTENSION_BASE);
|
||||
FS_SetRestrictions();
|
||||
|
||||
if( !silentStart ) {
|
||||
@@ -3640,7 +3646,7 @@ void FS_Restart( int checksumFeed ) {
|
||||
FS_ClearPakReferences(0);
|
||||
|
||||
// try to start up normally
|
||||
FS_Startup( BASEGAME );
|
||||
FS_Startup(BASEGAME, GAME_EXTENSION_BASE);
|
||||
|
||||
FS_CheckPak0( );
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ void* MEM_TempAlloc::CreateBlock(size_t len)
|
||||
// allocate a new block
|
||||
tempBlock_t* prev_block = m_CurrentMemoryBlock;
|
||||
m_CurrentMemoryBlock = (tempBlock_t*)MEM_TempAllocate(
|
||||
sizeof(tempBlock_t) + max(m_BlockSize, len));
|
||||
sizeof(tempBlock_t) + Q_max(m_BlockSize, len));
|
||||
m_CurrentMemoryBlock->prev = prev_block;
|
||||
return m_CurrentMemoryBlock->GetData();
|
||||
}
|
||||
|
||||
+542
-183
@@ -32,10 +32,10 @@ int oldsize = 0;
|
||||
// TA stuff
|
||||
//===================
|
||||
|
||||
static constexpr unsigned int MAX_PACKED_COORD = 65536;
|
||||
static constexpr unsigned int MAX_PACKED_COORD_HALF = MAX_PACKED_COORD / 2;
|
||||
static constexpr unsigned int MAX_PACKED_COORD_EXTRA = 262144;
|
||||
static constexpr unsigned int MAX_PACKED_COORD_EXTRA_HALF = MAX_PACKED_COORD_EXTRA / 2;
|
||||
static constexpr int MAX_PACKED_COORD = 65536;
|
||||
static constexpr int MAX_PACKED_COORD_HALF = MAX_PACKED_COORD / 2;
|
||||
static constexpr int MAX_PACKED_COORD_EXTRA = 262144;
|
||||
static constexpr int MAX_PACKED_COORD_EXTRA_HALF = MAX_PACKED_COORD_EXTRA / 2;
|
||||
|
||||
//===
|
||||
// Statistics for changes reporting
|
||||
@@ -326,11 +326,21 @@ int MSG_ReadBits( msg_t *msg, int bits ) {
|
||||
}
|
||||
msg->readcount = (msg->bit>>3)+1;
|
||||
}
|
||||
#if TARGET_GAME_PROTOCOL >= 15
|
||||
if (sgn) {
|
||||
if (value & 1) {
|
||||
value = ~(value >> 1);
|
||||
} else {
|
||||
value >>= 1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (sgn) {
|
||||
if (value & (1 << (bits - 1))) {
|
||||
value |= -1 ^ ((1 << bits) - 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return value;
|
||||
}
|
||||
@@ -417,6 +427,32 @@ void MSG_WriteString( msg_t *sb, const char *s ) {
|
||||
}
|
||||
}
|
||||
|
||||
void MSG_WriteBigString( msg_t *sb, const char *s ) {
|
||||
if ( !s ) {
|
||||
MSG_WriteByte(sb, 0);
|
||||
} else {
|
||||
size_t l;
|
||||
int i;
|
||||
char string[BIG_INFO_STRING];
|
||||
|
||||
l = strlen( s );
|
||||
if ( l >= BIG_INFO_STRING ) {
|
||||
Com_Printf("MSG_WriteString: BIG_INFO_STRING");
|
||||
MSG_WriteByte(sb, 0);
|
||||
return;
|
||||
}
|
||||
Q_strncpyz( string, s, sizeof( string ) );
|
||||
|
||||
for ( i = 0 ; i <= l ; i++ ) {
|
||||
MSG_WriteByte(sb, string[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if TARGET_GAME_PROTOCOL >= 15
|
||||
|
||||
void MSG_WriteScrambledString(msg_t* sb, const char* s) {
|
||||
if (!s) {
|
||||
strstats[0]++;
|
||||
@@ -444,28 +480,6 @@ void MSG_WriteScrambledString(msg_t* sb, const char* s) {
|
||||
}
|
||||
}
|
||||
|
||||
void MSG_WriteBigString( msg_t *sb, const char *s ) {
|
||||
if ( !s ) {
|
||||
MSG_WriteByte(sb, 0);
|
||||
} else {
|
||||
size_t l;
|
||||
int i;
|
||||
char string[BIG_INFO_STRING];
|
||||
|
||||
l = strlen( s );
|
||||
if ( l >= BIG_INFO_STRING ) {
|
||||
Com_Printf("MSG_WriteString: BIG_INFO_STRING");
|
||||
MSG_WriteByte(sb, 0);
|
||||
return;
|
||||
}
|
||||
Q_strncpyz( string, s, sizeof( string ) );
|
||||
|
||||
for ( i = 0 ; i <= l ; i++ ) {
|
||||
MSG_WriteByte(sb, string[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MSG_WriteScrambledBigString(msg_t* sb, const char* s) {
|
||||
if (!s) {
|
||||
strstats[0]++;
|
||||
@@ -493,6 +507,18 @@ void MSG_WriteScrambledBigString(msg_t* sb, const char* s) {
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void MSG_WriteScrambledString(msg_t* sb, const char* s) {
|
||||
return MSG_WriteString(sb, s);
|
||||
}
|
||||
|
||||
void MSG_WriteScrambledBigString(msg_t* sb, const char* s) {
|
||||
return MSG_WriteBigString(sb, s);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void MSG_WriteAngle( msg_t *sb, float f ) {
|
||||
MSG_WriteByte (sb, (int)(f*256/360) & 255);
|
||||
}
|
||||
@@ -598,6 +624,8 @@ float MSG_ReadFloat( msg_t *msg ) {
|
||||
return dat.f;
|
||||
}
|
||||
|
||||
#if TARGET_GAME_PROTOCOL >= 15
|
||||
|
||||
char* MSG_ReadScrambledString(msg_t* msg) {
|
||||
static char string[MAX_STRING_CHARS];
|
||||
int l, c;
|
||||
@@ -610,6 +638,9 @@ char* MSG_ReadScrambledString(msg_t* msg) {
|
||||
}
|
||||
|
||||
c = NetByteToStrChar[c];
|
||||
if (!c) {
|
||||
break;
|
||||
}
|
||||
// translate all fmt spec to avoid crash bugs
|
||||
if (c == '%') {
|
||||
c = '.';
|
||||
@@ -629,6 +660,52 @@ char* MSG_ReadScrambledString(msg_t* msg) {
|
||||
return string;
|
||||
}
|
||||
|
||||
char* MSG_ReadScrambledBigString(msg_t* msg) {
|
||||
static char string[BIG_INFO_STRING];
|
||||
int l, c;
|
||||
|
||||
l = 0;
|
||||
do {
|
||||
c = MSG_ReadByte(msg); // use ReadByte so -1 is out of bounds
|
||||
if (c == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
c = NetByteToStrChar[c];
|
||||
if (!c) {
|
||||
break;
|
||||
}
|
||||
// translate all fmt spec to avoid crash bugs
|
||||
if (c == '%') {
|
||||
c = '.';
|
||||
}
|
||||
// don't allow higher ascii values
|
||||
// (su44: this check is missing in MoHAA)
|
||||
if (c > 127) {
|
||||
c = '.';
|
||||
}
|
||||
|
||||
string[l] = c;
|
||||
l++;
|
||||
} while (l < sizeof(string) - 1);
|
||||
|
||||
string[l] = 0;
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
char* MSG_ReadScrambledString(msg_t* msg) {
|
||||
return MSG_ReadString(msg);
|
||||
}
|
||||
|
||||
char* MSG_ReadScrambledBigString(msg_t* msg) {
|
||||
return MSG_ReadBigString(msg);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
char *MSG_ReadString( msg_t *msg ) {
|
||||
static char string[MAX_STRING_CHARS];
|
||||
int l,c;
|
||||
@@ -721,7 +798,6 @@ void MSG_GetNullEntityState(entityState_t *nullState) {
|
||||
nullState->alpha = 1.0f;
|
||||
nullState->scale = 1.0f;
|
||||
nullState->parent = ENTITYNUM_NONE;
|
||||
nullState->tag_num = -1; // su44
|
||||
nullState->constantLight = 0xffffff;
|
||||
nullState->renderfx = 16;
|
||||
nullState->bone_tag[4] = -1;
|
||||
@@ -1171,6 +1247,157 @@ typedef struct {
|
||||
// using the stringizing operator to save typing...
|
||||
#define NETF(x) #x,(size_t)&((entityState_t*)0)->x
|
||||
|
||||
#if TARGET_GAME_PROTOCOL >= 15
|
||||
netField_t entityStateFields[] =
|
||||
{
|
||||
{ NETF(netorigin[0]), 0, netFieldType_t::coord },
|
||||
{ NETF(netorigin[1]), 0, netFieldType_t::coord },
|
||||
{ NETF(netangles[1]), 12, netFieldType_t::angle },
|
||||
{ NETF(frameInfo[0].time), 15, netFieldType_t::animTime },
|
||||
{ NETF(frameInfo[1].time), 15, netFieldType_t::animTime },
|
||||
{ NETF(bone_angles[0][0]), -13, netFieldType_t::angle },
|
||||
{ NETF(bone_angles[3][0]), -13, netFieldType_t::angle },
|
||||
{ NETF(bone_angles[1][0]), -13, netFieldType_t::angle },
|
||||
{ NETF(bone_angles[2][0]), -13, netFieldType_t::angle },
|
||||
{ NETF(netorigin[2]), 0, netFieldType_t::coord },
|
||||
{ NETF(frameInfo[0].weight), 8, netFieldType_t::animWeight },
|
||||
{ NETF(frameInfo[1].weight), 8, netFieldType_t::animWeight },
|
||||
{ NETF(frameInfo[2].time), 15, netFieldType_t::animTime },
|
||||
{ NETF(frameInfo[3].time), 15, netFieldType_t::animTime },
|
||||
{ NETF(frameInfo[0].index), 12, netFieldType_t::regular },
|
||||
{ NETF(frameInfo[1].index), 12, netFieldType_t::regular },
|
||||
{ NETF(actionWeight), 8, netFieldType_t::animWeight },
|
||||
{ NETF(frameInfo[2].weight), 8, netFieldType_t::animWeight },
|
||||
{ NETF(frameInfo[3].weight), 8, netFieldType_t::animWeight },
|
||||
{ NETF(frameInfo[2].index), 12, netFieldType_t::regular },
|
||||
{ NETF(frameInfo[3].index), 12, netFieldType_t::regular },
|
||||
{ NETF(eType), 8, netFieldType_t::regular },
|
||||
{ NETF(modelindex), 16, netFieldType_t::regular },
|
||||
{ NETF(parent), 16, netFieldType_t::regular },
|
||||
{ NETF(constantLight), 32, netFieldType_t::regular },
|
||||
{ NETF(renderfx), 32, netFieldType_t::regular },
|
||||
{ NETF(bone_tag[0]), -8, netFieldType_t::regular },
|
||||
{ NETF(bone_tag[1]), -8, netFieldType_t::regular },
|
||||
{ NETF(bone_tag[2]), -8, netFieldType_t::regular },
|
||||
{ NETF(bone_tag[3]), -8, netFieldType_t::regular },
|
||||
{ NETF(bone_tag[4]), -8, netFieldType_t::regular },
|
||||
{ NETF(scale), 10, netFieldType_t::scale },
|
||||
{ NETF(alpha), 8, netFieldType_t::alpha },
|
||||
{ NETF(usageIndex), 16, netFieldType_t::regular },
|
||||
{ NETF(eFlags), 16, netFieldType_t::regular },
|
||||
{ NETF(solid), 32, netFieldType_t::regular },
|
||||
{ NETF(netangles[2]), 12, netFieldType_t::angle },
|
||||
{ NETF(netangles[0]), 12, netFieldType_t::angle },
|
||||
{ NETF(tag_num), 10, netFieldType_t::regular },
|
||||
{ NETF(bone_angles[1][2]), -13, netFieldType_t::angle },
|
||||
{ NETF(attach_use_angles), 1, netFieldType_t::regular },
|
||||
{ NETF(origin2[1]), 0, netFieldType_t::coord },
|
||||
{ NETF(origin2[0]), 0, netFieldType_t::coord },
|
||||
{ NETF(origin2[2]), 0, netFieldType_t::coord },
|
||||
{ NETF(bone_angles[0][2]), -13, netFieldType_t::angle },
|
||||
{ NETF(bone_angles[2][2]), -13, netFieldType_t::angle },
|
||||
{ NETF(bone_angles[3][2]), -13, netFieldType_t::angle },
|
||||
{ NETF(surfaces[0]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[1]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[2]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[3]), 8, netFieldType_t::regular },
|
||||
{ NETF(bone_angles[0][1]), -13, netFieldType_t::angle },
|
||||
{ NETF(surfaces[4]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[5]), 8, netFieldType_t::regular },
|
||||
{ NETF(pos.trTime), 32, netFieldType_t::regular },
|
||||
{ NETF(pos.trDelta[0]), 0, netFieldType_t::velocity },
|
||||
{ NETF(pos.trDelta[1]), 0, netFieldType_t::velocity },
|
||||
{ NETF(pos.trDelta[2]), 0, netFieldType_t::velocity },
|
||||
{ NETF(loopSound), 16, netFieldType_t::regular },
|
||||
{ NETF(loopSoundVolume), 0, netFieldType_t::regular },
|
||||
{ NETF(loopSoundMinDist), 0, netFieldType_t::regular },
|
||||
{ NETF(loopSoundMaxDist), 0, netFieldType_t::regular },
|
||||
{ NETF(loopSoundPitch), 0, netFieldType_t::regular },
|
||||
{ NETF(loopSoundFlags), 8, netFieldType_t::regular },
|
||||
{ NETF(attach_offset[0]), 0, netFieldType_t::regular },
|
||||
{ NETF(attach_offset[1]), 0, netFieldType_t::regular },
|
||||
{ NETF(attach_offset[2]), 0, netFieldType_t::regular },
|
||||
{ NETF(beam_entnum), 16, netFieldType_t::regular },
|
||||
{ NETF(skinNum), 16, netFieldType_t::regular },
|
||||
{ NETF(wasframe), 10, netFieldType_t::regular },
|
||||
{ NETF(frameInfo[4].index), 12, netFieldType_t::regular },
|
||||
{ NETF(frameInfo[5].index), 12, netFieldType_t::regular },
|
||||
{ NETF(frameInfo[6].index), 12, netFieldType_t::regular },
|
||||
{ NETF(frameInfo[7].index), 12, netFieldType_t::regular },
|
||||
{ NETF(frameInfo[8].index), 12, netFieldType_t::regular },
|
||||
{ NETF(frameInfo[9].index), 12, netFieldType_t::regular },
|
||||
{ NETF(frameInfo[10].index), 12, netFieldType_t::regular },
|
||||
{ NETF(frameInfo[11].index), 12, netFieldType_t::regular },
|
||||
{ NETF(frameInfo[12].index), 12, netFieldType_t::regular },
|
||||
{ NETF(frameInfo[13].index), 12, netFieldType_t::regular },
|
||||
{ NETF(frameInfo[14].index), 12, netFieldType_t::regular },
|
||||
{ NETF(frameInfo[15].index), 12, netFieldType_t::regular },
|
||||
{ NETF(frameInfo[4].time), 15, netFieldType_t::animTime },
|
||||
{ NETF(frameInfo[5].time), 15, netFieldType_t::animTime },
|
||||
{ NETF(frameInfo[6].time), 15, netFieldType_t::animTime },
|
||||
{ NETF(frameInfo[7].time), 15, netFieldType_t::animTime },
|
||||
{ NETF(frameInfo[8].time), 15, netFieldType_t::animTime },
|
||||
{ NETF(frameInfo[9].time), 15, netFieldType_t::animTime },
|
||||
{ NETF(frameInfo[10].time), 15, netFieldType_t::animTime },
|
||||
{ NETF(frameInfo[11].time), 15, netFieldType_t::animTime },
|
||||
{ NETF(frameInfo[12].time), 15, netFieldType_t::animTime },
|
||||
{ NETF(frameInfo[13].time), 15, netFieldType_t::animTime },
|
||||
{ NETF(frameInfo[14].time), 15, netFieldType_t::animTime },
|
||||
{ NETF(frameInfo[15].time), 15, netFieldType_t::animTime },
|
||||
{ NETF(frameInfo[4].weight), 8, netFieldType_t::animWeight },
|
||||
{ NETF(frameInfo[5].weight), 8, netFieldType_t::animWeight },
|
||||
{ NETF(frameInfo[6].weight), 8, netFieldType_t::animWeight },
|
||||
{ NETF(frameInfo[7].weight), 8, netFieldType_t::animWeight },
|
||||
{ NETF(frameInfo[8].weight), 8, netFieldType_t::animWeight },
|
||||
{ NETF(frameInfo[9].weight), 8, netFieldType_t::animWeight },
|
||||
{ NETF(frameInfo[10].weight), 8, netFieldType_t::animWeight },
|
||||
{ NETF(frameInfo[11].weight), 8, netFieldType_t::animWeight },
|
||||
{ NETF(frameInfo[12].weight), 8, netFieldType_t::animWeight },
|
||||
{ NETF(frameInfo[13].weight), 8, netFieldType_t::animWeight },
|
||||
{ NETF(frameInfo[14].weight), 8, netFieldType_t::animWeight },
|
||||
{ NETF(frameInfo[15].weight), 8, netFieldType_t::animWeight },
|
||||
{ NETF(bone_angles[1][1]), -13, netFieldType_t::angle },
|
||||
{ NETF(bone_angles[2][1]), -13, netFieldType_t::angle },
|
||||
{ NETF(bone_angles[3][1]), -13, netFieldType_t::angle },
|
||||
{ NETF(bone_angles[4][0]), -13, netFieldType_t::angle },
|
||||
{ NETF(bone_angles[4][1]), -13, netFieldType_t::angle },
|
||||
{ NETF(bone_angles[4][2]), -13, netFieldType_t::angle },
|
||||
{ NETF(clientNum), 8, netFieldType_t::regular },
|
||||
{ NETF(groundEntityNum), GENTITYNUM_BITS, netFieldType_t::regular },
|
||||
{ NETF(shader_data[0]), 0, netFieldType_t::regular },
|
||||
{ NETF(shader_data[1]), 0, netFieldType_t::regular },
|
||||
{ NETF(shader_time), 0, netFieldType_t::regular },
|
||||
{ NETF(eyeVector[0]), 0, netFieldType_t::regular },
|
||||
{ NETF(eyeVector[1]), 0, netFieldType_t::regular },
|
||||
{ NETF(eyeVector[2]), 0, netFieldType_t::regular },
|
||||
{ NETF(surfaces[6]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[7]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[8]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[9]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[10]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[11]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[12]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[13]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[14]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[15]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[16]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[17]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[18]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[19]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[20]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[21]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[22]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[23]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[24]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[25]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[26]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[27]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[28]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[29]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[30]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[31]), 8, netFieldType_t::regular }
|
||||
};
|
||||
#else
|
||||
netField_t entityStateFields[] =
|
||||
{
|
||||
{ NETF(netorigin[0]), 0, netFieldType_t::coord },
|
||||
@@ -1320,6 +1547,7 @@ netField_t entityStateFields[] =
|
||||
{ NETF(surfaces[30]), 8, netFieldType_t::regular },
|
||||
{ NETF(surfaces[31]), 8, netFieldType_t::regular }
|
||||
};
|
||||
#endif
|
||||
static constexpr unsigned long numEntityFields = sizeof(entityStateFields) / sizeof(entityStateFields[0]);
|
||||
|
||||
// if (int)f == f and (int)f + ( 1<<(FLOAT_INT_BITS-1) ) < ( 1 << FLOAT_INT_BITS )
|
||||
@@ -1343,22 +1571,25 @@ void MSG_ReadRegular(msg_t* sb, int bits, void* toF)
|
||||
if (!MSG_ReadBits(sb, 1))
|
||||
{
|
||||
// integral float
|
||||
int32_t truncFloat = MSG_ReadBits(sb, -FLOAT_INT_BITS);
|
||||
// bias to allow equal parts positive and negative
|
||||
truncFloat -= FLOAT_INT_BIAS;
|
||||
*(float*)toF = (float)truncFloat;
|
||||
*(float*)toF = MSG_ReadBits(sb, -FLOAT_INT_BITS);
|
||||
}
|
||||
else
|
||||
{
|
||||
// full floating point value
|
||||
*(float*)toF = MSG_ReadFloat(sb);
|
||||
unsigned int v = MSG_ReadBits(sb, 32);
|
||||
if (v & 1) {
|
||||
*(int*)toF = ((v + 0x7A000000) >> 1) | 0x80000000;
|
||||
}
|
||||
else {
|
||||
*(int*)toF = (v + 0x7A000000) >> 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MSG_ReadBits(msg, 1)) {
|
||||
*(int*)toF = MSG_ReadBits(msg, bits);
|
||||
if (MSG_ReadBits(sb, 1)) {
|
||||
*(int*)toF = MSG_ReadBits(sb, bits);
|
||||
}
|
||||
else {
|
||||
*(int*)toF = 0;
|
||||
@@ -1366,6 +1597,11 @@ void MSG_ReadRegular(msg_t* sb, int bits, void* toF)
|
||||
}
|
||||
}
|
||||
|
||||
void MSG_ReadRegularSimple(msg_t* sb, int bits, void* toF)
|
||||
{
|
||||
MSG_ReadRegular(sb, bits, toF);
|
||||
}
|
||||
|
||||
void MSG_WriteRegular(msg_t* sb, int bits, const void* toF)
|
||||
{
|
||||
float fullFloat;
|
||||
@@ -1382,16 +1618,19 @@ void MSG_WriteRegular(msg_t* sb, int bits, const void* toF)
|
||||
}
|
||||
else {
|
||||
MSG_WriteBits(sb, 1, 1);
|
||||
if (trunc == fullFloat && trunc + FLOAT_INT_BIAS >= 0 &&
|
||||
trunc + FLOAT_INT_BIAS < (1 << FLOAT_INT_BITS)) {
|
||||
if (trunc == fullFloat && trunc >= -4096 && trunc < 4096) {
|
||||
// send as small integer
|
||||
MSG_WriteBits(sb, 0, 1);
|
||||
MSG_WriteBits(sb, trunc + FLOAT_INT_BIAS, FLOAT_INT_BITS);
|
||||
MSG_WriteBits(sb, trunc, -FLOAT_INT_BITS);
|
||||
}
|
||||
else {
|
||||
// send as full floating point value
|
||||
int newvalue = *(int*)toF * 2 - 0x7A000000;
|
||||
if (*(int*)toF < 0) {
|
||||
newvalue |= 1;
|
||||
}
|
||||
MSG_WriteBits(sb, 1, 1);
|
||||
MSG_WriteBits(sb, *(int*)toF, 32);
|
||||
// send as full floating point value
|
||||
MSG_WriteBits(sb, newvalue, 32);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1418,9 +1657,9 @@ void MSG_WriteEntityNum(msg_t* sb, short number)
|
||||
MSG_WriteBits(sb, (number + 1) % MAX_GENTITIES, GENTITYNUM_BITS);
|
||||
}
|
||||
|
||||
short MSG_ReadEntityNum(msg_t* sb)
|
||||
unsigned short MSG_ReadEntityNum(msg_t* sb)
|
||||
{
|
||||
return (MSG_ReadBits(sb, GENTITYNUM_BITS) - 1) % MAX_GENTITIES;
|
||||
return (unsigned short)(MSG_ReadBits(sb, GENTITYNUM_BITS) - 1) % MAX_GENTITIES;
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -1436,7 +1675,7 @@ void MSG_ReadRegular(msg_t* sb, int bits, void* toF)
|
||||
else
|
||||
{
|
||||
if (!MSG_ReadBits(sb, 1)) {
|
||||
*(float*)toF = (float)MSG_ReadBits(sb, FLOAT_INT_BITS);
|
||||
*(float*)toF = (int)MSG_ReadBits(sb, FLOAT_INT_BITS) - FLOAT_INT_BIAS;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1456,6 +1695,28 @@ void MSG_ReadRegular(msg_t* sb, int bits, void* toF)
|
||||
}
|
||||
}
|
||||
|
||||
void MSG_ReadRegularSimple(msg_t* sb, int bits, void* toF)
|
||||
{
|
||||
if (bits == 0) {
|
||||
// float
|
||||
if (MSG_ReadBits(sb, 1) == 0) {
|
||||
// integral float
|
||||
int trunc = MSG_ReadBits(sb, FLOAT_INT_BITS);
|
||||
// bias to allow equal parts positive and negative
|
||||
trunc -= FLOAT_INT_BIAS;
|
||||
*(float*)toF = trunc;
|
||||
}
|
||||
else {
|
||||
// full floating point value
|
||||
*(int*)toF = MSG_ReadBits(sb, 32);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// integer
|
||||
*(int*)toF = MSG_ReadBits(sb, bits);
|
||||
}
|
||||
}
|
||||
|
||||
void MSG_WriteRegular(msg_t* sb, int bits, const void* toF)
|
||||
{
|
||||
float fullFloat;
|
||||
@@ -1530,7 +1791,7 @@ void MSG_WriteEntityNum(msg_t* sb, short number)
|
||||
MSG_WriteBits(sb, number % MAX_GENTITIES, GENTITYNUM_BITS);
|
||||
}
|
||||
|
||||
short MSG_ReadEntityNum(msg_t* sb)
|
||||
unsigned short MSG_ReadEntityNum(msg_t* sb)
|
||||
{
|
||||
return MSG_ReadBits(sb, GENTITYNUM_BITS) % MAX_GENTITIES;
|
||||
}
|
||||
@@ -1568,7 +1829,7 @@ void MSG_WriteDeltaEntity( msg_t *msg, struct entityState_s *from, struct entity
|
||||
if ( from == NULL ) {
|
||||
return;
|
||||
}
|
||||
MSG_WriteBits( msg, from->number, GENTITYNUM_BITS );
|
||||
MSG_WriteEntityNum(msg, from->number);
|
||||
MSG_WriteBits( msg, 1, 1 );
|
||||
return;
|
||||
}
|
||||
@@ -1813,6 +2074,55 @@ int MSG_PackCoordExtra(float coord)
|
||||
|
||||
#if TARGET_GAME_PROTOCOL >= 15
|
||||
|
||||
float MSG_ReadPackedAngle(msg_t* msg, int bits)
|
||||
{
|
||||
int packed = MSG_ReadBits(msg, abs(bits));
|
||||
return MSG_UnpackAngle(packed, bits);
|
||||
}
|
||||
|
||||
float MSG_ReadPackedAnimTime(msg_t* msg, int bits, float fromValue, float frameTime)
|
||||
{
|
||||
int packed;
|
||||
if (!MSG_ReadBits(msg, 1)) {
|
||||
return fromValue + frameTime;
|
||||
}
|
||||
|
||||
packed = MSG_ReadBits(msg, bits);
|
||||
return MSG_UnpackAnimTime(packed);
|
||||
}
|
||||
|
||||
float MSG_ReadPackedAnimWeight(msg_t* msg, int bits)
|
||||
{
|
||||
int packed = MSG_ReadBits(msg, bits);
|
||||
return MSG_UnpackAnimWeight(packed, bits);
|
||||
}
|
||||
|
||||
float MSG_ReadPackedScale(msg_t* msg, int bits)
|
||||
{
|
||||
int packed = MSG_ReadBits(msg, bits);
|
||||
return MSG_UnpackScale(packed);
|
||||
}
|
||||
|
||||
float MSG_ReadPackedAlpha(msg_t* msg, int bits)
|
||||
{
|
||||
int packed = MSG_ReadBits(msg, bits);
|
||||
return MSG_UnpackAlpha(packed, bits);
|
||||
}
|
||||
|
||||
float MSG_ReadPackedCoord(msg_t* msg, float fromValue, int bits)
|
||||
{
|
||||
int packedFrom = MSG_PackCoord(fromValue);
|
||||
int packedTo = MSG_ReadDeltaCoord(msg, packedFrom);
|
||||
return MSG_UnpackCoord(packedTo, bits);
|
||||
}
|
||||
|
||||
float MSG_ReadPackedCoordExtra(msg_t* msg, float fromValue, int bits)
|
||||
{
|
||||
int packedFrom = MSG_PackCoordExtra(fromValue);
|
||||
int packedTo = MSG_ReadDeltaCoordExtra(msg, packedFrom);
|
||||
return MSG_UnpackCoordExtra(packedTo, bits);
|
||||
}
|
||||
|
||||
void MSG_WritePackedAngle(msg_t* msg, float value, int bits)
|
||||
{
|
||||
int packed = MSG_PackAngle(value, bits);
|
||||
@@ -1823,9 +2133,10 @@ void MSG_WritePackedAnimTime(msg_t* msg, float fromValue, float toValue, float f
|
||||
{
|
||||
int packed;
|
||||
|
||||
if (abs(fromValue - toValue) < frameTime) {
|
||||
if (fabs(fromValue - toValue) < frameTime) {
|
||||
// below the frame time, don't send
|
||||
MSG_WriteBits(msg, 0, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
MSG_WriteBits(msg, 1, 1);
|
||||
@@ -1923,6 +2234,80 @@ qboolean MSG_DeltaNeeded(const void* fromField, const void* toField, int fieldTy
|
||||
|
||||
#else
|
||||
|
||||
float MSG_ReadPackedAngle(msg_t* msg, int bits)
|
||||
{
|
||||
int result;
|
||||
float tmp = 1.0f;
|
||||
if (bits < 0) {
|
||||
if (MSG_ReadBits(msg, 1))
|
||||
tmp = -1.0f;
|
||||
bits = ~bits;
|
||||
}
|
||||
|
||||
result = MSG_ReadBits(msg, bits);
|
||||
switch (bits)
|
||||
{
|
||||
case 8:
|
||||
return tmp * 360.f / 256.f;
|
||||
case 12:
|
||||
return tmp * result * 360.f / 4096.f;
|
||||
case 16:
|
||||
return tmp * result * 360.f / 65536.f;
|
||||
default:
|
||||
return tmp * 360.f / (1 << bits) * result;
|
||||
}
|
||||
}
|
||||
|
||||
float MSG_ReadPackedAnimTime(msg_t* msg, int bits, float fromValue, float frameTime)
|
||||
{
|
||||
return MSG_ReadBits(msg, 15) / 100.0f;
|
||||
}
|
||||
|
||||
float MSG_ReadPackedAnimWeight(msg_t* msg, int bits)
|
||||
{
|
||||
float tmp = MSG_ReadBits(msg, 8) / 255.0f;
|
||||
if (tmp < 0.0f)
|
||||
return 0.0f;
|
||||
else if (tmp > 1.0f)
|
||||
return 1.0f;
|
||||
else
|
||||
return tmp;
|
||||
}
|
||||
|
||||
float MSG_ReadPackedScale(msg_t* msg, int bits)
|
||||
{
|
||||
return MSG_ReadBits(msg, 10) / 100.0f;
|
||||
}
|
||||
|
||||
float MSG_ReadPackedAlpha(msg_t* msg, int bits)
|
||||
{
|
||||
float tmp = MSG_ReadBits(msg, 8) / 255.0f;
|
||||
if (tmp < 0.0f)
|
||||
return 0.0f;
|
||||
else if (tmp > 1.0f)
|
||||
return 1.0f;
|
||||
else
|
||||
return tmp;
|
||||
}
|
||||
|
||||
float MSG_ReadPackedCoord(msg_t* msg, float fromValue, int bits)
|
||||
{
|
||||
float tmp = 1.0f;
|
||||
int value = MSG_ReadBits(msg, 19);
|
||||
if (value & 262144) // test for 19th bit
|
||||
tmp = -1.0f;
|
||||
value &= ~262144; // remove that bit
|
||||
return tmp * value / 16.0f;
|
||||
}
|
||||
|
||||
float MSG_ReadPackedCoordExtra(msg_t* msg, float fromValue, int bits)
|
||||
{
|
||||
int packedFrom = MSG_PackCoordExtra(fromValue);
|
||||
int packedTo = MSG_ReadDeltaCoordExtra(msg, packedFrom);
|
||||
return MSG_UnpackCoordExtra(packedTo, bits);
|
||||
}
|
||||
|
||||
|
||||
void MSG_WritePackedAngle(msg_t* msg, float value, int bits)
|
||||
{
|
||||
// angles, what a mess! it wouldnt surprise me if something goes wrong here ;)
|
||||
@@ -2044,6 +2429,25 @@ qboolean MSG_DeltaNeeded(const void* fromField, const void* toField, int fieldTy
|
||||
|
||||
#endif
|
||||
|
||||
float MSG_ReadPackedVelocity(msg_t* msg, int bits)
|
||||
{
|
||||
float tmp = 1.0f;
|
||||
int value = MSG_ReadBits(msg, 17);
|
||||
if (value & 65536) // test for 17th bit
|
||||
tmp = -1.0f;
|
||||
value &= ~65536; // remove that bit
|
||||
return tmp * value / 8.0f;
|
||||
}
|
||||
|
||||
int MSG_ReadPackedSimple(msg_t* msg, int fromValue, int bits)
|
||||
{
|
||||
if (!MSG_ReadBits(msg, 1)) {
|
||||
return fromValue;
|
||||
}
|
||||
|
||||
return MSG_ReadBits(msg, bits);
|
||||
}
|
||||
|
||||
void MSG_WritePackedVelocity(msg_t* msg, float value, int bits)
|
||||
{
|
||||
int32_t packed = (uint32_t)(value * 8.0f);
|
||||
@@ -2159,99 +2563,34 @@ void MSG_ReadDeltaEntity( msg_t *msg, entityState_t *from, entityState_t *to,
|
||||
} else {
|
||||
switch (field->type) {
|
||||
case netFieldType_e::regular:
|
||||
if ( field->bits == 0 ) {
|
||||
// float
|
||||
if ( MSG_ReadBits( msg, 1 ) == 0 ) {
|
||||
*(float *)toF = 0.0f;
|
||||
} else {
|
||||
if ( MSG_ReadBits( msg, 1 ) == 0 ) {
|
||||
// integral float
|
||||
trunc = MSG_ReadBits( msg, FLOAT_INT_BITS );
|
||||
// bias to allow equal parts positive and negative
|
||||
trunc -= FLOAT_INT_BIAS;
|
||||
*(float *)toF = trunc;
|
||||
if ( print ) {
|
||||
Com_Printf( "%s:%i ", field->name, trunc );
|
||||
}
|
||||
} else {
|
||||
// full floating point value
|
||||
*toF = MSG_ReadBits( msg, 32 );
|
||||
if ( print ) {
|
||||
Com_Printf( "%s:%f ", field->name, *(float *)toF );
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( MSG_ReadBits( msg, 1 ) == 0 ) {
|
||||
*toF = 0;
|
||||
} else {
|
||||
// integer
|
||||
*toF = MSG_ReadBits( msg, field->bits );
|
||||
if ( print ) {
|
||||
Com_Printf( "%s:%i ", field->name, *toF );
|
||||
}
|
||||
}
|
||||
}
|
||||
MSG_ReadRegular(msg, field->bits, toF);
|
||||
break;
|
||||
case netFieldType_e::angle: // angles, what a mess! it wouldnt surprise me if something goes wrong here ;)
|
||||
tmp = 1.0f;
|
||||
if ( field->bits < 0 ) {
|
||||
if ( MSG_ReadBits( msg, 1 ) )
|
||||
tmp = -1.0f;
|
||||
bits = ~field->bits;
|
||||
}
|
||||
else bits = field->bits;
|
||||
|
||||
result = MSG_ReadBits( msg, bits );
|
||||
if ( bits == 12 )
|
||||
*(float *)toF = result * 0.087890625f * tmp;
|
||||
else if ( bits == 8 )
|
||||
*(float *)toF = result * 1.411764705882353f * tmp;
|
||||
else if ( bits == 16 )
|
||||
*(float *)toF = result * 0.0054931640625f * tmp;
|
||||
else
|
||||
*(float *)toF = result * (1 << bits) * tmp / 360.0f;
|
||||
*(float*)toF = MSG_ReadPackedAngle(msg, field->bits);
|
||||
break;
|
||||
case netFieldType_e::animTime: // time
|
||||
*(float *)toF = MSG_ReadBits( msg, 15 ) * 0.0099999998f;
|
||||
*(float*)toF = MSG_ReadPackedAnimTime(msg, field->bits, *(float*)fromF, frameTime);
|
||||
break;
|
||||
case netFieldType_e::animWeight: // nasty!
|
||||
tmp = MSG_ReadBits( msg, 8 ) / 255.0f;
|
||||
if ( tmp < 0.0f )
|
||||
*(float *)toF = 0.0f;
|
||||
else if ( tmp > 1.0f )
|
||||
*(float *)toF = 1.0f;
|
||||
else
|
||||
*(float *)toF = tmp;
|
||||
// FPU instructions yay
|
||||
*(float*)toF = MSG_ReadPackedAnimWeight(msg, field->bits);
|
||||
break;
|
||||
case netFieldType_e::scale:
|
||||
*(float *)toF = MSG_ReadBits( msg, 10 ) *0.0099999998f;
|
||||
*(float*)toF = MSG_ReadPackedScale(msg, field->bits);
|
||||
break;
|
||||
case netFieldType_e::alpha:
|
||||
tmp = MSG_ReadBits( msg, 8 ) / 255.0f;
|
||||
if ( tmp < 0.0f )
|
||||
*(float *)toF = 0.0f;
|
||||
else if ( tmp > 1.0f )
|
||||
*(float *)toF = 1.0f;
|
||||
else
|
||||
*(float *)toF = tmp;
|
||||
*(float*)toF = MSG_ReadPackedAlpha(msg, field->bits);
|
||||
break;
|
||||
case netFieldType_e::coord:
|
||||
tmp = 1.0f;
|
||||
bits = MSG_ReadBits( msg, 19 );
|
||||
if ( bits & 262144 ) // test for 19th bit
|
||||
tmp = -1.0f;
|
||||
bits &= ~262144; // remove that bit
|
||||
*(float *)toF = tmp * bits / 16.0f;
|
||||
*(float*)toF = MSG_ReadPackedCoord(msg, *(float*)fromF, field->bits);
|
||||
break;
|
||||
case netFieldType_e::coordExtra:
|
||||
*(float*)toF = MSG_ReadPackedCoordExtra(msg, *(float*)fromF, field->bits);
|
||||
break;
|
||||
case netFieldType_e::velocity:
|
||||
tmp = 1.0f;
|
||||
bits = MSG_ReadBits( msg, 17 );
|
||||
if ( bits & 65536 ) // test for 17th bit
|
||||
tmp = -1.0f;
|
||||
bits &= ~65536; // remove that bit
|
||||
*(float *)toF = tmp * bits / 8.0f;
|
||||
*(float*)toF = MSG_ReadPackedVelocity(msg, field->bits);
|
||||
break;
|
||||
case netFieldType_e::simple:
|
||||
*(int*)toF = MSG_ReadPackedSimple(msg, *(int*)fromF, field->bits);
|
||||
break;
|
||||
default:
|
||||
Com_Error( ERR_DROP, "MSG_ReadDeltaEntity: unrecognized entity field type %i for field\n", i );
|
||||
@@ -2329,6 +2668,16 @@ float MSG_UnpackAnimTime(int packed)
|
||||
return packed / 100.f;
|
||||
}
|
||||
|
||||
float MSG_UnpackAnimWeight(int result, int bits)
|
||||
{
|
||||
const int32_t max = (1 << bits) - 1;
|
||||
const float tmp = (float)result / (float)max;
|
||||
|
||||
if (tmp < 0.0f) return 0.f;
|
||||
else if (tmp > 1.0f) return 1.f;
|
||||
else return tmp;
|
||||
}
|
||||
|
||||
float MSG_UnpackScale(int packed)
|
||||
{
|
||||
return packed / 100.f;
|
||||
@@ -2501,6 +2850,66 @@ plyer_state_t communication
|
||||
// using the stringizing operator to save typing...
|
||||
#define PSF(x) #x,(size_t)&((playerState_t*)0)->x
|
||||
|
||||
#if TARGET_GAME_PROTOCOL >= 15
|
||||
netField_t playerStateFields[] =
|
||||
{
|
||||
{ PSF(commandTime), 32, netFieldType_t::regular },
|
||||
{ PSF(origin[0]), 0, netFieldType_t::coordExtra },
|
||||
{ PSF(origin[1]), 0, netFieldType_t::coordExtra },
|
||||
{ PSF(viewangles[1]), 0, netFieldType_t::regular },
|
||||
{ PSF(velocity[1]), 0, netFieldType_t::velocity },
|
||||
{ PSF(velocity[0]), 0, netFieldType_t::velocity },
|
||||
{ PSF(viewangles[0]), 0, netFieldType_t::regular },
|
||||
{ PSF(origin[2]), 0, netFieldType_t::coordExtra },
|
||||
{ PSF(velocity[2]), 0, netFieldType_t::velocity },
|
||||
{ PSF(iViewModelAnimChanged), 2, netFieldType_t::regular },
|
||||
{ PSF(damage_angles[0]), -13, netFieldType_t::angle },
|
||||
{ PSF(damage_angles[1]), -13, netFieldType_t::angle },
|
||||
{ PSF(damage_angles[2]), -13, netFieldType_t::angle },
|
||||
{ PSF(speed), 16, netFieldType_t::regular },
|
||||
{ PSF(delta_angles[1]), 16, netFieldType_t::regular },
|
||||
{ PSF(viewheight), -8, netFieldType_t::regular },
|
||||
{ PSF(groundEntityNum), GENTITYNUM_BITS, netFieldType_t::regular },
|
||||
{ PSF(delta_angles[0]), 16, netFieldType_t::regular },
|
||||
{ PSF(iViewModelAnim), 4, netFieldType_t::regular },
|
||||
{ PSF(fov), 0, netFieldType_t::regular },
|
||||
{ PSF(current_music_mood), 8, netFieldType_t::regular },
|
||||
{ PSF(gravity), 16, netFieldType_t::regular },
|
||||
{ PSF(fallback_music_mood), 8, netFieldType_t::regular },
|
||||
{ PSF(music_volume), 0, netFieldType_t::regular },
|
||||
{ PSF(pm_flags), 16, netFieldType_t::regular },
|
||||
{ PSF(clientNum), 8, netFieldType_t::regular },
|
||||
{ PSF(fLeanAngle), 0, netFieldType_t::regular },
|
||||
{ PSF(blend[3]), 0, netFieldType_t::regular },
|
||||
{ PSF(blend[0]), 0, netFieldType_t::regular },
|
||||
{ PSF(pm_type), 8, netFieldType_t::regular },
|
||||
{ PSF(feetfalling), 8, netFieldType_t::regular },
|
||||
{ PSF(radarInfo), 26, netFieldType_t::regular },
|
||||
{ PSF(camera_angles[0]), 16, netFieldType_t::angle },
|
||||
{ PSF(camera_angles[1]), 16, netFieldType_t::angle },
|
||||
{ PSF(camera_angles[2]), 16, netFieldType_t::angle },
|
||||
{ PSF(camera_origin[0]), 0, netFieldType_t::coordExtra },
|
||||
{ PSF(camera_origin[1]), 0, netFieldType_t::coordExtra },
|
||||
{ PSF(camera_origin[2]), 0, netFieldType_t::coordExtra },
|
||||
{ PSF(camera_posofs[0]), 0, netFieldType_t::coordExtra },
|
||||
{ PSF(camera_posofs[2]), 0, netFieldType_t::coordExtra },
|
||||
{ PSF(camera_time), 0, netFieldType_t::regular },
|
||||
{ PSF(voted), 1, netFieldType_t::regular },
|
||||
{ PSF(bobCycle), 8, netFieldType_t::regular },
|
||||
{ PSF(delta_angles[2]), 16, netFieldType_t::regular },
|
||||
{ PSF(viewangles[2]), 0, netFieldType_t::regular },
|
||||
{ PSF(music_volume_fade_time), 0, netFieldType_t::regular },
|
||||
{ PSF(reverb_type), 6, netFieldType_t::regular },
|
||||
{ PSF(reverb_level), 0, netFieldType_t::regular },
|
||||
{ PSF(blend[1]), 0, netFieldType_t::regular },
|
||||
{ PSF(blend[2]), 0, netFieldType_t::regular },
|
||||
{ PSF(camera_offset[0]), 0, netFieldType_t::regular },
|
||||
{ PSF(camera_offset[1]), 0, netFieldType_t::regular },
|
||||
{ PSF(camera_offset[2]), 0, netFieldType_t::regular },
|
||||
{ PSF(camera_posofs[1]), 0, netFieldType_t::coordExtra },
|
||||
{ PSF(camera_flags), 16, netFieldType_t::regular }
|
||||
};
|
||||
#else
|
||||
netField_t playerStateFields[] =
|
||||
{
|
||||
{ PSF(commandTime), 32, netFieldType_t::regular },
|
||||
@@ -2559,6 +2968,7 @@ netField_t playerStateFields[] =
|
||||
{ PSF(camera_posofs[1]), 0, netFieldType_t::coord },
|
||||
{ PSF(camera_flags), 16, netFieldType_t::regular }
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
=============
|
||||
@@ -2793,80 +3203,29 @@ void MSG_ReadDeltaPlayerstate(msg_t *msg, playerState_t *from, playerState_t *to
|
||||
|
||||
numFields = sizeof( playerStateFields ) / sizeof( playerStateFields[0] );
|
||||
lc = MSG_ReadByte(msg);
|
||||
//Com_DPrintf( "===\nMSG_ReadDeltaPlayerstate: count %i\n===\n", lc );
|
||||
assert(lc <= numFields);
|
||||
for ( i = 0, field = playerStateFields ; i < lc ; i++, field++ ) {
|
||||
fromF = (int *)( (byte *)from + field->offset );
|
||||
toF = (int *)( (byte *)to + field->offset );
|
||||
//Com_DPrintf( "field %s ", field->name );
|
||||
if ( ! MSG_ReadBits( msg, 1 ) ) {
|
||||
// no change
|
||||
*toF = *fromF;
|
||||
//Com_DPrintf( "NO CHANGE " );
|
||||
//Com_DPrintf( "value int %i, float %f\n", *toF, *(float *)toF );
|
||||
} else {
|
||||
//Com_DPrintf( "type %i, ", field->type );
|
||||
switch ( field->type ) {
|
||||
case netFieldType_e::regular:
|
||||
if ( field->bits == 0 ) {
|
||||
// float
|
||||
if ( MSG_ReadBits( msg, 1 ) == 0 ) {
|
||||
// integral float
|
||||
trunc = MSG_ReadBits( msg, FLOAT_INT_BITS );
|
||||
// bias to allow equal parts positive and negative
|
||||
trunc -= FLOAT_INT_BIAS;
|
||||
*(float *)toF = trunc;
|
||||
if ( print ) {
|
||||
Com_Printf( "%s:%i ", field->name, trunc );
|
||||
}
|
||||
} else {
|
||||
// full floating point value
|
||||
*toF = MSG_ReadBits( msg, 32 );
|
||||
if ( print ) {
|
||||
Com_Printf( "%s:%f ", field->name, *(float *)toF );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// integer
|
||||
*toF = MSG_ReadBits( msg, field->bits );
|
||||
if ( print ) {
|
||||
Com_Printf( "%s:%i ", field->name, *toF );
|
||||
}
|
||||
}
|
||||
MSG_ReadRegularSimple(msg, field->bits, toF);
|
||||
break;
|
||||
case netFieldType_e::angle:
|
||||
tmp = 1.0f;
|
||||
if ( field->bits < 0 ) {
|
||||
if ( MSG_ReadBits( msg, 1 ) )
|
||||
tmp = -1.0f;
|
||||
bits = - field->bits -1;
|
||||
}
|
||||
else bits = field->bits;
|
||||
|
||||
result = MSG_ReadBits( msg, bits );
|
||||
if ( field->bits == 12 )
|
||||
*(float *)toF = result * 0.087890625f * tmp;
|
||||
else if ( field->bits == 8 )
|
||||
*(float *)toF = result * 1.411764705882353f * tmp;
|
||||
else if ( field->bits == 16 )
|
||||
*(float *)toF = result * 0.0054931640625f * tmp;
|
||||
else
|
||||
*(float *)toF = result * (1 << bits) * tmp / 360.0f;
|
||||
*(float*)toF = MSG_ReadPackedAngle(msg, field->bits);
|
||||
break;
|
||||
case netFieldType_e::coord:
|
||||
tmp = 1.0f;
|
||||
bits = MSG_ReadBits( msg, 19 );
|
||||
if ( bits & 262144 ) // test for 19th bit
|
||||
tmp = -1.0f;
|
||||
bits &= ~262144; // 4294705151; // remove that bit
|
||||
*(float *)toF = tmp * bits / 16.0f;
|
||||
*(float*)toF = MSG_ReadPackedCoord(msg, *(float*)fromF, field->bits);
|
||||
break;
|
||||
case netFieldType_e::coordExtra:
|
||||
*(float*)toF = MSG_ReadPackedCoordExtra(msg, *(float*)fromF, field->bits);
|
||||
break;
|
||||
case netFieldType_e::velocity:
|
||||
tmp = 1.0f;
|
||||
bits = MSG_ReadBits( msg, 17 );
|
||||
if ( bits & 65536 ) // test for 17th bit
|
||||
tmp = -1.0f;
|
||||
bits &= ~65536; // 4294901759; // remove that bit
|
||||
*(float *)toF = tmp * bits / 8.0f;
|
||||
*(float*)toF = MSG_ReadPackedVelocity(msg, field->bits);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
+56
-39
@@ -29,16 +29,38 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PRODUCT_NAME "OpenMoHAA"
|
||||
#define PRODUCT_VERSION_NUMBER "0.51"
|
||||
#define PRODUCT_VERSION_STAGE "alpha"
|
||||
#define PRODUCT_VERSION PRODUCT_VERSION_NUMBER "-" PRODUCT_VERSION_STAGE
|
||||
#define PRODUCT_DATE __DATE__
|
||||
#define PRODUCT_NAME "OpenMoHAA"
|
||||
|
||||
//
|
||||
// Version
|
||||
//
|
||||
// These values are the only one that must be set for the version
|
||||
#define PRODUCT_VERSION_MAJOR 0
|
||||
#define PRODUCT_VERSION_MINOR 53
|
||||
#define PRODUCT_VERSION_PATCH 1
|
||||
#define PRODUCT_VERSION_STAGE "alpha"
|
||||
|
||||
//
|
||||
// Version display
|
||||
//
|
||||
#define PRODUCT_VERSION_NUMBER_STRING XSTRING(PRODUCT_VERSION_MAJOR) "." XSTRING(PRODUCT_VERSION_MINOR) "." XSTRING(PRODUCT_VERSION_PATCH)
|
||||
#define PRODUCT_VERSION PRODUCT_VERSION_NUMBER_STRING "-" PRODUCT_VERSION_STAGE
|
||||
#define PRODUCT_DATE __DATE__
|
||||
|
||||
#define BASEGAME "main"
|
||||
|
||||
//
|
||||
// The target type specifies which content pack the engine targets.
|
||||
//
|
||||
// Note: An universal client is not currently possible without refactoring the network and the file system.
|
||||
// Pak files must be reloaded on-the-fly depending on the server the client is connecting to.
|
||||
//
|
||||
#if TARGET_GAME_TYPE == 1
|
||||
//
|
||||
// Team Assault
|
||||
#define BASEGAME "mainta"
|
||||
#define PRODUCT_EXTENSION "Spearhead"
|
||||
//
|
||||
#define GAME_EXTENSION_BASE "mainta"
|
||||
#define PRODUCT_EXTENSION "spearhead"
|
||||
// The version string must be equal or above 2.0 to be able to connect to spearhead servers
|
||||
#define TARGET_GAME_VERSION "2.16"
|
||||
#define TARGET_GAME_PROTOCOL 17
|
||||
@@ -48,10 +70,12 @@ extern "C" {
|
||||
#define HOMEPATH_NAME_WIN "mohta"
|
||||
#define HOMEPATH_NAME_MACOSX HOMEPATH_NAME_WIN
|
||||
#elif TARGET_GAME_TYPE == 2
|
||||
//
|
||||
// Team Tactics
|
||||
#define BASEGAME "maintt"
|
||||
#define PRODUCT_EXTENSION "Breakthrough"
|
||||
// The version string must be equal or above 2.0 to be able to connect to breakthrough servers
|
||||
//
|
||||
#define GAME_EXTENSION_BASE "maintt"
|
||||
#define PRODUCT_EXTENSION "breakthrough"
|
||||
// The version string must be equal or above 2.0 to be able to connect to breakthrough servers
|
||||
#define TARGET_GAME_VERSION "2.41"
|
||||
#define TARGET_GAME_PROTOCOL 17
|
||||
#define TARGET_GAME_NAME "mohaab"
|
||||
@@ -60,11 +84,13 @@ extern "C" {
|
||||
#define HOMEPATH_NAME_WIN "mohtt"
|
||||
#define HOMEPATH_NAME_MACOSX HOMEPATH_NAME_WIN
|
||||
#else
|
||||
// The default: the base game (no expansion)
|
||||
|
||||
#define BASEGAME "main"
|
||||
#define PRODUCT_EXTENSION "Base"
|
||||
// The version string must be below 1.12, otherwise it's not possible to connect
|
||||
//
|
||||
// Base game
|
||||
//
|
||||
|
||||
#define GAME_EXTENSION_BASE "main"
|
||||
#define PRODUCT_EXTENSION "base"
|
||||
// The version string must be 1.1x or below, otherwise it's not possible to connect
|
||||
#define TARGET_GAME_VERSION "1.12"
|
||||
#define TARGET_GAME_PROTOCOL 8
|
||||
#define TARGET_GAME_NAME "mohaa"
|
||||
@@ -74,11 +100,11 @@ extern "C" {
|
||||
#define HOMEPATH_NAME_MACOSX HOMEPATH_NAME_WIN
|
||||
#endif
|
||||
|
||||
#define PRODUCT_NAME_FULL PRODUCT_NAME ": " PRODUCT_EXTENSION
|
||||
#define PRODUCT_VERSION_FULL PRODUCT_VERSION " (for " TARGET_GAME_VERSION ")"
|
||||
#define PRODUCT_NAME_FULL PRODUCT_NAME " - v" PRODUCT_VERSION " - ext-" PRODUCT_EXTENSION
|
||||
#define PRODUCT_VERSION_FULL PRODUCT_NAME_FULL
|
||||
|
||||
#define CLIENT_WINDOW_TITLE "OpenMoHAA"
|
||||
#define CLIENT_WINDOW_MIN_TITLE "OpenMoHAA"
|
||||
#define CLIENT_WINDOW_TITLE PRODUCT_NAME
|
||||
#define CLIENT_WINDOW_MIN_TITLE PRODUCT_NAME
|
||||
|
||||
#define MAX_TEAMNAME 32
|
||||
|
||||
@@ -503,11 +529,11 @@ extern vec4_t g_color_table[8];
|
||||
#define LERP( a, b, w ) ( ( a ) * ( 1.0f - ( w ) ) + ( b ) * ( w ) )
|
||||
#define LUMA( red, green, blue ) ( 0.2126f * ( red ) + 0.7152f * ( green ) + 0.0722f * ( blue ) )
|
||||
|
||||
#ifndef min
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#ifndef Q_min
|
||||
#define Q_min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef max
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#ifndef Q_max
|
||||
#define Q_max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#define bound(a,minval,maxval) ( ((a) > (minval)) ? ( ((a) < (maxval)) ? (a) : (maxval) ) : (minval) )
|
||||
@@ -1599,7 +1625,7 @@ typedef enum
|
||||
|
||||
#define RESERVED_CONFIGSTRINGS 2 // game can't modify below this, only the system can
|
||||
|
||||
#define MAX_GAMESTATE_CHARS 32000
|
||||
#define MAX_GAMESTATE_CHARS 41952
|
||||
typedef struct {
|
||||
int stringOffsets[MAX_CONFIGSTRINGS];
|
||||
char stringData[MAX_GAMESTATE_CHARS];
|
||||
@@ -1705,6 +1731,11 @@ typedef struct playerState_s {
|
||||
float camera_posofs[3];
|
||||
int camera_flags;
|
||||
float damage_angles[3];
|
||||
// --
|
||||
// Team Assault
|
||||
int radarInfo;
|
||||
qboolean voted;
|
||||
// --
|
||||
|
||||
// not communicated over the net at all
|
||||
int ping; // server to game info for scoreboard
|
||||
@@ -1758,7 +1789,7 @@ typedef struct playerState_s {
|
||||
#define WEAPON_COMMAND_HOLSTER 14
|
||||
#define WEAPON_COMMAND_DROP 15
|
||||
#define WEAPON_COMMAND_MAX 15
|
||||
#define WEAPON_COMMAND_MASK WEAPON_COMMAND_MAX << 7
|
||||
#define WEAPON_COMMAND_MASK (WEAPON_COMMAND_MAX << 7)
|
||||
|
||||
|
||||
#define MOVE_RUN 120 // if forwardmove or rightmove are >= MOVE_RUN,
|
||||
@@ -2032,20 +2063,6 @@ typedef struct hdelement_s {
|
||||
struct fontheader_s *pFont;
|
||||
} hdelement_t;
|
||||
|
||||
enum vmAnim_e {
|
||||
VM_ANIM_IDLE,
|
||||
VM_ANIM_CHARGE,
|
||||
VM_ANIM_FIRE,
|
||||
VM_ANIM_FIRE_SECONDARY,
|
||||
VM_ANIM_RECHAMBER,
|
||||
VM_ANIM_RELOAD,
|
||||
VM_ANIM_RELOAD_SINGLE,
|
||||
VM_ANIM_RELOAD_END,
|
||||
VM_ANIM_PULLOUT,
|
||||
VM_ANIM_PUTAWAY,
|
||||
VM_ANIM_LADDERSTEP
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
frameInfo_t g_VMFrameInfo[MAX_FRAMEINFOS];
|
||||
|
||||
|
||||
@@ -83,7 +83,10 @@ void MSG_WriteLong (msg_t *sb, int c);
|
||||
void MSG_WriteFloat (msg_t *sb, float f);
|
||||
void MSG_WriteString (msg_t *sb, const char *s);
|
||||
void MSG_WriteBigString (msg_t *sb, const char *s);
|
||||
void MSG_WriteScrambledString(msg_t* sb, const char* s);
|
||||
void MSG_WriteScrambledBigString(msg_t* sb, const char* s);
|
||||
void MSG_WriteAngle16 (msg_t *sb, float f);
|
||||
void MSG_WriteEntityNum(msg_t* sb, short number);
|
||||
|
||||
void MSG_BeginReading (msg_t *sb);
|
||||
void MSG_BeginReadingOOB(msg_t *sb);
|
||||
@@ -104,9 +107,12 @@ float MSG_ReadFloat (msg_t *sb);
|
||||
char *MSG_ReadString (msg_t *sb);
|
||||
char *MSG_ReadBigString (msg_t *sb);
|
||||
char *MSG_ReadStringLine( msg_t *sb );
|
||||
char* MSG_ReadScrambledString(msg_t* msg);
|
||||
char* MSG_ReadScrambledBigString(msg_t* msg);
|
||||
float MSG_ReadAngle8( msg_t *sb );
|
||||
float MSG_ReadAngle16 (msg_t *sb);
|
||||
void MSG_ReadData (msg_t *sb, void *buffer, int size);
|
||||
unsigned short MSG_ReadEntityNum(msg_t* sb);
|
||||
|
||||
|
||||
void MSG_WriteDeltaUsercmd( msg_t *msg, struct usercmd_s *from, struct usercmd_s *to );
|
||||
@@ -158,6 +164,7 @@ void MSG_WritePackedSimple(msg_t* msg, int value, int bits);
|
||||
|
||||
float MSG_UnpackAngle(int value, int bits);
|
||||
float MSG_UnpackAnimTime(int packed);
|
||||
float MSG_UnpackAnimWeight(int result, int bits);
|
||||
float MSG_UnpackScale(int packed);
|
||||
float MSG_UnpackAlpha(int packed, int bits);
|
||||
float MSG_UnpackCoord(int packed, int bits);
|
||||
|
||||
@@ -468,8 +468,8 @@ typedef struct {
|
||||
// little-endian "2015"
|
||||
|
||||
#define BSP_BETA_VERSION 18 // Beta Allied Assault
|
||||
#define BSP_BASE_VERSION 19 // vanilla Allied Assault
|
||||
#define BSP_VERSION 19 // current Allied Assault
|
||||
#define BSP_MIN_VERSION 18 // Beta Allied Assault
|
||||
#define BSP_MAX_VERSION 21 // Breakthrough
|
||||
|
||||
|
||||
// there shouldn't be any problem with increasing these values at the
|
||||
|
||||
@@ -582,7 +582,7 @@ const char* Script::GrabNextToken(qboolean crossline)
|
||||
*token_p++ = *script_p++;
|
||||
}
|
||||
|
||||
if (token_p == &token[MAXTOKEN]) {
|
||||
if (token_p == &token[SCRIPT_MAXTOKEN]) {
|
||||
FILE_Error(ERR_DROP, "Token too large on line %i in file %s\n",
|
||||
line, filename.c_str());
|
||||
}
|
||||
@@ -824,7 +824,7 @@ const char* Script::GetLine(qboolean crossline)
|
||||
start = script_p;
|
||||
SkipToEOL();
|
||||
size = script_p - start;
|
||||
if (size < (MAXTOKEN - 1)) {
|
||||
if (size < (SCRIPT_MAXTOKEN - 1)) {
|
||||
memcpy(token, start, size);
|
||||
token[size] = '\0';
|
||||
} else {
|
||||
@@ -859,7 +859,7 @@ const char* Script::GetRaw(void)
|
||||
start = script_p;
|
||||
SkipToEOL();
|
||||
size = script_p - start;
|
||||
if (size < (MAXTOKEN - 1)) {
|
||||
if (size < (SCRIPT_MAXTOKEN - 1)) {
|
||||
memset(token, 0, sizeof(token));
|
||||
memcpy(token, start, size);
|
||||
} else {
|
||||
@@ -946,7 +946,7 @@ const char* Script::GetString(qboolean crossline)
|
||||
startline, filename.c_str());
|
||||
}
|
||||
|
||||
if (token_p == &token[MAXTOKEN]) {
|
||||
if (token_p == &token[SCRIPT_MAXTOKEN]) {
|
||||
FILE_Error(ERR_DROP, "String too large on line %i in file %s\n",
|
||||
line, filename.c_str());
|
||||
}
|
||||
@@ -1075,7 +1075,7 @@ int Script::LinesInFile(void)
|
||||
qboolean temp_tokenready;
|
||||
const char* temp_script_p;
|
||||
int temp_line;
|
||||
char temp_token[MAXTOKEN];
|
||||
char temp_token[SCRIPT_MAXTOKEN];
|
||||
int numentries;
|
||||
|
||||
temp_tokenready = tokenready;
|
||||
|
||||
@@ -40,13 +40,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#define TOKENSPACE (' ')
|
||||
#define TOKENSPECIAL ('$')
|
||||
|
||||
#define MAXTOKEN 512
|
||||
#define SCRIPT_MAXTOKEN 512
|
||||
|
||||
typedef struct {
|
||||
qboolean tokenready;
|
||||
int offset;
|
||||
int line;
|
||||
char token[MAXTOKEN];
|
||||
char token[SCRIPT_MAXTOKEN];
|
||||
} scriptmarker_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -67,7 +67,7 @@ protected:
|
||||
Container<macro*> macrolist;
|
||||
|
||||
int line;
|
||||
char token[MAXTOKEN];
|
||||
char token[SCRIPT_MAXTOKEN];
|
||||
|
||||
qboolean releaseBuffer;
|
||||
qboolean hasError;
|
||||
|
||||
@@ -388,7 +388,7 @@ void TikiScript::AddMacro( const char *name, const char *expansion )
|
||||
return;
|
||||
}
|
||||
|
||||
if( nummacros >= MAXMACROS )
|
||||
if( nummacros >= TIKI_MAXMACROS )
|
||||
{
|
||||
TIKI_DPrintf( "Too many %cdefine in file %s\n", TOKENSPECIAL, Filename() );
|
||||
}
|
||||
@@ -420,7 +420,7 @@ qboolean TikiScript::ProcessCommand( qboolean crossline )
|
||||
char argument1[ 256 ];
|
||||
char argument2[ 256 ];
|
||||
|
||||
sscanf( script_p, "%c%s %s %s\n", &dummy, &command, &argument1, &argument2 );
|
||||
sscanf( script_p, "%c%s %s %s\n", &dummy, command, argument1, argument2 );
|
||||
|
||||
if( !stricmp( command, "define" ) )
|
||||
{
|
||||
@@ -760,7 +760,7 @@ const char *TikiScript::GetToken( qboolean crossline )
|
||||
*token_p++ = *i->script_p++;
|
||||
}
|
||||
|
||||
if( token_p == &i->token[ MAXTOKEN ] )
|
||||
if( token_p == &i->token[ TIKI_MAXTOKEN ] )
|
||||
{
|
||||
TIKI_DPrintf( "Token too large on line %i in file %s\n", i->line, i->Filename() );
|
||||
break;
|
||||
@@ -869,7 +869,7 @@ const char *TikiScript::GetLine( qboolean crossline )
|
||||
start = i->script_p;
|
||||
SkipToEOL();
|
||||
size = i->script_p - start;
|
||||
if( size < ( MAXTOKEN - 1 ) )
|
||||
if( size < ( TIKI_MAXTOKEN - 1 ) )
|
||||
{
|
||||
memcpy( i->token, start, size );
|
||||
i->token[ size ] = '\0';
|
||||
@@ -928,7 +928,7 @@ const char *TikiScript::GetAndIgnoreLine( qboolean crossline )
|
||||
start = script_p;
|
||||
SkipToEOL();
|
||||
size = script_p - start;
|
||||
if( size < ( MAXTOKEN - 1 ) )
|
||||
if( size < ( TIKI_MAXTOKEN - 1 ) )
|
||||
{
|
||||
memcpy( token, start, size );
|
||||
token[ size ] = '\0';
|
||||
@@ -981,7 +981,7 @@ const char *TikiScript::GetRaw( void )
|
||||
start = script_p;
|
||||
SkipToEOL();
|
||||
size = script_p - start;
|
||||
if( size < ( MAXTOKEN - 1 ) )
|
||||
if( size < ( TIKI_MAXTOKEN - 1 ) )
|
||||
{
|
||||
memset( token, 0, sizeof( token ) );
|
||||
memcpy( token, start, size );
|
||||
@@ -1086,7 +1086,7 @@ const char *TikiScript::GetString( qboolean crossline )
|
||||
"line %d in file %s\n", startline, i->filename );
|
||||
}
|
||||
|
||||
if( token_p == &i->token[ MAXTOKEN ] )
|
||||
if( token_p == &i->token[ TIKI_MAXTOKEN ] )
|
||||
{
|
||||
TIKI_DPrintf( "String too large on line %i in file %s\n", i->line, i->filename );
|
||||
}
|
||||
@@ -1192,7 +1192,7 @@ int TikiScript::LinesInFile( void )
|
||||
qboolean temp_tokenready;
|
||||
const char *temp_script_p;
|
||||
int temp_line;
|
||||
char temp_token[ MAXTOKEN ];
|
||||
char temp_token[ TIKI_MAXTOKEN ];
|
||||
int numentries;
|
||||
|
||||
temp_tokenready = tokenready;
|
||||
@@ -1232,7 +1232,7 @@ void TikiScript::Parse( char *data, int length, const char *name )
|
||||
Reset();
|
||||
this->length = length;
|
||||
end_p = script_p + length;
|
||||
strncpy( filename, name, MAXTOKEN );
|
||||
strncpy( filename, name, TIKI_MAXTOKEN );
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -32,21 +32,19 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#define TOKENSPACE (' ')
|
||||
#define TOKENSPECIAL ('$')
|
||||
|
||||
#ifndef MAXTOKEN
|
||||
#define MAXTOKEN 256
|
||||
#endif
|
||||
#define TIKI_MAXTOKEN 256
|
||||
|
||||
#define MAXMACROS 48
|
||||
#define TIKI_MAXMACROS 48
|
||||
|
||||
typedef struct {
|
||||
char name[ MAXTOKEN ];
|
||||
char macro[ MAXTOKEN ];
|
||||
char name[TIKI_MAXTOKEN];
|
||||
char macro[TIKI_MAXTOKEN];
|
||||
} tiki_macro_t;
|
||||
|
||||
typedef struct {
|
||||
const char *mark_script_p;
|
||||
qboolean mark_tokenready;
|
||||
char mark_token[ MAXTOKEN ];
|
||||
char mark_token[TIKI_MAXTOKEN];
|
||||
} tiki_mark_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -57,13 +55,13 @@ protected:
|
||||
qboolean tokenready;
|
||||
class TikiScript *include;
|
||||
class TikiScript *parent;
|
||||
char filename[ MAXTOKEN ];
|
||||
char filename[TIKI_MAXTOKEN];
|
||||
const char *script_p;
|
||||
const char *end_p;
|
||||
tiki_macro_t macros[ MAXMACROS ];
|
||||
tiki_macro_t macros[TIKI_MAXMACROS];
|
||||
int nummacros;
|
||||
int line;
|
||||
char token[ MAXTOKEN ];
|
||||
char token[TIKI_MAXTOKEN];
|
||||
qboolean releaseBuffer;
|
||||
tiki_mark_t mark[ 64 ];
|
||||
int mark_pos;
|
||||
|
||||
@@ -528,6 +528,34 @@ extern void ( APIENTRY * qglVertex4sv )(const GLshort *v);
|
||||
extern void ( APIENTRY * qglVertexPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
extern void ( APIENTRY * qglViewport )(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
// GL_ARB_texture_compression
|
||||
extern void (APIENTRY* qglCompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data);
|
||||
extern void (APIENTRY* qglCompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
|
||||
extern void (APIENTRY* qglCompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data);
|
||||
extern void (APIENTRY* qglCompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);
|
||||
extern void (APIENTRY* qglGetCompressedTexImageARB)(GLenum target, GLint lod, void* img);
|
||||
#ifndef GL_COMPRESSED_RGB_ARB
|
||||
#define GL_COMPRESSED_ALPHA_ARB 0x84E9
|
||||
#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA
|
||||
#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB
|
||||
#define GL_COMPRESSED_INTENSITY_ARB 0x84EC
|
||||
#define GL_COMPRESSED_RGB_ARB 0x84ED
|
||||
#define GL_COMPRESSED_RGBA_ARB 0x84EE
|
||||
#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF
|
||||
#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0
|
||||
#define GL_TEXTURE_COMPRESSED_ARB 0x86A1
|
||||
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2
|
||||
#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3
|
||||
#endif
|
||||
|
||||
// GL_EXT_texture_compression_s3tc
|
||||
#ifndef GL_COMPRESSED_RGB_S3TC_DXT1_EXT
|
||||
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
|
||||
#endif
|
||||
|
||||
#if defined( _WIN32 )
|
||||
|
||||
extern int ( WINAPI * qwglChoosePixelFormat )(HDC, CONST PIXELFORMATDESCRIPTOR *);
|
||||
|
||||
@@ -355,3 +355,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#define qglVertexPointer glVertexPointer
|
||||
#define qglViewport glViewport
|
||||
|
||||
#define qglCompressedTexImage3DARB glCompressedTexImage3D
|
||||
#define qglCompressedTexImage2DARB glCompressedTexImage2D
|
||||
#define qglCompressedTexSubImage3DARB glCompressedTexSubImage3D
|
||||
#define qglCompressedTexSubImage2DARB glCompressedTexSubImage2D
|
||||
#define qglGetCompressedTexImageARB glGetCompressedTexImage
|
||||
+28
-30
@@ -717,7 +717,14 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
||||
continue;
|
||||
}
|
||||
oldSort = drawSurf->sort;
|
||||
R_DecomposeSort( drawSurf->sort, &entityNum, &shader, &dlightMap, &bStaticModel );
|
||||
if (*drawSurf->surface != SF_SPRITE) {
|
||||
R_DecomposeSort(drawSurf->sort, &entityNum, &shader, &dlightMap, &bStaticModel);
|
||||
} else {
|
||||
shader = tr.sortedShaders[((refSprite_t*)drawSurf->surface)->shaderNum];
|
||||
entityNum = ENTITYNUM_WORLD;
|
||||
dlightMap = 0;
|
||||
bStaticModel = qfalse;
|
||||
}
|
||||
|
||||
//
|
||||
// change the tess parameters if needed
|
||||
@@ -743,6 +750,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
||||
oldDlightMap = dlightMap;
|
||||
}
|
||||
|
||||
backEnd.currentSphere = &backEnd.spareSphere;
|
||||
//
|
||||
// change the modelview matrix if needed
|
||||
//
|
||||
@@ -799,7 +807,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
||||
if ( depthRange ) {
|
||||
qglDepthRange (0, 0.3);
|
||||
} else {
|
||||
qglDepthRange (0, 1);
|
||||
qglDepthRange (0, 1.875);
|
||||
}
|
||||
oldDepthRange = depthRange;
|
||||
}
|
||||
@@ -864,6 +872,10 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
||||
}
|
||||
}
|
||||
|
||||
if (*drawSurf->surface == SF_SPRITE) {
|
||||
backEnd.shaderStartTime = ((refSprite_t*)drawSurf->surface)->shaderTime;
|
||||
}
|
||||
|
||||
// add the triangles for this surface
|
||||
rb_surfaceTable[ *drawSurf->surface ]( drawSurf->surface );
|
||||
}
|
||||
@@ -878,7 +890,16 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
||||
// go back to the world modelview matrix
|
||||
qglLoadMatrixf( backEnd.viewParms.world.modelMatrix );
|
||||
if ( depthRange ) {
|
||||
qglDepthRange (0, 1);
|
||||
qglDepthRange (0, 1.875);
|
||||
}
|
||||
|
||||
RB_ShadowFinish();
|
||||
RB_RenderFlares();
|
||||
R_DrawLensFlares();
|
||||
if (g_bInfoworldtris)
|
||||
{
|
||||
g_bInfoworldtris = 0;
|
||||
R_PrintInfoWorldtris();
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -970,12 +991,12 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, int componen
|
||||
ri.Error (ERR_DROP, "Draw_StretchRaw: size not a power of 2: %i by %i", cols, rows);
|
||||
}
|
||||
|
||||
GL_Bind( tr.scratchImage[0] );
|
||||
GL_Bind( tr.scratchImage );
|
||||
|
||||
// if the scratchImage isn't in the format we want, specify it as a new texture
|
||||
if ( cols != tr.scratchImage[0]->width || rows != tr.scratchImage[0]->height ) {
|
||||
tr.scratchImage[0]->width = tr.scratchImage[0]->uploadWidth = cols;
|
||||
tr.scratchImage[0]->height = tr.scratchImage[0]->uploadHeight = rows;
|
||||
if ( cols != tr.scratchImage->width || rows != tr.scratchImage->height ) {
|
||||
tr.scratchImage->width = tr.scratchImage->uploadWidth = cols;
|
||||
tr.scratchImage->height = tr.scratchImage->uploadHeight = rows;
|
||||
qglTexImage2D( GL_TEXTURE_2D, 0, GL_RGB8, cols, rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, data );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
@@ -1008,29 +1029,6 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, int componen
|
||||
qglEnd ();
|
||||
}
|
||||
|
||||
void RE_UploadCinematic (int w, int h, int cols, int rows, const byte *data, int client, qboolean dirty) {
|
||||
|
||||
GL_Bind( tr.scratchImage[client] );
|
||||
|
||||
// if the scratchImage isn't in the format we want, specify it as a new texture
|
||||
if ( cols != tr.scratchImage[client]->width || rows != tr.scratchImage[client]->height ) {
|
||||
tr.scratchImage[client]->width = tr.scratchImage[client]->uploadWidth = cols;
|
||||
tr.scratchImage[client]->height = tr.scratchImage[client]->uploadHeight = rows;
|
||||
qglTexImage2D( GL_TEXTURE_2D, 0, GL_RGB8, cols, rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, data );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
|
||||
} else {
|
||||
if (dirty) {
|
||||
// otherwise, just subimage upload it so that drivers can tell we are going to be changing
|
||||
// it and don't try and do a texture compression
|
||||
qglTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, cols, rows, GL_RGBA, GL_UNSIGNED_BYTE, data );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=============
|
||||
RB_SetColor
|
||||
|
||||
+94
-147
@@ -261,6 +261,14 @@ static void R_LoadLightmaps(gamelump_t* l) {
|
||||
if ( r_lightmap->integer == 2 ) {
|
||||
ri.Printf( PRINT_ALL, "Brightest lightmap value: %d\n", ( int ) ( maxIntensity * 255 ) );
|
||||
}
|
||||
|
||||
if (r_fastdlights->integer) {
|
||||
s_worldData.lighting = NULL;
|
||||
}
|
||||
else {
|
||||
s_worldData.lighting = ri.Hunk_Alloc(l->length);
|
||||
Com_Memcpy(s_worldData.lighting, l->buffer, l->length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -478,7 +486,7 @@ void R_UnpackTerraPatch(cTerraPatch_t* pPacked, cTerraPatchUnpacked_t* pUnpacked
|
||||
pUnpacked->t = ((float)pPacked->t + 0.5) * 0.0078125;
|
||||
|
||||
if( s_worldData.lighting ) {
|
||||
pUnpacked->drawinfo.lmData = &s_worldData.lighting[ 3 * ( ( pPacked->t << 7 ) + pPacked->s + ( pPacked->iLightMap << 14 ) ) ];
|
||||
pUnpacked->drawinfo.lmData = &s_worldData.lighting[pPacked->iLightMap * (LIGHTMAP_SIZE * LIGHTMAP_SIZE * 3) + 3 * pPacked->s + 3 * 128 * pPacked->t];
|
||||
} else {
|
||||
pUnpacked->drawinfo.lmData = NULL;
|
||||
}
|
||||
@@ -607,9 +615,6 @@ static void ParseFace( dsurface_t *ds, drawVert_t *verts, msurface_t *surf, int
|
||||
|
||||
lightmapNum = LittleLong( ds->lightmapNum );
|
||||
|
||||
// get fog volume
|
||||
surf->fogIndex = LittleLong( ds->fogNum ) + 1;
|
||||
|
||||
// get shader value
|
||||
surf->shader = ShaderForShaderNum( ds->shaderNum, lightmapNum );
|
||||
if ( r_singleShader->integer && !surf->shader->isSky ) {
|
||||
@@ -661,6 +666,42 @@ static void ParseFace( dsurface_t *ds, drawVert_t *verts, msurface_t *surf, int
|
||||
SetPlaneSignbits( &cv->plane );
|
||||
cv->plane.type = PlaneTypeForNormal( cv->plane.normal );
|
||||
|
||||
if (tr.numLightmaps && lightmapNum != -1 && surf->shader->lightmapIndex >= 0)
|
||||
{
|
||||
float inv;
|
||||
|
||||
cv->lmX = LittleLong(ds->lightmapX);
|
||||
cv->lmY = LittleLong(ds->lightmapY);
|
||||
cv->lmWidth = LittleLong(ds->lightmapWidth);
|
||||
cv->lmHeight = LittleLong(ds->lightmapHeight);
|
||||
|
||||
if (s_worldData.lighting) {
|
||||
cv->lmData = &s_worldData.lighting[lightmapNum * (LIGHTMAP_SIZE * LIGHTMAP_SIZE * 3) + 3 * cv->lmX + 3 * 128 * cv->lmY];
|
||||
} else {
|
||||
cv->lmData = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
cv->lmOrigin[j] = LittleFloat(ds->lightmapOrigin[j]);
|
||||
cv->lmVecs[0][j] = LittleFloat(ds->lightmapVecs[0][j]);
|
||||
cv->lmVecs[1][j] = LittleFloat(ds->lightmapVecs[1][j]);
|
||||
}
|
||||
|
||||
inv = VectorNormalize2(cv->lmVecs[0], cv->lmInverseVecs[0]);
|
||||
cv->lmInverseVecs[0][0] *= 1.0 / inv;
|
||||
cv->lmInverseVecs[0][1] *= 1.0 / inv;
|
||||
cv->lmInverseVecs[0][2] *= 1.0 / inv;
|
||||
|
||||
inv = VectorNormalize2(cv->lmVecs[1], cv->lmInverseVecs[1]);
|
||||
cv->lmInverseVecs[1][0] *= 1.0 / inv;
|
||||
cv->lmInverseVecs[1][1] *= 1.0 / inv;
|
||||
cv->lmInverseVecs[1][2] *= 1.0 / inv;
|
||||
}
|
||||
else
|
||||
{
|
||||
cv->lmData = NULL;
|
||||
}
|
||||
surf->data = (surfaceType_t *)cv;
|
||||
}
|
||||
|
||||
@@ -719,6 +760,19 @@ static void ParseMesh ( dsurface_t *ds, drawVert_t *verts, msurface_t *surf ) {
|
||||
grid = R_SubdividePatchToGrid( width, height, points );
|
||||
surf->data = (surfaceType_t *)grid;
|
||||
|
||||
if (tr.numLightmaps && lightmapNum != -1 && surf->shader->lightmapIndex >= 0)
|
||||
{
|
||||
grid->lmX = LittleLong(ds->lightmapX);
|
||||
grid->lmY = LittleLong(ds->lightmapY);
|
||||
grid->lmWidth = LittleLong(ds->lightmapWidth);
|
||||
grid->lmHeight = LittleLong(ds->lightmapHeight);
|
||||
if (s_worldData.lighting) {
|
||||
grid->lmData = &s_worldData.lighting[lightmapNum * (LIGHTMAP_SIZE * LIGHTMAP_SIZE * 3) + 3 * grid->lmX + 3 * 128 * grid->lmY];
|
||||
} else {
|
||||
grid->lmData = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// copy the level of detail origin, which is the center
|
||||
// of the group of all curves that must subdivide the same
|
||||
// to avoid cracking
|
||||
@@ -1903,129 +1957,13 @@ static void R_LoadPlanes(gamelump_t* l) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_LoadFogs
|
||||
|
||||
=================
|
||||
*/
|
||||
static void R_LoadFogs(gamelump_t* l, gamelump_t* brushesLump, gamelump_t* sidesLump) {
|
||||
int i;
|
||||
fog_t* out;
|
||||
dfog_t* fogs;
|
||||
dbrush_t* brushes, * brush;
|
||||
dbrushside_t* sides;
|
||||
int count, brushesCount, sidesCount;
|
||||
int sideNum;
|
||||
int planeNum;
|
||||
shader_t* shader;
|
||||
float d;
|
||||
int firstSide;
|
||||
|
||||
fogs = l->buffer;
|
||||
if (l->length % sizeof(*fogs)) {
|
||||
ri.Error(ERR_DROP, "LoadMap: funny lump size in %s", s_worldData.name);
|
||||
}
|
||||
count = l->length / sizeof(*fogs);
|
||||
|
||||
// create fog strucutres for them
|
||||
s_worldData.numfogs = count + 1;
|
||||
s_worldData.fogs = ri.Hunk_Alloc(s_worldData.numfogs * sizeof(*out));
|
||||
out = s_worldData.fogs + 1;
|
||||
|
||||
if (!count) {
|
||||
return;
|
||||
}
|
||||
|
||||
brushes = brushesLump->buffer;
|
||||
if (brushesLump->length % sizeof(*brushes)) {
|
||||
ri.Error(ERR_DROP, "LoadMap: funny lump size in %s", s_worldData.name);
|
||||
}
|
||||
brushesCount = brushesLump->length / sizeof(*brushes);
|
||||
|
||||
sides = sidesLump->buffer;
|
||||
if (sidesLump->length % sizeof(*sides)) {
|
||||
ri.Error(ERR_DROP, "LoadMap: funny lump size in %s", s_worldData.name);
|
||||
}
|
||||
sidesCount = sidesLump->length / sizeof(*sides);
|
||||
|
||||
for (i = 0; i < count; i++, fogs++) {
|
||||
out->originalBrushNumber = LittleLong(fogs->brushNum);
|
||||
|
||||
if ((unsigned)out->originalBrushNumber >= brushesCount) {
|
||||
ri.Error(ERR_DROP, "fog brushNumber out of range");
|
||||
}
|
||||
brush = brushes + out->originalBrushNumber;
|
||||
|
||||
firstSide = LittleLong(brush->firstSide);
|
||||
|
||||
if ((unsigned)firstSide > sidesCount - 6) {
|
||||
ri.Error(ERR_DROP, "fog brush sideNumber out of range");
|
||||
}
|
||||
|
||||
// brushes are always sorted with the axial sides first
|
||||
sideNum = firstSide + 0;
|
||||
planeNum = LittleLong(sides[sideNum].planeNum);
|
||||
out->bounds[0][0] = -s_worldData.planes[planeNum].dist;
|
||||
|
||||
sideNum = firstSide + 1;
|
||||
planeNum = LittleLong(sides[sideNum].planeNum);
|
||||
out->bounds[1][0] = s_worldData.planes[planeNum].dist;
|
||||
|
||||
sideNum = firstSide + 2;
|
||||
planeNum = LittleLong(sides[sideNum].planeNum);
|
||||
out->bounds[0][1] = -s_worldData.planes[planeNum].dist;
|
||||
|
||||
sideNum = firstSide + 3;
|
||||
planeNum = LittleLong(sides[sideNum].planeNum);
|
||||
out->bounds[1][1] = s_worldData.planes[planeNum].dist;
|
||||
|
||||
sideNum = firstSide + 4;
|
||||
planeNum = LittleLong(sides[sideNum].planeNum);
|
||||
out->bounds[0][2] = -s_worldData.planes[planeNum].dist;
|
||||
|
||||
sideNum = firstSide + 5;
|
||||
planeNum = LittleLong(sides[sideNum].planeNum);
|
||||
out->bounds[1][2] = s_worldData.planes[planeNum].dist;
|
||||
|
||||
// get information from the shader for fog parameters
|
||||
shader = R_FindShader(fogs->shader, LIGHTMAP_NONE, qtrue, qtrue, qtrue, qtrue);
|
||||
|
||||
out->parms = shader->fogParms;
|
||||
|
||||
out->colorInt = ColorBytes4(shader->fogParms.color[0] * tr.identityLight,
|
||||
shader->fogParms.color[1] * tr.identityLight,
|
||||
shader->fogParms.color[2] * tr.identityLight, 1.0);
|
||||
|
||||
d = shader->fogParms.depthForOpaque < 1 ? 1 : shader->fogParms.depthForOpaque;
|
||||
out->tcScale = 1.0f / (d * 8);
|
||||
|
||||
// set the gradient vector
|
||||
sideNum = LittleLong(fogs->visibleSide);
|
||||
|
||||
if (sideNum == -1) {
|
||||
out->hasSurface = qfalse;
|
||||
}
|
||||
else {
|
||||
out->hasSurface = qtrue;
|
||||
planeNum = LittleLong(sides[firstSide + sideNum].planeNum);
|
||||
VectorSubtract(vec3_origin, s_worldData.planes[planeNum].normal, out->surface);
|
||||
out->surface[3] = -s_worldData.planes[planeNum].dist;
|
||||
}
|
||||
|
||||
out++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
R_LoadLightGrid
|
||||
|
||||
================
|
||||
*/
|
||||
void R_LoadLightGrid(gamelump_t* l) {
|
||||
void R_LoadLightGrid(gamelump_t* plPal, gamelump_t* plOffsets, gamelump_t* plData) {
|
||||
int i;
|
||||
vec3_t maxs;
|
||||
int numGridPoints;
|
||||
@@ -2034,35 +1972,51 @@ void R_LoadLightGrid(gamelump_t* l) {
|
||||
|
||||
w = &s_worldData;
|
||||
|
||||
w->lightGridInverseSize[0] = 1.0f / w->lightGridSize[0];
|
||||
w->lightGridInverseSize[1] = 1.0f / w->lightGridSize[1];
|
||||
w->lightGridInverseSize[2] = 1.0f / w->lightGridSize[2];
|
||||
if (!plPal->buffer || !plOffsets->buffer || !plData->buffer) {
|
||||
ri.Printf(PRINT_WARNING, "WARNING: No light grid data present\n");
|
||||
w->lightGridOffsets = 0;
|
||||
w->lightGridData = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
w->lightGridSize[0] = 32.0;
|
||||
w->lightGridSize[1] = 32.0;
|
||||
w->lightGridSize[2] = 32.0;
|
||||
w->lightGridOOSize[0] = 1.0f / w->lightGridSize[0];
|
||||
w->lightGridOOSize[1] = 1.0f / w->lightGridSize[1];
|
||||
w->lightGridOOSize[2] = 1.0f / w->lightGridSize[2];
|
||||
|
||||
wMins = w->bmodels[0].bounds[0];
|
||||
wMaxs = w->bmodels[0].bounds[1];
|
||||
|
||||
for ( i = 0 ; i < 3 ; i++ ) {
|
||||
w->lightGridOrigin[i] = w->lightGridSize[i] * ceil( wMins[i] / w->lightGridSize[i] );
|
||||
w->lightGridMins[i] = w->lightGridSize[i] * ceil( wMins[i] / w->lightGridSize[i] );
|
||||
maxs[i] = w->lightGridSize[i] * floor( wMaxs[i] / w->lightGridSize[i] );
|
||||
w->lightGridBounds[i] = (maxs[i] - w->lightGridOrigin[i])/w->lightGridSize[i] + 1;
|
||||
w->lightGridBounds[i] = (maxs[i] - w->lightGridMins[i])/w->lightGridSize[i] + 1;
|
||||
}
|
||||
|
||||
numGridPoints = w->lightGridBounds[0] * w->lightGridBounds[1] * w->lightGridBounds[2];
|
||||
numGridPoints = w->lightGridBounds[0] * w->lightGridBounds[1] + w->lightGridBounds[0];
|
||||
|
||||
if (l->length != numGridPoints * 8) {
|
||||
ri.Printf(PRINT_WARNING, "WARNING: light grid mismatch\n");
|
||||
if (plOffsets->length != numGridPoints * 2) {
|
||||
ri.Printf(PRINT_WARNING, "WARNING: light grid offset size mismatch\n");
|
||||
w->lightGridOffsets = NULL;
|
||||
w->lightGridData = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
w->lightGridData = ri.Hunk_Alloc(l->length);
|
||||
Com_Memcpy(w->lightGridData, (void*)l->buffer, l->length);
|
||||
|
||||
// deal with overbright bits
|
||||
for ( i = 0 ; i < numGridPoints ; i++ ) {
|
||||
R_ColorShiftLightingBytesAlpha( &w->lightGridData[i*8], &w->lightGridData[i*8] );
|
||||
R_ColorShiftLightingBytesAlpha( &w->lightGridData[i*8+3], &w->lightGridData[i*8+3] );
|
||||
if (plPal->length != 768) {
|
||||
ri.Printf(PRINT_WARNING, "WARNING: light grid palette size mismatch\n");
|
||||
w->lightGridOffsets = NULL;
|
||||
w->lightGridData = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
w->lightGridOffsets = ri.Hunk_Alloc(plOffsets->length);
|
||||
Com_Memcpy(w->lightGridOffsets, plOffsets->buffer, plOffsets->length);
|
||||
Com_Memcpy(w->lightGridPalette, plPal->buffer, sizeof(s_worldData.lightGridPalette));
|
||||
|
||||
w->lightGridData = ri.Hunk_Alloc(plData->length);
|
||||
Com_Memcpy(w->lightGridData, plData->buffer, plData->length);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2279,9 +2233,9 @@ void RE_LoadWorldMap( const char *name ) {
|
||||
c_gridVerts = 0;
|
||||
|
||||
i = LittleLong(header.version);
|
||||
if (i < BSP_BASE_VERSION || i > BSP_VERSION) {
|
||||
if (i < BSP_MIN_VERSION || i > BSP_MAX_VERSION) {
|
||||
ri.Error(ERR_DROP, "RE_LoadWorldMap: %s has wrong version number (%i should be between %i and %i)",
|
||||
name, i, BSP_BASE_VERSION, BSP_VERSION);
|
||||
name, i, BSP_MIN_VERSION, BSP_MAX_VERSION);
|
||||
}
|
||||
|
||||
// load into heap
|
||||
@@ -2339,13 +2293,7 @@ void RE_LoadWorldMap( const char *name ) {
|
||||
_R(75);
|
||||
R_FreeLump(&lump2);
|
||||
_R(76);
|
||||
numbrushsides = R_LoadLump(h, &header.lumps[LUMP_BRUSHSIDES], &lump2, sizeof(dbrushside_t));
|
||||
numbrushes = R_LoadLump(h, &header.lumps[LUMP_BRUSHES], &lump, sizeof(dbrush_t));
|
||||
numFogs = R_LoadLump(h, &header.lumps[LUMP_DUMMY10], &lump3, sizeof(dfog_t));
|
||||
R_LoadFogs(&lump3, &lump, &lump2);
|
||||
R_FreeLump(&lump);
|
||||
R_FreeLump(&lump2);
|
||||
R_FreeLump(&lump3);
|
||||
numFogs = 0;
|
||||
nummodels = R_LoadLump(h, &header.lumps[LUMP_MODELS], &lump, sizeof(bmodel_t));
|
||||
_R(77);
|
||||
R_LoadSubmodels(&lump);
|
||||
@@ -2364,8 +2312,7 @@ void RE_LoadWorldMap( const char *name ) {
|
||||
_R(84);
|
||||
g_iGridDataSize = R_LoadLump(h, &header.lumps[LUMP_LIGHTGRIDDATA], &lump3, sizeof(byte));
|
||||
_R(85);
|
||||
//R_LoadLightGrid( &lump, &lump2, &lump3 );
|
||||
R_LoadLightGrid(&lump3);
|
||||
R_LoadLightGrid( &lump, &lump2, &lump3 );
|
||||
_R(86);
|
||||
R_FreeLump(&lump);
|
||||
_R(87);
|
||||
|
||||
@@ -46,7 +46,7 @@ void R_PerformanceCounters( void ) {
|
||||
ri.SetPerformanceCounters(
|
||||
backEnd.pc.c_totalIndexes / 3,
|
||||
backEnd.pc.c_vertexes,
|
||||
R_SumOfUsedImages(pc_save.c_totalIndexes / 3, pc_save.c_vertexes),
|
||||
R_SumOfUsedImages(),
|
||||
pc_save.c_totalIndexes / 3,
|
||||
pc_save.c_vertexes,
|
||||
backEnd.pc.c_characterlights
|
||||
|
||||
@@ -236,17 +236,17 @@ void RE_DrawBackground_TexSubImage(int cols, int rows, int bgr, byte* data) {
|
||||
format = GL_RGB;
|
||||
}
|
||||
|
||||
GL_Bind(tr.scratchImage[0]);
|
||||
GL_Bind(tr.scratchImage);
|
||||
|
||||
if (cols == tr.scratchImage[0]->width && rows == tr.scratchImage[0]->height && format == tr.scratchImage[0]->internalFormat)
|
||||
if (cols == tr.scratchImage->width && rows == tr.scratchImage->height && format == tr.scratchImage->internalFormat)
|
||||
{
|
||||
qglTexSubImage2D(3553, 0, 0, 0, cols, rows, format, 5121, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
tr.scratchImage[0]->uploadWidth = cols;
|
||||
tr.scratchImage[0]->uploadHeight = rows;
|
||||
tr.scratchImage[0]->internalFormat = format;
|
||||
tr.scratchImage->uploadWidth = cols;
|
||||
tr.scratchImage->uploadHeight = rows;
|
||||
tr.scratchImage->internalFormat = format;
|
||||
qglTexImage2D(GL_TEXTURE_2D, 0, 3, cols, rows, 0, format, 5121, data);
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, 9729.0);
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 9729.0);
|
||||
|
||||
@@ -197,32 +197,13 @@ RB_AddDlightFlares
|
||||
void RB_AddDlightFlares( void ) {
|
||||
dlight_t *l;
|
||||
int i, j, k;
|
||||
fog_t *fog;
|
||||
|
||||
if ( !r_flares->integer ) {
|
||||
return;
|
||||
}
|
||||
|
||||
l = backEnd.refdef.dlights;
|
||||
fog = tr.world->fogs;
|
||||
for (i=0 ; i<backEnd.refdef.num_dlights ; i++, l++) {
|
||||
|
||||
// find which fog volume the light is in
|
||||
for ( j = 1 ; j < tr.world->numfogs ; j++ ) {
|
||||
fog = &tr.world->fogs[j];
|
||||
for ( k = 0 ; k < 3 ; k++ ) {
|
||||
if ( l->origin[k] < fog->bounds[0][k] || l->origin[k] > fog->bounds[1][k] ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( k == 3 ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( j == tr.world->numfogs ) {
|
||||
j = 0;
|
||||
}
|
||||
|
||||
RB_AddFlare( (void *)l, j, l->origin, l->color, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
+261
-32
@@ -299,6 +299,10 @@ lighting range
|
||||
*/
|
||||
void R_LightScaleTexture (unsigned *in, int inwidth, int inheight, qboolean only_gamma )
|
||||
{
|
||||
if (!tr.needsLightScale) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( only_gamma )
|
||||
{
|
||||
if ( !glConfig.deviceSupportsGamma )
|
||||
@@ -548,36 +552,62 @@ static void Upload32(
|
||||
// select proper internal format
|
||||
if ( samples == 3 )
|
||||
{
|
||||
if ( glConfig.textureCompression == TC_S3TC )
|
||||
if (!force32bit)
|
||||
{
|
||||
internalFormat = GL_RGB4_S3TC;
|
||||
}
|
||||
else if ( r_texturebits->integer == 16 )
|
||||
{
|
||||
internalFormat = GL_RGB5;
|
||||
}
|
||||
else if ( r_texturebits->integer == 32 )
|
||||
{
|
||||
internalFormat = GL_RGB8;
|
||||
if (r_texturebits->integer == 16)
|
||||
{
|
||||
internalFormat = GL_RGB5;
|
||||
}
|
||||
else if (r_texturebits->integer == 32)
|
||||
{
|
||||
internalFormat = GL_RGB8;
|
||||
}
|
||||
else if (r_colorbits->integer == 16)
|
||||
{
|
||||
internalFormat = GL_RGBA4;
|
||||
}
|
||||
else if (r_colorbits->integer == 32)
|
||||
{
|
||||
internalFormat = GL_RGBA8;
|
||||
}
|
||||
else
|
||||
{
|
||||
internalFormat = 3;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
internalFormat = 3;
|
||||
internalFormat = GL_RGB8;
|
||||
}
|
||||
}
|
||||
else if ( samples == 4 )
|
||||
{
|
||||
if ( r_texturebits->integer == 16 )
|
||||
if (!force32bit)
|
||||
{
|
||||
internalFormat = GL_RGBA4;
|
||||
}
|
||||
else if ( r_texturebits->integer == 32 )
|
||||
{
|
||||
internalFormat = GL_RGBA8;
|
||||
if (r_texturebits->integer == 16)
|
||||
{
|
||||
internalFormat = GL_RGBA4;
|
||||
}
|
||||
else if (r_texturebits->integer == 32)
|
||||
{
|
||||
internalFormat = GL_RGBA8;
|
||||
}
|
||||
else if (r_colorbits->integer == 16)
|
||||
{
|
||||
internalFormat = GL_RGBA4;
|
||||
}
|
||||
else if (r_colorbits->integer == 32)
|
||||
{
|
||||
internalFormat = GL_RGBA8;
|
||||
}
|
||||
else
|
||||
{
|
||||
internalFormat = 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
internalFormat = 4;
|
||||
internalFormat = GL_RGB8;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -666,6 +696,161 @@ done:
|
||||
ri.Hunk_FreeTempMemory( resampledBuffer );
|
||||
}
|
||||
|
||||
static void UploadCompressed(
|
||||
byte* data,
|
||||
int width,
|
||||
int height,
|
||||
int numMipmaps,
|
||||
int iMipmapsAvailable,
|
||||
qboolean picmip,
|
||||
int glCompressMode,
|
||||
int* format,
|
||||
int* pUploadWidth,
|
||||
int* pUploadHeight,
|
||||
int* pBytesUsed
|
||||
) {
|
||||
byte* offset;
|
||||
int i;
|
||||
int iStartImage;
|
||||
int size;
|
||||
int blockSize;
|
||||
int scaled_width, scaled_height;
|
||||
|
||||
offset = data;
|
||||
iStartImage = 0;
|
||||
if (picmip) {
|
||||
iStartImage = r_picmip->integer;
|
||||
}
|
||||
|
||||
if (iStartImage > 0 && iStartImage >= iMipmapsAvailable) {
|
||||
iStartImage = iMipmapsAvailable - 1;
|
||||
}
|
||||
|
||||
scaled_width = width;
|
||||
scaled_height = height;
|
||||
if (iStartImage)
|
||||
{
|
||||
scaled_width = width >> iStartImage;
|
||||
scaled_height = height >> iStartImage;
|
||||
}
|
||||
while (scaled_width > glConfig.maxTextureSize || scaled_height > glConfig.maxTextureSize)
|
||||
{
|
||||
scaled_width >>= 1;
|
||||
scaled_height >>= 1;
|
||||
++iStartImage;
|
||||
}
|
||||
if (iStartImage > 0 && iStartImage >= iMipmapsAvailable)
|
||||
{
|
||||
iStartImage = iMipmapsAvailable - 1;
|
||||
scaled_width = width >> (iMipmapsAvailable - 1);
|
||||
scaled_height = height >> (iMipmapsAvailable - 1);
|
||||
}
|
||||
|
||||
*pUploadWidth = scaled_width;
|
||||
*pUploadHeight = scaled_height;
|
||||
*format = glCompressMode;
|
||||
blockSize = 16;
|
||||
|
||||
if (glCompressMode == GL_COMPRESSED_RGB_S3TC_DXT1_EXT || glCompressMode == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) {
|
||||
blockSize = 8;
|
||||
}
|
||||
|
||||
scaled_width = width;
|
||||
scaled_height = height;
|
||||
|
||||
for (i = iStartImage; i; i--) {
|
||||
int w, h;
|
||||
|
||||
w = scaled_width + 3;
|
||||
if (scaled_width + 3 < 0) {
|
||||
w = scaled_width + 6;
|
||||
}
|
||||
w >>= 2;
|
||||
|
||||
if (w > 1) {
|
||||
h = scaled_height + 3;
|
||||
if (scaled_height + 3 < 0) {
|
||||
h = scaled_height + 6;
|
||||
}
|
||||
|
||||
h >>= 2;
|
||||
if (h > 1) {
|
||||
offset += blockSize * w * h;
|
||||
}
|
||||
}
|
||||
|
||||
scaled_width >>= 1;
|
||||
scaled_height >>= 1;
|
||||
if (!scaled_width) scaled_width = 1;
|
||||
if (!scaled_height) scaled_height = 1;
|
||||
}
|
||||
|
||||
*pBytesUsed = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
while (scaled_width)
|
||||
{
|
||||
int w, h;
|
||||
|
||||
if (!scaled_height) scaled_height = 1;
|
||||
w = scaled_width + 3;
|
||||
if (scaled_width + 3 < 0) w = scaled_width + 6;
|
||||
w >>= 2;
|
||||
|
||||
h = scaled_height + 3;
|
||||
if (scaled_height + 3 < 0) h = scaled_height + 6;
|
||||
h >>= 2;
|
||||
|
||||
size = blockSize * w * h;
|
||||
if (w > 1 && h > 1) *pBytesUsed += size;
|
||||
|
||||
qglCompressedTexImage2DARB(3553, i - iStartImage, glCompressMode, scaled_width, scaled_height, 0, size, data);
|
||||
GL_CheckErrors();
|
||||
|
||||
if (i < iMipmapsAvailable)
|
||||
{
|
||||
w = scaled_width + 3;
|
||||
if (scaled_width + 3 < 0) {
|
||||
w = scaled_width + 6;
|
||||
}
|
||||
|
||||
if (w >> 2 > 1)
|
||||
{
|
||||
h = scaled_height + 3;
|
||||
if (scaled_height + 3 < 0) {
|
||||
h = scaled_height + 6;
|
||||
}
|
||||
|
||||
if (h >> 2 > 1)
|
||||
data += size;
|
||||
}
|
||||
}
|
||||
scaled_width >>= 1;
|
||||
scaled_height >>= 1;
|
||||
++i;
|
||||
}
|
||||
|
||||
if (!scaled_height) {
|
||||
break;
|
||||
}
|
||||
|
||||
scaled_width = 1;
|
||||
}
|
||||
|
||||
if (numMipmaps > 1) {
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
||||
}
|
||||
else
|
||||
{
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
}
|
||||
|
||||
GL_CheckErrors();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
@@ -729,6 +914,7 @@ image_t* R_CreateImage(
|
||||
image->allowPicmip = allowPicmip;
|
||||
image->dynamicallyUpdated = dynamicallyUpdated;
|
||||
image->force32bit = force32bit;
|
||||
image->UseCount = 0;
|
||||
|
||||
strcpy (image->imgName, name);
|
||||
|
||||
@@ -750,6 +936,22 @@ image_t* R_CreateImage(
|
||||
|
||||
GL_Bind(image);
|
||||
|
||||
if (glCompressMode) {
|
||||
UploadCompressed(
|
||||
pic,
|
||||
image->width,
|
||||
image->height,
|
||||
image->numMipmaps,
|
||||
iMipmapsAvailable,
|
||||
allowPicmip,
|
||||
glCompressMode,
|
||||
&image->internalFormat,
|
||||
&image->uploadWidth,
|
||||
&image->uploadHeight,
|
||||
&image->bytesUsed
|
||||
);
|
||||
}
|
||||
|
||||
Upload32(
|
||||
(unsigned*)pic,
|
||||
image->width,
|
||||
@@ -779,6 +981,7 @@ image_t* R_CreateImage(
|
||||
hash = generateHashValue(name);
|
||||
image->next = hashTable[hash];
|
||||
hashTable[hash] = image;
|
||||
image->r_sequence = r_sequencenumber;
|
||||
|
||||
return image;
|
||||
}
|
||||
@@ -1882,7 +2085,7 @@ Loads any of the supported image types into a cannonical
|
||||
=================
|
||||
*/
|
||||
static void R_LoadImage(const char* name, byte** pic, int* width, int* height, qboolean* hasAlpha, int* glCompressMode, int* numMipmaps, int* piMipmapsAvailable) {
|
||||
int len;
|
||||
size_t len;
|
||||
char tempName[MAX_STRING_TOKENS + 1];
|
||||
|
||||
*hasAlpha = qfalse;
|
||||
@@ -1896,17 +2099,23 @@ static void R_LoadImage(const char* name, byte** pic, int* width, int* height, q
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Q_stricmp(name + len - 4, ".tga")) {
|
||||
LoadTGA(name, pic, width, height); // try tga first
|
||||
if (!*pic) { //
|
||||
char altname[MAX_QPATH]; // try jpg in place of tga
|
||||
strcpy(altname, name);
|
||||
if (!Q_stricmp(name + len - 4, ".tga") || !Q_stricmp(name + len - 4, ".jpg")) {
|
||||
char altname[MAX_QPATH];
|
||||
strcpy(altname, name);
|
||||
if (r_loadjpg->integer) {
|
||||
len = strlen(altname);
|
||||
altname[len - 3] = 'j';
|
||||
altname[len - 2] = 'p';
|
||||
altname[len - 1] = 'g';
|
||||
// try jpg first
|
||||
LoadJPG(altname, pic, width, height);
|
||||
}
|
||||
if (!*pic) {
|
||||
altname[len - 3] = 't';
|
||||
altname[len - 2] = 'g';
|
||||
altname[len - 1] = 'a';
|
||||
LoadTGA(name, pic, width, height);
|
||||
}
|
||||
*piMipmapsAvailable = 1;
|
||||
}
|
||||
else if (!Q_stricmp(name + len - 4, ".pcx")) {
|
||||
@@ -1968,7 +2177,7 @@ image_t* R_FindImageFile(const char* name, qboolean mipmap, qboolean allowPicmip
|
||||
if (image->allowPicmip != allowPicmip) {
|
||||
ri.Printf(PRINT_DEVELOPER, "WARNING: reused image %s with mixed allowPicmip parm\n", name);
|
||||
}
|
||||
if (image->wrapClampModeX != glWrapClampModeX || image != glWrapClampModeY) {
|
||||
if (image->wrapClampModeX != glWrapClampModeX || image->wrapClampModeY != glWrapClampModeY) {
|
||||
ri.Printf(PRINT_ALL, "WARNING: reused image %s with mixed glWrapClampMode parm\n", name);
|
||||
}
|
||||
}
|
||||
@@ -2100,6 +2309,7 @@ static void R_CreateDefaultImage( void ) {
|
||||
data[x][DEFAULT_SIZE-1][3] = 255;
|
||||
}
|
||||
tr.defaultImage = R_CreateImage("*default", (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, 1, 1, qfalse, qfalse, qfalse, qfalse, GL_REPEAT, GL_REPEAT);
|
||||
tr.defaultImage->r_sequence = -1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2109,6 +2319,8 @@ R_CreateBuiltinImages
|
||||
*/
|
||||
void R_CreateBuiltinImages( void ) {
|
||||
int x,y;
|
||||
int i;
|
||||
byte lightmap_buffer[128 * 128 * 4];
|
||||
byte data[DEFAULT_SIZE][DEFAULT_SIZE][4];
|
||||
|
||||
R_CreateDefaultImage();
|
||||
@@ -2116,6 +2328,7 @@ void R_CreateBuiltinImages( void ) {
|
||||
// we use a solid white image instead of disabling texturing
|
||||
Com_Memset( data, 255, sizeof( data ) );
|
||||
tr.whiteImage = R_CreateImage("*white", (byte *)data, 8, 8, 0, 1, qfalse, qfalse, qfalse, qfalse, GL_REPEAT, GL_REPEAT);
|
||||
tr.whiteImage->r_sequence = -1;
|
||||
|
||||
// with overbright bits active, we need an image which is some fraction of full color,
|
||||
// for default lightmaps, etc
|
||||
@@ -2128,14 +2341,18 @@ void R_CreateBuiltinImages( void ) {
|
||||
}
|
||||
}
|
||||
|
||||
tr.identityLightImage = R_CreateImage("*identityLight", (byte *)data, 8, 8, 0, 1, qfalse, qfalse, qfalse, qfalse, GL_REPEAT, GL_REPEAT);
|
||||
|
||||
|
||||
for(x=0;x<32;x++) {
|
||||
// scratchimage is usually used for cinematic drawing
|
||||
tr.scratchImage[x] = R_CreateImage("*scratch", (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, 0, 1, qtrue, qfalse, qfalse, qfalse, GL_REPEAT, GL_REPEAT);
|
||||
Com_Memset(lightmap_buffer, 0xFFFFFFFF, sizeof(lightmap_buffer));
|
||||
for (i = 0; i < 15; i++) {
|
||||
tr.dlightImages[i] = R_CreateImage("*lightmapD%i", lightmap_buffer, LIGHTMAP_SIZE, LIGHTMAP_SIZE, 0, 1, qfalse, qfalse, qfalse, 0, GL_CLAMP, GL_CLAMP);
|
||||
tr.dlightImages[i]->r_sequence = -1;
|
||||
}
|
||||
|
||||
tr.identityLightImage = R_CreateImage("*identityLight", (byte *)data, 8, 8, 0, 1, qfalse, qfalse, qfalse, qfalse, GL_REPEAT, GL_REPEAT);
|
||||
tr.identityLightImage->r_sequence = -1;
|
||||
|
||||
tr.scratchImage = R_CreateImage("*scratch", (byte*)data, DEFAULT_SIZE, DEFAULT_SIZE, 0, 1, qtrue, qfalse, qfalse, qfalse, GL_CLAMP, GL_CLAMP);
|
||||
tr.scratchImage->r_sequence = -1;
|
||||
|
||||
R_CreateDlightImage();
|
||||
}
|
||||
|
||||
@@ -2182,7 +2399,6 @@ void R_SetColorMappings( void ) {
|
||||
tr.identityLight = 1.0f / (1 << tr.overbrightBits);
|
||||
tr.identityLightByte = 255 * tr.identityLight;
|
||||
|
||||
|
||||
if ( r_intensity->value <= 1 ) {
|
||||
ri.Cvar_Set( "r_intensity", "1" );
|
||||
}
|
||||
@@ -2194,6 +2410,15 @@ void R_SetColorMappings( void ) {
|
||||
}
|
||||
|
||||
g = r_gamma->value;
|
||||
if (!glConfig.deviceSupportsGamma && g != 1.0) {
|
||||
tr.needsLightScale = qtrue;
|
||||
}
|
||||
else if (r_intensity->value != 1.0) {
|
||||
tr.needsLightScale = qtrue;
|
||||
}
|
||||
else {
|
||||
tr.needsLightScale = qfalse;
|
||||
}
|
||||
|
||||
shift = tr.overbrightBits;
|
||||
|
||||
@@ -2234,6 +2459,10 @@ R_InitImages
|
||||
*/
|
||||
void R_InitImages( void ) {
|
||||
Com_Memset(hashTable, 0, sizeof(hashTable));
|
||||
// clear images
|
||||
Com_Memset(tr.images, 0, sizeof(tr.images));
|
||||
tr.numImages = 0;
|
||||
|
||||
// build brightness translation tables
|
||||
R_SetColorMappings();
|
||||
|
||||
|
||||
@@ -1016,7 +1016,7 @@ void R_Register( void )
|
||||
#else
|
||||
r_smp = ri.Cvar_Get( "r_smp", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
#endif
|
||||
r_ignoreFastPath = ri.Cvar_Get("r_ignoreFastPath", "1", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_ignoreFastPath = ri.Cvar_Get("r_ignoreFastPath", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_subdivisions = ri.Cvar_Get("r_subdivisions", "4", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
|
||||
//
|
||||
@@ -1462,6 +1462,7 @@ refexport_t *GetRefAPI ( int apiVersion, refimport_t *rimp ) {
|
||||
re.UnregisterServerModel = RE_UnregisterServerModel;
|
||||
re.RegisterShader = RE_RegisterShader;
|
||||
re.RegisterShaderNoMip = RE_RegisterShaderNoMip;
|
||||
re.RefreshShaderNoMip = RE_RefreshShaderNoMip;
|
||||
re.LoadWorld = RE_LoadWorldMap;
|
||||
re.PrintBSPFileSizes = RE_PrintBSPFileSizes;
|
||||
re.MapVersion = RE_MapVersion;
|
||||
|
||||
+264
-246
@@ -47,6 +47,8 @@ typedef struct {
|
||||
|
||||
dlightInfo_t dli;
|
||||
|
||||
void R_SetupEntityLightingGrid(trRefEntity_t* ent);
|
||||
|
||||
/*
|
||||
===============
|
||||
R_TransformDlights
|
||||
@@ -126,12 +128,17 @@ static byte* R_GetLightGridPalettedColor(int iColor)
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void R_GetLightingGridValue(vec3_t vPos, vec3_t vLight)
|
||||
void R_GetLightingGridValue(const vec3_t vPos, vec3_t vLight)
|
||||
{
|
||||
if (!tr.world || !tr.world->lightGridData || !tr.world->lightGridOffsets) {
|
||||
vLight[0] = vLight[1] = vLight[2] = tr.identityLightByte;
|
||||
}
|
||||
|
||||
vLight[0] = vLight[1] = vLight[2] = tr.identityLightByte;
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void R_GetLightingGridValueFast(vec3_t vPos, vec3_t vLight)
|
||||
void R_GetLightingGridValueFast(const vec3_t vPos, vec3_t vLight)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
@@ -146,6 +153,261 @@ void R_GetLightingForSmoke(vec3_t vLight, vec3_t vOrigin)
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
static int RB_GetEntityGridLighting()
|
||||
{
|
||||
int iColor;
|
||||
int i;
|
||||
dlight_t* dl;
|
||||
float power;
|
||||
vec3_t vLight;
|
||||
vec3_t dir;
|
||||
float d;
|
||||
float* lightOrigin;
|
||||
|
||||
lightOrigin = backEnd.currentSphere->traceOrigin;
|
||||
if (!(backEnd.refdef.rdflags & RDF_NOWORLDMODEL) && tr.world->lightGridData) {
|
||||
R_GetLightingGridValue(backEnd.currentSphere->traceOrigin, vLight);
|
||||
} else {
|
||||
vLight[0] = vLight[1] = vLight[2] = tr.identityLight * 150.0;
|
||||
}
|
||||
|
||||
for (i = 0; i < backEnd.refdef.num_dlights; i++) {
|
||||
dl = &backEnd.refdef.dlights[i];
|
||||
VectorSubtract(dl->origin, lightOrigin, dir);
|
||||
d = VectorLengthSquared(dir);
|
||||
|
||||
power = dl->radius * dl->radius;
|
||||
if (power >= d) {
|
||||
d = dl->radius * 7500.0 / d;
|
||||
VectorMA(vLight, d, dl->color, vLight);
|
||||
}
|
||||
}
|
||||
|
||||
if (tr.overbrightShift)
|
||||
{
|
||||
vLight[0] = tr.overbrightMult * vLight[0];
|
||||
vLight[1] = tr.overbrightMult * vLight[1];
|
||||
vLight[2] = tr.overbrightMult * vLight[2];
|
||||
}
|
||||
|
||||
// normalize
|
||||
if (vLight[0] < 255.0 || vLight[1] < 255.0 || vLight[2] < 255.0) {
|
||||
float scale = 255.0 / fmin(vLight[0], fmin(vLight[1], vLight[2]));
|
||||
VectorScale(vLight, scale, vLight);
|
||||
}
|
||||
|
||||
// clamp ambient
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (vLight[i] > tr.identityLightByte) {
|
||||
vLight[i] = tr.identityLightByte;
|
||||
}
|
||||
}
|
||||
|
||||
// save out the byte packet version
|
||||
((byte*)&iColor)[0] = myftol(vLight[0]);
|
||||
((byte*)&iColor)[1] = myftol(vLight[1]);
|
||||
((byte*)&iColor)[2] = myftol(vLight[2]);
|
||||
((byte*)&iColor)[3] = 0xff;
|
||||
|
||||
return iColor;
|
||||
|
||||
#if 0
|
||||
int i;
|
||||
dlight_t* dl;
|
||||
float power;
|
||||
vec3_t dir;
|
||||
float d;
|
||||
vec3_t lightDir;
|
||||
vec3_t lightOrigin;
|
||||
int ambientlightInt = 0;
|
||||
trRefEntity_t *ent = backEnd.currentEntity;
|
||||
trRefdef_t *refdef = &backEnd.refdef;
|
||||
|
||||
//
|
||||
// trace a sample point down to find ambient light
|
||||
//
|
||||
if (ent->e.renderfx & RF_LIGHTING_ORIGIN) {
|
||||
// seperate lightOrigins are needed so an object that is
|
||||
// sinking into the ground can still be lit, and so
|
||||
// multi-part models can be lit identically
|
||||
VectorCopy(ent->e.lightingOrigin, lightOrigin);
|
||||
}
|
||||
else {
|
||||
VectorCopy(ent->e.origin, lightOrigin);
|
||||
}
|
||||
|
||||
// if NOWORLDMODEL, only use dynamic lights (menu system, etc)
|
||||
if (!(refdef->rdflags & RDF_NOWORLDMODEL)
|
||||
&& tr.world->lightGridData) {
|
||||
R_SetupEntityLightingGrid(ent);
|
||||
}
|
||||
else {
|
||||
ent->ambientLight[0] = ent->ambientLight[1] =
|
||||
ent->ambientLight[2] = tr.identityLight * 150;
|
||||
ent->directedLight[0] = ent->directedLight[1] =
|
||||
ent->directedLight[2] = tr.identityLight * 150;
|
||||
VectorCopy(tr.sunDirection, ent->lightDir);
|
||||
}
|
||||
|
||||
// bonus items and view weapons have a fixed minimum add
|
||||
if (1 /* ent->e.renderfx & RF_MINLIGHT */) {
|
||||
// give everything a minimum light add
|
||||
ent->ambientLight[0] += tr.identityLight * 32;
|
||||
ent->ambientLight[1] += tr.identityLight * 32;
|
||||
ent->ambientLight[2] += tr.identityLight * 32;
|
||||
}
|
||||
|
||||
//
|
||||
// modify the light by dynamic lights
|
||||
//
|
||||
d = VectorLength(ent->directedLight);
|
||||
VectorScale(ent->lightDir, d, lightDir);
|
||||
|
||||
for (i = 0; i < refdef->num_dlights; i++) {
|
||||
dl = &refdef->dlights[i];
|
||||
VectorSubtract(dl->origin, lightOrigin, dir);
|
||||
d = VectorNormalize(dir);
|
||||
|
||||
power = DLIGHT_AT_RADIUS * (dl->radius * dl->radius);
|
||||
if (d < DLIGHT_MINIMUM_RADIUS) {
|
||||
d = DLIGHT_MINIMUM_RADIUS;
|
||||
}
|
||||
d = power / (d * d);
|
||||
|
||||
VectorMA(ent->directedLight, d, dl->color, ent->directedLight);
|
||||
VectorMA(lightDir, d, dir, lightDir);
|
||||
}
|
||||
|
||||
// clamp ambient
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (ent->ambientLight[i] > tr.identityLightByte) {
|
||||
ent->ambientLight[i] = tr.identityLightByte;
|
||||
}
|
||||
}
|
||||
|
||||
// save out the byte packet version
|
||||
((byte*)&ambientlightInt)[0] = myftol(ent->ambientLight[0]);
|
||||
((byte*)&ambientlightInt)[1] = myftol(ent->ambientLight[1]);
|
||||
((byte*)&ambientlightInt)[2] = myftol(ent->ambientLight[2]);
|
||||
((byte*)&ambientlightInt)[3] = 0xff;
|
||||
|
||||
// transform the direction to local space
|
||||
VectorNormalize(lightDir);
|
||||
ent->lightDir[0] = DotProduct(lightDir, ent->e.axis[0]);
|
||||
ent->lightDir[1] = DotProduct(lightDir, ent->e.axis[1]);
|
||||
ent->lightDir[2] = DotProduct(lightDir, ent->e.axis[2]);
|
||||
|
||||
return ambientlightInt;
|
||||
#endif
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void RB_SetupEntityGridLighting()
|
||||
{
|
||||
trRefEntity_t* ent;
|
||||
int iColor;
|
||||
|
||||
if (backEnd.currentEntity->bLightGridCalculated) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (ent = backEnd.currentEntity; ent->e.parentEntity != ENTITYNUM_NONE; ent = &backEnd.refdef.entities[ent->e.parentEntity])
|
||||
{
|
||||
trRefEntity_t* newref = &backEnd.refdef.entities[ent->e.parentEntity];
|
||||
if (newref == ent) {
|
||||
assert(!"backEnd.refdef.entities[ent->e.parentEntity] refers to itself\n");
|
||||
iColor = newref->iGridLighting;
|
||||
break;
|
||||
}
|
||||
|
||||
if (newref->bLightGridCalculated) {
|
||||
iColor = newref->iGridLighting;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ent->e.parentEntity == ENTITYNUM_NONE) {
|
||||
iColor = RB_GetEntityGridLighting();
|
||||
}
|
||||
|
||||
ent = backEnd.currentEntity;
|
||||
for (;;)
|
||||
{
|
||||
ent->bLightGridCalculated = 1;
|
||||
ent->iGridLighting = iColor;
|
||||
if (ent->e.parentEntity == ENTITYNUM_NONE) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (ent == &backEnd.refdef.entities[ent->e.parentEntity]) {
|
||||
assert(!"backEnd.refdef.entities[ent->e.parentEntity] refers to itself\n");
|
||||
break;
|
||||
}
|
||||
|
||||
ent = &backEnd.refdef.entities[ent->e.parentEntity];
|
||||
}
|
||||
}
|
||||
|
||||
void RB_SetupStaticModelGridLighting(trRefdef_t* refdef, cStaticModelUnpacked_t* ent, const vec3_t lightOrigin)
|
||||
{
|
||||
int iColor;
|
||||
int i;
|
||||
dlight_t* dl;
|
||||
float power;
|
||||
vec3_t vLight;
|
||||
vec3_t dir;
|
||||
float d;
|
||||
|
||||
if (ent->bLightGridCalculated) {
|
||||
return;
|
||||
}
|
||||
ent->bLightGridCalculated = qtrue;
|
||||
|
||||
if (!(refdef->rdflags & RDF_NOWORLDMODEL) && tr.world->lightGridData) {
|
||||
R_GetLightingGridValue(backEnd.currentSphere->traceOrigin, vLight);
|
||||
}
|
||||
else {
|
||||
vLight[0] = vLight[1] = vLight[2] = tr.identityLight * 150.0;
|
||||
}
|
||||
|
||||
for (i = 0; i < refdef->num_dlights; i++) {
|
||||
dl = &refdef->dlights[i];
|
||||
VectorSubtract(dl->origin, lightOrigin, dir);
|
||||
d = VectorLengthSquared(dir);
|
||||
|
||||
power = dl->radius * dl->radius;
|
||||
if (power >= d) {
|
||||
d = dl->radius * 7500.0 / d;
|
||||
VectorMA(vLight, d, dl->color, vLight);
|
||||
}
|
||||
}
|
||||
|
||||
if (tr.overbrightShift)
|
||||
{
|
||||
vLight[0] = tr.overbrightMult * vLight[0];
|
||||
vLight[1] = tr.overbrightMult * vLight[1];
|
||||
vLight[2] = tr.overbrightMult * vLight[2];
|
||||
}
|
||||
|
||||
// normalize
|
||||
if (vLight[0] < 255.0 || vLight[1] < 255.0 || vLight[2] < 255.0) {
|
||||
float scale = 255.0 / fmin(vLight[0], fmin(vLight[1], vLight[2]));
|
||||
VectorScale(vLight, scale, vLight);
|
||||
}
|
||||
|
||||
// clamp ambient
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (vLight[i] > tr.identityLightByte) {
|
||||
vLight[i] = tr.identityLightByte;
|
||||
}
|
||||
}
|
||||
|
||||
// save out the byte packet version
|
||||
((byte*)&ent->iGridLighting)[0] = myftol(vLight[0]);
|
||||
((byte*)&ent->iGridLighting)[1] = myftol(vLight[1]);
|
||||
((byte*)&ent->iGridLighting)[2] = myftol(vLight[2]);
|
||||
((byte*)&ent->iGridLighting)[3] = 0xff;
|
||||
}
|
||||
|
||||
/*
|
||||
=============================================================================
|
||||
@@ -158,131 +420,6 @@ LIGHT SAMPLING
|
||||
extern cvar_t *r_ambientScale;
|
||||
extern cvar_t *r_directedScale;
|
||||
|
||||
/*
|
||||
=================
|
||||
R_SetupEntityLightingGrid
|
||||
|
||||
=================
|
||||
*/
|
||||
static void R_SetupEntityLightingGrid( trRefEntity_t *ent ) {
|
||||
vec3_t lightOrigin;
|
||||
int pos[3];
|
||||
int i, j;
|
||||
byte *gridData;
|
||||
float frac[3];
|
||||
int gridStep[3];
|
||||
vec3_t direction;
|
||||
float totalFactor;
|
||||
|
||||
if ( ent->e.renderfx & RF_LIGHTING_ORIGIN ) {
|
||||
// seperate lightOrigins are needed so an object that is
|
||||
// sinking into the ground can still be lit, and so
|
||||
// multi-part models can be lit identically
|
||||
VectorCopy( ent->e.lightingOrigin, lightOrigin );
|
||||
} else {
|
||||
VectorCopy( ent->e.origin, lightOrigin );
|
||||
}
|
||||
|
||||
VectorSubtract( lightOrigin, tr.world->lightGridOrigin, lightOrigin );
|
||||
for ( i = 0 ; i < 3 ; i++ ) {
|
||||
float v;
|
||||
|
||||
v = lightOrigin[i]*tr.world->lightGridInverseSize[i];
|
||||
pos[i] = floor( v );
|
||||
frac[i] = v - pos[i];
|
||||
if ( pos[i] < 0 ) {
|
||||
pos[i] = 0;
|
||||
} else if ( pos[i] >= tr.world->lightGridBounds[i] - 1 ) {
|
||||
pos[i] = tr.world->lightGridBounds[i] - 1;
|
||||
}
|
||||
}
|
||||
|
||||
VectorClear( ent->ambientLight );
|
||||
VectorClear( ent->directedLight );
|
||||
VectorClear( direction );
|
||||
|
||||
assert( tr.world->lightGridData ); // bk010103 - NULL with -nolight maps
|
||||
|
||||
// trilerp the light value
|
||||
gridStep[0] = 8;
|
||||
gridStep[1] = 8 * tr.world->lightGridBounds[0];
|
||||
gridStep[2] = 8 * tr.world->lightGridBounds[0] * tr.world->lightGridBounds[1];
|
||||
gridData = tr.world->lightGridData + pos[0] * gridStep[0]
|
||||
+ pos[1] * gridStep[1] + pos[2] * gridStep[2];
|
||||
|
||||
totalFactor = 0;
|
||||
for ( i = 0 ; i < 8 ; i++ ) {
|
||||
float factor;
|
||||
byte *data;
|
||||
int lat, lng;
|
||||
vec3_t normal;
|
||||
#if idppc
|
||||
float d0, d1, d2, d3, d4, d5;
|
||||
#endif
|
||||
factor = 1.0;
|
||||
data = gridData;
|
||||
for ( j = 0 ; j < 3 ; j++ ) {
|
||||
if ( i & (1<<j) ) {
|
||||
factor *= frac[j];
|
||||
data += gridStep[j];
|
||||
} else {
|
||||
factor *= (1.0f - frac[j]);
|
||||
}
|
||||
}
|
||||
|
||||
if ( !(data[0]+data[1]+data[2]) ) {
|
||||
continue; // ignore samples in walls
|
||||
}
|
||||
totalFactor += factor;
|
||||
#if idppc
|
||||
d0 = data[0]; d1 = data[1]; d2 = data[2];
|
||||
d3 = data[3]; d4 = data[4]; d5 = data[5];
|
||||
|
||||
ent->ambientLight[0] += factor * d0;
|
||||
ent->ambientLight[1] += factor * d1;
|
||||
ent->ambientLight[2] += factor * d2;
|
||||
|
||||
ent->directedLight[0] += factor * d3;
|
||||
ent->directedLight[1] += factor * d4;
|
||||
ent->directedLight[2] += factor * d5;
|
||||
#else
|
||||
ent->ambientLight[0] += factor * data[0];
|
||||
ent->ambientLight[1] += factor * data[1];
|
||||
ent->ambientLight[2] += factor * data[2];
|
||||
|
||||
ent->directedLight[0] += factor * data[3];
|
||||
ent->directedLight[1] += factor * data[4];
|
||||
ent->directedLight[2] += factor * data[5];
|
||||
#endif
|
||||
lat = data[7];
|
||||
lng = data[6];
|
||||
lat *= (FUNCTABLE_SIZE/256);
|
||||
lng *= (FUNCTABLE_SIZE/256);
|
||||
|
||||
// decode X as cos( lat ) * sin( long )
|
||||
// decode Y as sin( lat ) * sin( long )
|
||||
// decode Z as cos( long )
|
||||
|
||||
normal[0] = tr.sinTable[(lat+(FUNCTABLE_SIZE/4))&FUNCTABLE_MASK] * tr.sinTable[lng];
|
||||
normal[1] = tr.sinTable[lat] * tr.sinTable[lng];
|
||||
normal[2] = tr.sinTable[(lng+(FUNCTABLE_SIZE/4))&FUNCTABLE_MASK];
|
||||
|
||||
VectorMA( direction, factor, normal, direction );
|
||||
}
|
||||
|
||||
if ( totalFactor > 0 && totalFactor < 0.99 ) {
|
||||
totalFactor = 1.0f / totalFactor;
|
||||
VectorScale( ent->ambientLight, totalFactor, ent->ambientLight );
|
||||
VectorScale( ent->directedLight, totalFactor, ent->directedLight );
|
||||
}
|
||||
|
||||
VectorScale( ent->ambientLight, r_ambientScale->value, ent->ambientLight );
|
||||
VectorScale( ent->directedLight, r_directedScale->value, ent->directedLight );
|
||||
|
||||
VectorNormalize2( direction, ent->lightDir );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
LogLight
|
||||
@@ -312,125 +449,6 @@ static void LogLight( trRefEntity_t *ent ) {
|
||||
ri.Printf( PRINT_ALL, "amb:%i dir:%i\n", max1, max2 );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_SetupEntityLighting
|
||||
|
||||
Calculates all the lighting values that will be used
|
||||
by the Calc_* functions
|
||||
=================
|
||||
*/
|
||||
void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent ) {
|
||||
int i;
|
||||
dlight_t *dl;
|
||||
float power;
|
||||
vec3_t dir;
|
||||
float d;
|
||||
vec3_t lightDir;
|
||||
vec3_t lightOrigin;
|
||||
|
||||
// lighting calculations
|
||||
if ( ent->bLightGridCalculated ) {
|
||||
return;
|
||||
}
|
||||
ent->bLightGridCalculated = qtrue;
|
||||
|
||||
//
|
||||
// trace a sample point down to find ambient light
|
||||
//
|
||||
if ( ent->e.renderfx & RF_LIGHTING_ORIGIN ) {
|
||||
// seperate lightOrigins are needed so an object that is
|
||||
// sinking into the ground can still be lit, and so
|
||||
// multi-part models can be lit identically
|
||||
VectorCopy( ent->e.lightingOrigin, lightOrigin );
|
||||
} else {
|
||||
VectorCopy( ent->e.origin, lightOrigin );
|
||||
}
|
||||
|
||||
// if NOWORLDMODEL, only use dynamic lights (menu system, etc)
|
||||
if ( !(refdef->rdflags & RDF_NOWORLDMODEL )
|
||||
&& tr.world->lightGridData ) {
|
||||
R_SetupEntityLightingGrid( ent );
|
||||
} else {
|
||||
ent->ambientLight[0] = ent->ambientLight[1] =
|
||||
ent->ambientLight[2] = tr.identityLight * 150;
|
||||
ent->directedLight[0] = ent->directedLight[1] =
|
||||
ent->directedLight[2] = tr.identityLight * 150;
|
||||
VectorCopy( tr.sunDirection, ent->lightDir );
|
||||
}
|
||||
|
||||
// bonus items and view weapons have a fixed minimum add
|
||||
if ( 1 /* ent->e.renderfx & RF_MINLIGHT */ ) {
|
||||
// give everything a minimum light add
|
||||
ent->ambientLight[0] += tr.identityLight * 32;
|
||||
ent->ambientLight[1] += tr.identityLight * 32;
|
||||
ent->ambientLight[2] += tr.identityLight * 32;
|
||||
}
|
||||
|
||||
//
|
||||
// modify the light by dynamic lights
|
||||
//
|
||||
d = VectorLength( ent->directedLight );
|
||||
VectorScale( ent->lightDir, d, lightDir );
|
||||
|
||||
for ( i = 0 ; i < refdef->num_dlights ; i++ ) {
|
||||
dl = &refdef->dlights[i];
|
||||
VectorSubtract( dl->origin, lightOrigin, dir );
|
||||
d = VectorNormalize( dir );
|
||||
|
||||
power = DLIGHT_AT_RADIUS * ( dl->radius * dl->radius );
|
||||
if ( d < DLIGHT_MINIMUM_RADIUS ) {
|
||||
d = DLIGHT_MINIMUM_RADIUS;
|
||||
}
|
||||
d = power / ( d * d );
|
||||
|
||||
VectorMA( ent->directedLight, d, dl->color, ent->directedLight );
|
||||
VectorMA( lightDir, d, dir, lightDir );
|
||||
}
|
||||
|
||||
// clamp ambient
|
||||
for ( i = 0 ; i < 3 ; i++ ) {
|
||||
if ( ent->ambientLight[i] > tr.identityLightByte ) {
|
||||
ent->ambientLight[i] = tr.identityLightByte;
|
||||
}
|
||||
}
|
||||
|
||||
// save out the byte packet version
|
||||
((byte *)&ent->ambientLightInt)[0] = myftol( ent->ambientLight[0] );
|
||||
((byte *)&ent->ambientLightInt)[1] = myftol( ent->ambientLight[1] );
|
||||
((byte *)&ent->ambientLightInt)[2] = myftol( ent->ambientLight[2] );
|
||||
((byte *)&ent->ambientLightInt)[3] = 0xff;
|
||||
|
||||
// transform the direction to local space
|
||||
VectorNormalize( lightDir );
|
||||
ent->lightDir[0] = DotProduct( lightDir, ent->e.axis[0] );
|
||||
ent->lightDir[1] = DotProduct( lightDir, ent->e.axis[1] );
|
||||
ent->lightDir[2] = DotProduct( lightDir, ent->e.axis[2] );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_LightForPoint
|
||||
=================
|
||||
*/
|
||||
int R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir )
|
||||
{
|
||||
trRefEntity_t ent;
|
||||
|
||||
// bk010103 - this segfaults with -nolight maps
|
||||
if ( tr.world->lightGridData == NULL )
|
||||
return qfalse;
|
||||
|
||||
Com_Memset(&ent, 0, sizeof(ent));
|
||||
VectorCopy( point, ent.e.origin );
|
||||
R_SetupEntityLightingGrid( &ent );
|
||||
VectorCopy(ent.ambientLight, ambientLight);
|
||||
VectorCopy(ent.directedLight, directedLight);
|
||||
VectorCopy(ent.lightDir, lightDir);
|
||||
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
void R_ClearRealDlights() {
|
||||
memset(dli.allocated, 0, sizeof(dli.allocated));
|
||||
dli.dlightMap = 0;
|
||||
|
||||
+23
-12
@@ -1050,13 +1050,11 @@ typedef struct {
|
||||
int nummarksurfaces;
|
||||
msurface_t **marksurfaces;
|
||||
|
||||
int numfogs;
|
||||
fog_t *fogs;
|
||||
|
||||
vec3_t lightGridOrigin;
|
||||
vec3_t lightGridMins;
|
||||
vec3_t lightGridSize;
|
||||
vec3_t lightGridInverseSize;
|
||||
vec3_t lightGridOOSize;
|
||||
int lightGridBounds[3];
|
||||
unsigned short* lightGridOffsets;
|
||||
byte *lightGridData;
|
||||
byte lightGridPalette[768];
|
||||
|
||||
@@ -1259,7 +1257,7 @@ typedef struct {
|
||||
const byte *externalVisData; // from RE_SetWorldVisData, shared with CM_Load
|
||||
|
||||
image_t *defaultImage;
|
||||
image_t *scratchImage[32];
|
||||
image_t *scratchImage;
|
||||
image_t *fogImage;
|
||||
image_t *dlightImage; // inverse-quare highlight for projective adding
|
||||
image_t *flareImage;
|
||||
@@ -1730,6 +1728,7 @@ skin_t *R_GetSkinByHandle( qhandle_t hSkin );
|
||||
//
|
||||
qhandle_t RE_RegisterShader( const char *name );
|
||||
qhandle_t RE_RegisterShaderNoMip( const char *name );
|
||||
qhandle_t RE_RefreshShaderNoMip(const char* name);
|
||||
qhandle_t RE_RegisterShaderFromImage(const char *name, int lightmapIndex, image_t *image, qboolean mipRawImage);
|
||||
|
||||
shader_t* R_FindShader(const char* name, int lightmapIndex, qboolean mipRawImage, qboolean picmip, qboolean wrapx, qboolean wrapy);
|
||||
@@ -1822,8 +1821,8 @@ void RB_CheckOverflow( int verts, int indexes );
|
||||
|
||||
void RB_StageIteratorGeneric( void );
|
||||
void RB_StageIteratorSky( void );
|
||||
void RB_StageIteratorVertexLitTexture( void );
|
||||
void RB_StageIteratorLightmappedMultitexture( void );
|
||||
void RB_StageIteratorVertexLitTextureUnfogged( void );
|
||||
void RB_StageIteratorLightmappedMultitextureUnfogged( void );
|
||||
|
||||
void RB_AddQuadStamp( vec3_t origin, vec3_t left, vec3_t up, byte *color );
|
||||
void RB_AddQuadStampExt( vec3_t origin, vec3_t left, vec3_t up, byte *color, float s1, float t1, float s2, float t2 );
|
||||
@@ -1844,6 +1843,7 @@ extern terrainVert_t* g_pVert;
|
||||
|
||||
void R_AddBrushModelSurfaces( trRefEntity_t *e );
|
||||
void R_GetInlineModelBounds(int iIndex, vec3_t vMins, vec3_t vMaxs);
|
||||
int R_SphereInLeafs(vec_t* p, float r, mnode_t** nodes, int nMaxNodes);
|
||||
mnode_t* R_PointInLeaf(const vec3_t p);
|
||||
int R_DlightTerrain(cTerraPatchUnpacked_t* surf, int dlightBits);
|
||||
int R_CheckDlightTerrain(cTerraPatchUnpacked_t* surf, int dlightBits);
|
||||
@@ -1874,17 +1874,19 @@ LIGHTS
|
||||
*/
|
||||
|
||||
void R_DlightBmodel( bmodel_t *bmodel );
|
||||
void R_GetLightingGridValue(const vec3_t vPos, vec3_t vLight);
|
||||
void R_GetLightingForDecal(vec3_t vLight, vec3_t vFacing, vec3_t vOrigin);
|
||||
void R_GetLightingForSmoke(vec3_t vLight, vec3_t vOrigin);
|
||||
void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent );
|
||||
void RB_SetupEntityGridLighting();
|
||||
void RB_SetupStaticModelGridLighting(trRefdef_t* refdef, cStaticModelUnpacked_t* ent, const vec3_t lightOrigin);
|
||||
void R_TransformDlights( int count, dlight_t *dl, orientationr_t *ori );
|
||||
int R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir );
|
||||
void RB_Light_Real(const color4ub_t colors);
|
||||
void RB_Light_Real(unsigned char* colors);
|
||||
void RB_Sphere_BuildDLights();
|
||||
void RB_Sphere_SetupEntity();
|
||||
void RB_Grid_SetupEntity();
|
||||
void RB_Grid_SetupStaticModel();
|
||||
void RB_Light_Fullbright(const color4ub_t colors);
|
||||
void RB_Light_Fullbright(unsigned char* colors);
|
||||
void R_Sphere_InitLights();
|
||||
int R_GatherLightSources(const vec3_t vPos, vec3_t* pvLightPos, vec3_t* pvLightIntensity, int iMaxLights);
|
||||
void R_UploadDlights();
|
||||
@@ -2036,6 +2038,7 @@ SUN FLARE
|
||||
=============================================================
|
||||
*/
|
||||
void R_InitLensFlare();
|
||||
void R_DrawLensFlares();
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
@@ -2090,6 +2093,7 @@ void R_PrintInfoStaticModels();
|
||||
void R_AddSkelSurfaces(trRefEntity_t* ent);
|
||||
void R_AddStaticModelSurfaces(void);
|
||||
float R_CalcLod(const vec3_t origin, float radius);
|
||||
void R_PrintInfoWorldtris(void);
|
||||
|
||||
extern int g_nStaticSurfaces;
|
||||
extern qboolean g_bInfostaticmodels;
|
||||
@@ -2134,7 +2138,6 @@ void R_TransformClipToWindow( const vec4_t clip, const viewParms_t *view, vec4_t
|
||||
void RB_DeformTessGeometry( void );
|
||||
|
||||
void RB_CalcEnvironmentTexCoords( float *dstTexCoords );
|
||||
void RB_CalcFogTexCoords( float *dstTexCoords );
|
||||
void RB_CalcScrollTexCoords( const float scroll[2], float *dstTexCoords );
|
||||
void RB_CalcRotateTexCoords( float rotSpeed, float *dstTexCoords );
|
||||
void RB_CalcScaleTexCoords( const float scale[2], float *dstTexCoords );
|
||||
@@ -2182,6 +2185,14 @@ RENDERER BACK END COMMAND QUEUE
|
||||
|
||||
#define MAX_RENDER_COMMANDS 0x40000
|
||||
|
||||
typedef struct suninfo_s {
|
||||
vec3_t color;
|
||||
vec3_t direction;
|
||||
vec3_t flaredirection;
|
||||
char szFlareName[64];
|
||||
qboolean exists;
|
||||
} suninfo_t;
|
||||
|
||||
typedef struct {
|
||||
byte cmds[MAX_RENDER_COMMANDS];
|
||||
int used;
|
||||
|
||||
@@ -1094,39 +1094,6 @@ qboolean R_MirrorViewBySurface (drawSurf_t *drawSurf, int entityNum) {
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_SpriteFogNum
|
||||
|
||||
See if a sprite is inside a fog volume
|
||||
=================
|
||||
*/
|
||||
int R_SpriteFogNum( trRefEntity_t *ent ) {
|
||||
int i, j;
|
||||
fog_t *fog;
|
||||
|
||||
if ( tr.refdef.rdflags & RDF_NOWORLDMODEL ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for ( i = 1 ; i < tr.world->numfogs ; i++ ) {
|
||||
fog = &tr.world->fogs[i];
|
||||
for ( j = 0 ; j < 3 ; j++ ) {
|
||||
if ( ent->e.origin[j] - ent->e.radius >= fog->bounds[1][j] ) {
|
||||
break;
|
||||
}
|
||||
if ( ent->e.origin[j] + ent->e.radius <= fog->bounds[0][j] ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( j == 3 ) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==========================================================================================
|
||||
|
||||
|
||||
@@ -871,13 +871,6 @@ void R_AddSkelSurfaces( trRefEntity_t *ent ) {
|
||||
ent->e.hasMorph = qtrue;
|
||||
}
|
||||
|
||||
//
|
||||
// set up lighting now that we know we aren't culled
|
||||
//
|
||||
if( !personalModel || r_shadows->integer > 1 ) {
|
||||
R_SetupEntityLighting( &tr.refdef, ent );
|
||||
}
|
||||
|
||||
//
|
||||
// draw all meshes
|
||||
//
|
||||
|
||||
+20
-71
@@ -306,7 +306,6 @@ to overflow.
|
||||
==============
|
||||
*/
|
||||
void RB_BeginSurface( shader_t *shader ) {
|
||||
|
||||
tess.numIndexes = 0;
|
||||
tess.numVertexes = 0;
|
||||
tess.shader = shader;
|
||||
@@ -316,12 +315,6 @@ void RB_BeginSurface( shader_t *shader ) {
|
||||
tess.numPasses = shader->numUnfoggedPasses;
|
||||
tess.currentStageIteratorFunc = shader->optimalStageIteratorFunc;
|
||||
|
||||
tess.shaderTime = backEnd.refdef.floatTime - tess.shader->timeOffset;
|
||||
if (tess.shader->clampTime && tess.shaderTime >= tess.shader->clampTime) {
|
||||
tess.shaderTime = tess.shader->clampTime;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -682,43 +675,6 @@ static void ProjectDlightTexture( void ) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===================
|
||||
RB_FogPass
|
||||
|
||||
Blends a fog texture on top of everything else
|
||||
===================
|
||||
*/
|
||||
static void RB_FogPass( void ) {
|
||||
fog_t *fog;
|
||||
int i;
|
||||
|
||||
qglEnableClientState( GL_COLOR_ARRAY );
|
||||
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, tess.svars.colors );
|
||||
|
||||
qglEnableClientState( GL_TEXTURE_COORD_ARRAY);
|
||||
qglTexCoordPointer( 2, GL_FLOAT, 0, tess.svars.texcoords[0] );
|
||||
|
||||
fog = tr.world->fogs + tess.fogNum;
|
||||
|
||||
for ( i = 0; i < tess.numVertexes; i++ ) {
|
||||
* ( int * )&tess.svars.colors[i] = fog->colorInt;
|
||||
}
|
||||
|
||||
RB_CalcFogTexCoords( ( float * ) tess.svars.texcoords[0] );
|
||||
|
||||
GL_Bind( tr.fogImage );
|
||||
|
||||
if ( tess.shader->fogPass == FP_EQUAL ) {
|
||||
GL_State( GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA | GLS_DEPTHFUNC_EQUAL );
|
||||
} else {
|
||||
GL_State( GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
|
||||
}
|
||||
|
||||
R_DrawElements( tess.numIndexes, tess.indexes );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
ComputeColors
|
||||
@@ -875,7 +831,7 @@ static void ComputeColors( shaderStage_t *pStage )
|
||||
{
|
||||
float t;
|
||||
|
||||
t = 255.0 / (float)max(r, max(g, b));
|
||||
t = 255.0 / (float)Q_max(r, Q_max(g, b));
|
||||
|
||||
r = (int)((float)r * t);
|
||||
g = (int)((float)g * t);
|
||||
@@ -1113,9 +1069,6 @@ static void ComputeTexCoords( shaderStage_t *pStage ) {
|
||||
tess.svars.texcoords[b][i][1] = DotProduct( tess.xyz[i], pStage->bundle[b].tcGenVectors[1] );
|
||||
}
|
||||
break;
|
||||
case TCGEN_FOG:
|
||||
RB_CalcFogTexCoords( ( float * ) tess.svars.texcoords[b] );
|
||||
break;
|
||||
case TCGEN_ENVIRONMENT_MAPPED:
|
||||
RB_CalcEnvironmentTexCoords( ( float * ) tess.svars.texcoords[b] );
|
||||
break;
|
||||
@@ -1373,7 +1326,7 @@ void RB_StageIteratorGeneric( void )
|
||||
/*
|
||||
** RB_StageIteratorVertexLitTexture
|
||||
*/
|
||||
void RB_StageIteratorVertexLitTexture( void )
|
||||
void RB_StageIteratorVertexLitTextureUnfogged( void )
|
||||
{
|
||||
shaderCommands_t *input;
|
||||
shader_t *shader;
|
||||
@@ -1382,10 +1335,16 @@ void RB_StageIteratorVertexLitTexture( void )
|
||||
|
||||
shader = input->shader;
|
||||
|
||||
//
|
||||
// compute colors
|
||||
//
|
||||
RB_CalcDiffuseColor( ( unsigned char * ) tess.svars.colors );
|
||||
if (backEnd.currentSphere->TessFunction && r_drawspherelights->integer) {
|
||||
backEnd.currentSphere->TessFunction((unsigned char*)tess.svars.colors);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// compute colors
|
||||
//
|
||||
RB_CalcLightGridColor((unsigned char*)tess.svars.colors);
|
||||
}
|
||||
|
||||
//
|
||||
// log this call
|
||||
@@ -1428,17 +1387,10 @@ void RB_StageIteratorVertexLitTexture( void )
|
||||
//
|
||||
// now do any dynamic lighting needed
|
||||
//
|
||||
if ( tess.dlightBits && tess.shader->sort <= SS_OPAQUE ) {
|
||||
if ( tess.dlightBits && !tess.dlightMap && tess.shader->sort <= SS_OPAQUE ) {
|
||||
ProjectDlightTexture();
|
||||
}
|
||||
|
||||
//
|
||||
// now do fog
|
||||
//
|
||||
if ( tess.fogNum && tess.shader->fogPass ) {
|
||||
RB_FogPass();
|
||||
}
|
||||
|
||||
//
|
||||
// unlock arrays
|
||||
//
|
||||
@@ -1451,7 +1403,7 @@ void RB_StageIteratorVertexLitTexture( void )
|
||||
|
||||
//define REPLACE_MODE
|
||||
|
||||
void RB_StageIteratorLightmappedMultitexture( void ) {
|
||||
void RB_StageIteratorLightmappedMultitextureUnfogged( void ) {
|
||||
shaderCommands_t *input;
|
||||
|
||||
input = &tess;
|
||||
@@ -1504,7 +1456,11 @@ void RB_StageIteratorLightmappedMultitexture( void ) {
|
||||
} else {
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
}
|
||||
R_BindAnimatedImage( &tess.xstages[0]->bundle[1] );
|
||||
if (tess.dlightMap && tess.xstages[0]->bundle[1].isLightmap) {
|
||||
GL_Bind(&tr.identityLightImage[tess.dlightMap]);
|
||||
} else {
|
||||
R_BindAnimatedImage(&tess.xstages[0]->bundle[1]);
|
||||
}
|
||||
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
qglTexCoordPointer( 2, GL_FLOAT, 16, tess.texCoords[0][1] );
|
||||
|
||||
@@ -1533,17 +1489,10 @@ void RB_StageIteratorLightmappedMultitexture( void ) {
|
||||
//
|
||||
// now do any dynamic lighting needed
|
||||
//
|
||||
if ( tess.dlightBits && tess.shader->sort <= SS_OPAQUE ) {
|
||||
if ( tess.dlightBits && !tess.dlightMap && tess.shader->sort <= SS_OPAQUE ) {
|
||||
ProjectDlightTexture();
|
||||
}
|
||||
|
||||
//
|
||||
// now do fog
|
||||
//
|
||||
if ( tess.fogNum && tess.shader->fogPass ) {
|
||||
RB_FogPass();
|
||||
}
|
||||
|
||||
//
|
||||
// unlock arrays
|
||||
//
|
||||
|
||||
@@ -801,95 +801,6 @@ TEX COORDS
|
||||
====================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
========================
|
||||
RB_CalcFogTexCoords
|
||||
|
||||
To do the clipped fog plane really correctly, we should use
|
||||
projected textures, but I don't trust the drivers and it
|
||||
doesn't fit our shader data.
|
||||
========================
|
||||
*/
|
||||
void RB_CalcFogTexCoords( float *st ) {
|
||||
int i;
|
||||
float *v;
|
||||
float s, t;
|
||||
float eyeT;
|
||||
qboolean eyeOutside;
|
||||
fog_t *fog;
|
||||
vec3_t local;
|
||||
vec4_t fogDistanceVector, fogDepthVector;
|
||||
|
||||
fog = tr.world->fogs + tess.fogNum;
|
||||
|
||||
// all fogging distance is based on world Z units
|
||||
VectorSubtract( backEnd.ori.origin, backEnd.viewParms.ori.origin, local );
|
||||
fogDistanceVector[0] = -backEnd.ori.modelMatrix[2];
|
||||
fogDistanceVector[1] = -backEnd.ori.modelMatrix[6];
|
||||
fogDistanceVector[2] = -backEnd.ori.modelMatrix[10];
|
||||
fogDistanceVector[3] = DotProduct( local, backEnd.viewParms.ori.axis[0] );
|
||||
|
||||
// scale the fog vectors based on the fog's thickness
|
||||
fogDistanceVector[0] *= fog->tcScale;
|
||||
fogDistanceVector[1] *= fog->tcScale;
|
||||
fogDistanceVector[2] *= fog->tcScale;
|
||||
fogDistanceVector[3] *= fog->tcScale;
|
||||
|
||||
// rotate the gradient vector for this orientation
|
||||
if ( fog->hasSurface ) {
|
||||
fogDepthVector[0] = fog->surface[0] * backEnd.ori.axis[0][0] +
|
||||
fog->surface[1] * backEnd.ori.axis[0][1] + fog->surface[2] * backEnd.ori.axis[0][2];
|
||||
fogDepthVector[1] = fog->surface[0] * backEnd.ori.axis[1][0] +
|
||||
fog->surface[1] * backEnd.ori.axis[1][1] + fog->surface[2] * backEnd.ori.axis[1][2];
|
||||
fogDepthVector[2] = fog->surface[0] * backEnd.ori.axis[2][0] +
|
||||
fog->surface[1] * backEnd.ori.axis[2][1] + fog->surface[2] * backEnd.ori.axis[2][2];
|
||||
fogDepthVector[3] = -fog->surface[3] + DotProduct( backEnd.ori.origin, fog->surface );
|
||||
|
||||
eyeT = DotProduct( backEnd.ori.viewOrigin, fogDepthVector ) + fogDepthVector[3];
|
||||
} else {
|
||||
eyeT = 1; // non-surface fog always has eye inside
|
||||
}
|
||||
|
||||
// see if the viewpoint is outside
|
||||
// this is needed for clipping distance even for constant fog
|
||||
|
||||
if ( eyeT < 0 ) {
|
||||
eyeOutside = qtrue;
|
||||
} else {
|
||||
eyeOutside = qfalse;
|
||||
}
|
||||
|
||||
fogDistanceVector[3] += 1.0/512;
|
||||
|
||||
// calculate density for each point
|
||||
for (i = 0, v = tess.xyz[0] ; i < tess.numVertexes ; i++, v += 4) {
|
||||
// calculate the length in fog
|
||||
s = DotProduct( v, fogDistanceVector ) + fogDistanceVector[3];
|
||||
t = DotProduct( v, fogDepthVector ) + fogDepthVector[3];
|
||||
|
||||
// partially clipped fogs use the T axis
|
||||
if ( eyeOutside ) {
|
||||
if ( t < 1.0 ) {
|
||||
t = 1.0/32; // point is outside, so no fogging
|
||||
} else {
|
||||
t = 1.0/32 + 30.0/32 * t / ( t - eyeT ); // cut the distance at the fog plane
|
||||
}
|
||||
} else {
|
||||
if ( t < 0 ) {
|
||||
t = 1.0/32; // point is outside, so no fogging
|
||||
} else {
|
||||
t = 31.0/32;
|
||||
}
|
||||
}
|
||||
|
||||
st[0] = s;
|
||||
st[1] = t;
|
||||
st += 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** RB_CalcEnvironmentTexCoords
|
||||
*/
|
||||
@@ -1099,7 +1010,36 @@ void RB_CalcSpecularAlpha(unsigned char* alphas, float alphaMax, vec3_t lightOri
|
||||
|
||||
void RB_CalcLightGridColor(unsigned char* colors)
|
||||
{
|
||||
// FIXME/ unimplemented
|
||||
int i;
|
||||
|
||||
if (!backEnd.currentEntity) {
|
||||
for (i = 0; i < tess.numVertexes; i++) {
|
||||
colors[i * 4] = backEnd.currentStaticModel->iGridLighting;
|
||||
colors[i * 4 + 1] = backEnd.currentStaticModel->iGridLighting;
|
||||
colors[i * 4 + 2] = backEnd.currentStaticModel->iGridLighting;
|
||||
colors[i * 4 + 3] = backEnd.currentStaticModel->iGridLighting;
|
||||
}
|
||||
}
|
||||
else if (backEnd.currentEntity != &tr.worldEntity) {
|
||||
for (i = 0; i < tess.numVertexes; i++) {
|
||||
colors[i * 4] = backEnd.currentEntity->iGridLighting;
|
||||
colors[i * 4 + 1] = backEnd.currentEntity->iGridLighting;
|
||||
colors[i * 4 + 2] = backEnd.currentEntity->iGridLighting;
|
||||
colors[i * 4 + 3] = backEnd.currentEntity->iGridLighting;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Com_Printf(
|
||||
"##### shader '%s' incorrectly uses rgbGen lightingGrid or lightingSpherical; was rgbGen vertex intended?\n",
|
||||
tess.shader->name);
|
||||
|
||||
for (i = 0; i < tess.numVertexes; i++) {
|
||||
colors[i * 4] = 0xFF;
|
||||
colors[i * 4 + 1] = 0xFF;
|
||||
colors[i * 4 + 2] = 0xFF;
|
||||
colors[i * 4 + 3] = 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RB_CalcAlphaFromDotView(unsigned char* colors, float alphaMin, float alphaMax)
|
||||
|
||||
+242
-103
@@ -625,7 +625,7 @@ static void ParseTexMod( char *_text, shaderStage_t *stage, int cntBundle )
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.Printf( PRINT_WARNING, "WARNING: unknown tcMod '%s' in shader '%s'\n", token, shader.name );
|
||||
ri.Printf(PRINT_WARNING, "WARNING: unknown tcMod '%s' in shader '%s'\n", token, shader.name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -635,9 +635,9 @@ static void ParseTexMod( char *_text, shaderStage_t *stage, int cntBundle )
|
||||
ParseStage
|
||||
===================
|
||||
*/
|
||||
static qboolean ParseStage( shaderStage_t *stage, char **text )
|
||||
static qboolean ParseStage(shaderStage_t* stage, char** text)
|
||||
{
|
||||
char *token;
|
||||
char* token;
|
||||
int depthMaskBits = GLS_DEPTHMASK_TRUE, blendSrcBits = 0, blendDstBits = 0, atestBits = 0, depthFuncBits = 0;
|
||||
qboolean depthMaskExplicit = qfalse;
|
||||
int cntBundle = 0;
|
||||
@@ -649,33 +649,33 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
|
||||
stage->noPicMip = shader_noPicMip;
|
||||
stage->force32bit = shader_force32bit;
|
||||
|
||||
while ( 1 )
|
||||
while (1)
|
||||
{
|
||||
token = COM_ParseExt( text, qtrue );
|
||||
if ( !token[0] )
|
||||
token = COM_ParseExt(text, qtrue);
|
||||
if (!token[0])
|
||||
{
|
||||
ri.Printf( PRINT_WARNING, "WARNING: no matching '}' found\n" );
|
||||
ri.Printf(PRINT_WARNING, "WARNING: no matching '}' found\n");
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if ( token[0] == '}' )
|
||||
if (token[0] == '}')
|
||||
{
|
||||
break;
|
||||
}
|
||||
// no picmip adjustment
|
||||
else if ( !Q_stricmp( token, "nomipmaps" ) )
|
||||
else if (!Q_stricmp(token, "nomipmaps"))
|
||||
{
|
||||
stage->noMipMaps = qtrue;
|
||||
continue;
|
||||
}
|
||||
// no picmip adjustment
|
||||
else if ( !Q_stricmp( token, "nopicmip" ) )
|
||||
else if (!Q_stricmp(token, "nopicmip"))
|
||||
{
|
||||
stage->noPicMip = qtrue;
|
||||
continue;
|
||||
}
|
||||
// no picmip adjustment
|
||||
else if ( !Q_stricmp( token, "nofog" ) )
|
||||
else if (!Q_stricmp(token, "nofog"))
|
||||
{
|
||||
fogBits = GLS_FOG;
|
||||
continue;
|
||||
@@ -683,36 +683,37 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
|
||||
//
|
||||
// map <name>
|
||||
//
|
||||
else if ( !Q_stricmp( token, "map" ) )
|
||||
else if (!Q_stricmp(token, "map"))
|
||||
{
|
||||
token = COM_ParseExt( text, qfalse );
|
||||
if ( !token[0] )
|
||||
token = COM_ParseExt(text, qfalse);
|
||||
if (!token[0])
|
||||
{
|
||||
ri.Printf( PRINT_WARNING, "WARNING: missing parameter for 'map' keyword in shader '%s'\n", shader.name );
|
||||
ri.Printf(PRINT_WARNING, "WARNING: missing parameter for 'map' keyword in shader '%s'\n", shader.name);
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if ( !Q_stricmp( token, "$whiteimage" ) )
|
||||
if (!Q_stricmp(token, "$whiteimage"))
|
||||
{
|
||||
stage->bundle[cntBundle].image[0] = tr.whiteImage;
|
||||
continue;
|
||||
}
|
||||
else if ( !Q_stricmp( token, "$lightmap" ) )
|
||||
else if (!Q_stricmp(token, "$lightmap"))
|
||||
{
|
||||
stage->bundle[cntBundle].isLightmap = qtrue;
|
||||
if ( shader.lightmapIndex < 0 ) {
|
||||
if (shader.lightmapIndex < 0) {
|
||||
stage->bundle[cntBundle].image[0] = tr.whiteImage;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
stage->bundle[cntBundle].image[0] = tr.lightmaps[shader.lightmapIndex];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
stage->bundle[cntBundle].image[0] = R_FindImageFile( token, !stage->noMipMaps, !stage->noPicMip, qfalse, GL_REPEAT, GL_REPEAT );
|
||||
if ( !stage->bundle[cntBundle].image[0] )
|
||||
stage->bundle[cntBundle].image[0] = R_FindImageFile(token, !stage->noMipMaps, !stage->noPicMip, qfalse, GL_REPEAT, GL_REPEAT);
|
||||
if (!stage->bundle[cntBundle].image[0])
|
||||
{
|
||||
ri.Printf( PRINT_WARNING, "WARNING: R_FindImageFile could not find '%s' in shader '%s'\n", token, shader.name );
|
||||
ri.Printf(PRINT_WARNING, "WARNING: R_FindImageFile could not find '%s' in shader '%s'\n", token, shader.name);
|
||||
return qfalse;
|
||||
}
|
||||
}
|
||||
@@ -720,19 +721,58 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
|
||||
//
|
||||
// clampmap <name>
|
||||
//
|
||||
else if ( !Q_stricmp( token, "clampmap" ) )
|
||||
else if (!Q_stricmpn(token, "clampmap", 8))
|
||||
{
|
||||
token = COM_ParseExt( text, qfalse );
|
||||
if ( !token[0] )
|
||||
int clampx, clampy;
|
||||
|
||||
if (!token[8]) {
|
||||
if (!r_forceClampToEdge->value) {
|
||||
clampx = GL_CLAMP;
|
||||
clampy = GL_CLAMP;
|
||||
}
|
||||
else {
|
||||
clampx = GL_CLAMP_TO_EDGE;
|
||||
clampy = GL_CLAMP_TO_EDGE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (token[8] == 'x')
|
||||
{
|
||||
if (!r_forceClampToEdge->value) {
|
||||
clampx = GL_CLAMP;
|
||||
}
|
||||
else {
|
||||
clampx = GL_CLAMP_TO_EDGE;
|
||||
}
|
||||
clampy = GL_CLAMP;
|
||||
}
|
||||
else if (token[8] == 'y')
|
||||
{
|
||||
clampx = GL_CLAMP;
|
||||
if (!r_forceClampToEdge->value) {
|
||||
clampy = GL_CLAMP;
|
||||
}
|
||||
else {
|
||||
clampy = GL_CLAMP_TO_EDGE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ri.Printf(PRINT_WARNING, "WARNING: Converting unknown clampmap type to clampmap\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
token = COM_ParseExt(text, qfalse);
|
||||
if (!token[0])
|
||||
{
|
||||
ri.Printf( PRINT_WARNING, "WARNING: missing parameter for 'clampmap' keyword in shader '%s'\n", shader.name );
|
||||
ri.Printf(PRINT_WARNING, "WARNING: missing parameter for 'clampmap' keyword in shader '%s'\n", shader.name);
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
stage->bundle[cntBundle].image[0] = R_FindImageFile(token, !stage->noMipMaps, !stage->noPicMip, qfalse, r_forceClampToEdge->value ? GL_CLAMP_TO_EDGE : GL_CLAMP, r_forceClampToEdge->value ? GL_CLAMP_TO_EDGE : GL_CLAMP);
|
||||
if ( !stage->bundle[cntBundle].image[0] )
|
||||
stage->bundle[cntBundle].image[0] = R_FindImageFile(token, !stage->noMipMaps, !stage->noPicMip, qfalse, clampx, clampy);
|
||||
if (!stage->bundle[cntBundle].image[0])
|
||||
{
|
||||
ri.Printf( PRINT_WARNING, "WARNING: R_FindImageFile could not find '%s' in shader '%s'\n", token, shader.name );
|
||||
ri.Printf(PRINT_WARNING, "WARNING: R_FindImageFile could not find '%s' in shader '%s'\n", token, shader.name);
|
||||
return qfalse;
|
||||
}
|
||||
}
|
||||
@@ -871,6 +911,60 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
|
||||
ParseWaveForm( text, &stage->rgbWave );
|
||||
stage->rgbGen = CGEN_WAVEFORM;
|
||||
}
|
||||
else if (!Q_stricmp(token, "colorwave"))
|
||||
{
|
||||
vec3_t v;
|
||||
|
||||
ParseVector(text, 3, v);
|
||||
stage->colorConst[0] = v[0] * 255.0;
|
||||
stage->colorConst[1] = v[1] * 255.0;
|
||||
stage->colorConst[2] = v[2] * 255.0;
|
||||
stage->rgbGen = CGEN_MULTIPLY_BY_WAVEFORM;
|
||||
shader.flags |= 2;
|
||||
}
|
||||
else if (!Q_stricmp(token, "identity"))
|
||||
{
|
||||
stage->rgbGen = CGEN_IDENTITY;
|
||||
}
|
||||
else if (!Q_stricmp(token, "identityLighting"))
|
||||
{
|
||||
stage->rgbGen = CGEN_IDENTITY_LIGHTING;
|
||||
}
|
||||
else if (!Q_stricmp(token, "global"))
|
||||
{
|
||||
stage->rgbGen = CGEN_GLOBAL_COLOR;
|
||||
}
|
||||
else if (!Q_stricmp(token, "entity") || !Q_stricmp(token, "fromentity"))
|
||||
{
|
||||
stage->rgbGen = CGEN_ENTITY;
|
||||
}
|
||||
else if (!Q_stricmp(token, "oneMinusEntity"))
|
||||
{
|
||||
stage->rgbGen = CGEN_ONE_MINUS_ENTITY;
|
||||
}
|
||||
else if (!Q_stricmp(token, "vertex") || !Q_stricmp(token, "fromclient"))
|
||||
{
|
||||
stage->rgbGen = CGEN_VERTEX;
|
||||
if (stage->alphaGen == 0) {
|
||||
stage->alphaGen = AGEN_VERTEX;
|
||||
}
|
||||
}
|
||||
else if (!Q_stricmp(token, "exactVertex"))
|
||||
{
|
||||
stage->rgbGen = CGEN_EXACT_VERTEX;
|
||||
}
|
||||
else if (!Q_stricmp(token, "lightingGrid"))
|
||||
{
|
||||
stage->rgbGen = CGEN_LIGHTING_GRID;
|
||||
}
|
||||
else if (!Q_stricmp(token, "lightingSpherical"))
|
||||
{
|
||||
stage->rgbGen = CGEN_LIGHTING_SPHERICAL;
|
||||
}
|
||||
else if (!Q_stricmp(token, "oneMinusVertex"))
|
||||
{
|
||||
stage->rgbGen = CGEN_ONE_MINUS_VERTEX;
|
||||
}
|
||||
else if ( !Q_stricmp( token, "const" ) || !Q_stricmp(token, "constant"))
|
||||
{
|
||||
vec3_t color;
|
||||
@@ -882,44 +976,91 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
|
||||
|
||||
stage->rgbGen = CGEN_CONSTANT;
|
||||
}
|
||||
else if ( !Q_stricmp( token, "identity" ) )
|
||||
else if (!Q_stricmp(token, "static"))
|
||||
{
|
||||
stage->rgbGen = CGEN_IDENTITY;
|
||||
}
|
||||
else if ( !Q_stricmp( token, "identityLighting" ) )
|
||||
{
|
||||
stage->rgbGen = CGEN_IDENTITY_LIGHTING;
|
||||
}
|
||||
else if ( !Q_stricmp( token, "entity" ) )
|
||||
{
|
||||
stage->rgbGen = CGEN_ENTITY;
|
||||
}
|
||||
else if ( !Q_stricmp( token, "oneMinusEntity" ) )
|
||||
{
|
||||
stage->rgbGen = CGEN_ONE_MINUS_ENTITY;
|
||||
}
|
||||
else if ( !Q_stricmp( token, "vertex" ) )
|
||||
{
|
||||
stage->rgbGen = CGEN_VERTEX;
|
||||
if ( stage->alphaGen == 0 ) {
|
||||
stage->rgbGen = CGEN_STATIC;
|
||||
if (stage->alphaGen == AGEN_IDENTITY) {
|
||||
stage->alphaGen = AGEN_VERTEX;
|
||||
}
|
||||
}
|
||||
else if ( !Q_stricmp( token, "exactVertex" ) )
|
||||
else if (!Q_stricmp(token, "sCoord") || !Q_stricmp(token, "tCoord"))
|
||||
{
|
||||
stage->rgbGen = CGEN_EXACT_VERTEX;
|
||||
if (!Q_stricmp(token, "sCoord")) {
|
||||
stage->rgbGen = CGEN_SCOORD;
|
||||
}
|
||||
else {
|
||||
stage->rgbGen = CGEN_TCOORD;
|
||||
}
|
||||
|
||||
stage->alphaMin = 0.0;
|
||||
stage->alphaMax = 1.0;
|
||||
stage->alphaConstMin = 0;
|
||||
stage->alphaConst = -1;
|
||||
|
||||
token = COM_ParseExt(text, qfalse);
|
||||
if (token[0] == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
stage->alphaMin = atof(token);
|
||||
|
||||
token = COM_ParseExt(text, qfalse);
|
||||
if (token[0] == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
stage->alphaMax = atof(token);
|
||||
|
||||
token = COM_ParseExt(text, qfalse);
|
||||
if (token[0] == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
stage->alphaConstMin = atof(token) * 255.0;
|
||||
|
||||
token = COM_ParseExt(text, qfalse);
|
||||
if (token[0] == 0) {
|
||||
ri.Printf(PRINT_WARNING, "WARNING: missing rgbGen sCoord or tCoord parm 'max' in shader '%s'\n", shader.name);
|
||||
continue;
|
||||
}
|
||||
|
||||
stage->alphaConst = atof(token) * 255.0;
|
||||
}
|
||||
else if ( !Q_stricmp( token, "lightingGrid" ) )
|
||||
else if (!Q_stricmp(token, "dot"))
|
||||
{
|
||||
stage->rgbGen = CGEN_LIGHTING_GRID;
|
||||
}
|
||||
else if ( !Q_stricmp( token, "lightingSpherical" ) )
|
||||
stage->rgbGen = CGEN_DOT;
|
||||
stage->alphaMin = 0.0;
|
||||
stage->alphaMax = 1.0;
|
||||
|
||||
token = COM_ParseExt(text, qfalse);
|
||||
if (token[0] == 0) {
|
||||
continue;
|
||||
}
|
||||
stage->alphaMin = atof(token);
|
||||
|
||||
token = COM_ParseExt(text, qfalse);
|
||||
if (token[0] == 0) {
|
||||
continue;
|
||||
}
|
||||
stage->alphaMax = atof(token);
|
||||
}
|
||||
else if (!Q_stricmp(token, "oneminusdot"))
|
||||
{
|
||||
stage->rgbGen = CGEN_LIGHTING_SPHERICAL;
|
||||
}
|
||||
else if ( !Q_stricmp( token, "oneMinusVertex" ) )
|
||||
{
|
||||
stage->rgbGen = CGEN_ONE_MINUS_VERTEX;
|
||||
stage->rgbGen = CGEN_ONE_MINUS_DOT;
|
||||
stage->alphaMin = 0.0;
|
||||
stage->alphaMax = 1.0;
|
||||
|
||||
token = COM_ParseExt(text, qfalse);
|
||||
if (token[0] == 0) {
|
||||
continue;
|
||||
}
|
||||
stage->alphaMin = atof(token);
|
||||
|
||||
token = COM_ParseExt(text, qfalse);
|
||||
if (token[0] == 0) {
|
||||
continue;
|
||||
}
|
||||
stage->alphaMax = atof(token);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1539,7 +1680,12 @@ static void ParseSkyParms( char **text ) {
|
||||
for (i=0 ; i<6 ; i++) {
|
||||
Com_sprintf( pathname, sizeof(pathname), "%s_%s.tga"
|
||||
, token, suf[i] );
|
||||
shader.sky.outerbox[i] = R_FindImageFile( ( char * ) pathname, qtrue, qtrue, qfalse, GL_CLAMP, GL_CLAMP );
|
||||
if (!r_forceClampToEdge->integer) {
|
||||
shader.sky.outerbox[i] = R_FindImageFile((char*)pathname, qtrue, qtrue, shader_force32bit, GL_CLAMP, GL_CLAMP);
|
||||
}
|
||||
else {
|
||||
shader.sky.outerbox[i] = R_FindImageFile((char*)pathname, qtrue, qtrue, shader_force32bit, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE);
|
||||
}
|
||||
if ( !shader.sky.outerbox[i] ) {
|
||||
shader.sky.outerbox[i] = tr.defaultImage;
|
||||
}
|
||||
@@ -1569,7 +1715,7 @@ static void ParseSkyParms( char **text ) {
|
||||
for (i=0 ; i<6 ; i++) {
|
||||
Com_sprintf( pathname, sizeof(pathname), "%s_%s.tga"
|
||||
, token, suf[i] );
|
||||
shader.sky.outerbox[i] = R_FindImageFile( ( char * ) pathname, qtrue, qtrue, qfalse, GL_REPEAT, GL_REPEAT );
|
||||
shader.sky.outerbox[i] = R_FindImageFile( ( char * ) pathname, qtrue, qtrue, shader_force32bit, GL_REPEAT, GL_REPEAT );
|
||||
if ( !shader.sky.innerbox[i] ) {
|
||||
shader.sky.innerbox[i] = tr.defaultImage;
|
||||
}
|
||||
@@ -1953,6 +2099,14 @@ static qboolean ParseShader( char **text )
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if (!(shader.flags & 2)) {
|
||||
shader.flags &= ~1;
|
||||
}
|
||||
|
||||
if ((shader.contentFlags & CONTENTS_FENCE) != 0 && shader.cullType == CT_TWO_SIDED) {
|
||||
shader.cullType = CT_FRONT_SIDED;
|
||||
}
|
||||
|
||||
shader.explicitlyDefined = qtrue;
|
||||
|
||||
return qtrue;
|
||||
@@ -2009,7 +2163,7 @@ static void ComputeStageIteratorFunc( void )
|
||||
{
|
||||
if ( !shader.numDeforms )
|
||||
{
|
||||
shader.optimalStageIteratorFunc = RB_StageIteratorVertexLitTexture;
|
||||
shader.optimalStageIteratorFunc = RB_StageIteratorVertexLitTextureUnfogged;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@@ -2035,7 +2189,7 @@ static void ComputeStageIteratorFunc( void )
|
||||
{
|
||||
if (unfoggedStages[0].multitextureEnv )
|
||||
{
|
||||
shader.optimalStageIteratorFunc = RB_StageIteratorLightmappedMultitexture;
|
||||
shader.optimalStageIteratorFunc = RB_StageIteratorLightmappedMultitextureUnfogged;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@@ -2530,16 +2684,16 @@ static shader_t *FinishShader( void ) {
|
||||
//
|
||||
// default texture coordinate generation
|
||||
//
|
||||
for (bundle = 2; bundle > 0; bundle--) {
|
||||
if (pStage->bundle[bundle - 1].isLightmap) {
|
||||
if (pStage->bundle[bundle - 1].tcGen == TCGEN_BAD) {
|
||||
pStage->bundle[bundle - 1].tcGen = TCGEN_LIGHTMAP;
|
||||
for (bundle = 0; bundle < 2; bundle++) {
|
||||
if (pStage->bundle[bundle].isLightmap) {
|
||||
if (pStage->bundle[bundle].tcGen == TCGEN_BAD) {
|
||||
pStage->bundle[bundle].tcGen = TCGEN_LIGHTMAP;
|
||||
}
|
||||
hasLightmapStage = qtrue;
|
||||
}
|
||||
else {
|
||||
if (pStage->bundle[bundle - 1].tcGen == TCGEN_BAD) {
|
||||
pStage->bundle[bundle - 1].tcGen = TCGEN_TEXTURE;
|
||||
if (pStage->bundle[bundle].tcGen == TCGEN_BAD) {
|
||||
pStage->bundle[bundle].tcGen = TCGEN_TEXTURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2552,31 +2706,6 @@ static shader_t *FinishShader( void ) {
|
||||
pStage->bundle[0] = pStage->bundle[1];
|
||||
pStage->bundle[1] = tmpBundle;
|
||||
}
|
||||
|
||||
//
|
||||
// determine sort order and fog color adjustment
|
||||
//
|
||||
if ( ( pStage->stateBits & ( GLS_SRCBLEND_BITS | GLS_DSTBLEND_BITS ) ) &&
|
||||
( unfoggedStages[0].stateBits & ( GLS_SRCBLEND_BITS | GLS_DSTBLEND_BITS ) ) ) {
|
||||
int blendSrcBits = pStage->stateBits & GLS_SRCBLEND_BITS;
|
||||
int blendDstBits = pStage->stateBits & GLS_DSTBLEND_BITS;
|
||||
|
||||
// don't screw with sort order if this is a portal or environment
|
||||
if ( !shader.sort ) {
|
||||
// see through item, like a grill or grate
|
||||
if ( pStage->stateBits & GLS_DEPTHMASK_TRUE ) {
|
||||
shader.sort = SS_SEE_THROUGH;
|
||||
} else {
|
||||
shader.sort = SS_BLEND0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// there are times when you will need to manually apply a sort to
|
||||
// opaque alpha tested shaders that have later blend passes
|
||||
if ( !shader.sort ) {
|
||||
shader.sort = SS_OPAQUE;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -2645,7 +2774,7 @@ static shader_t *FinishShader( void ) {
|
||||
}
|
||||
|
||||
// fogonly shaders don't have any normal passes
|
||||
if (shader.sort == SS_BAD) {
|
||||
if (!shader.sort) {
|
||||
shader.sort = SS_OPAQUE;
|
||||
}
|
||||
|
||||
@@ -2735,17 +2864,22 @@ shader_t* R_FindShader(const char* name, int lightmapIndex, qboolean mipRawImage
|
||||
// with that same strippedName a new default shader is created.
|
||||
if (!Q_stricmp(currentShader->name, strippedName))
|
||||
{
|
||||
if (currentShader->shader && (currentShader->shader->lightmapIndex == lightmapIndex || currentShader->shader->defaultShader))
|
||||
{
|
||||
// match found
|
||||
return currentShader->shader;
|
||||
}
|
||||
// shader text found, but it has no shared assigned
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!currentShader) {
|
||||
if (currentShader)
|
||||
{
|
||||
for (sh = currentShader->shader; sh; sh = sh->next)
|
||||
{
|
||||
if (sh->lightmapIndex == lightmapIndex || sh == tr.defaultShader) {
|
||||
return sh;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// create a new shader text
|
||||
currentShader = AddShaderTextToHash(strippedName, hash);
|
||||
}
|
||||
@@ -2940,6 +3074,11 @@ qhandle_t RE_RegisterShaderNoMip( const char *name ) {
|
||||
return sh->index;
|
||||
}
|
||||
|
||||
qhandle_t RE_RefreshShaderNoMip(const char* name) {
|
||||
// FIXME: unimplemented
|
||||
// Workaround
|
||||
return RE_RegisterShaderNoMip(name);
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
@@ -3016,9 +3155,9 @@ void R_ShaderList_f (void) {
|
||||
ri.Printf( PRINT_ALL, "gen " );
|
||||
} else if ( shader->optimalStageIteratorFunc == RB_StageIteratorSky ) {
|
||||
ri.Printf( PRINT_ALL, "sky " );
|
||||
} else if ( shader->optimalStageIteratorFunc == RB_StageIteratorLightmappedMultitexture ) {
|
||||
} else if ( shader->optimalStageIteratorFunc == RB_StageIteratorLightmappedMultitextureUnfogged ) {
|
||||
ri.Printf( PRINT_ALL, "lmmt" );
|
||||
} else if ( shader->optimalStageIteratorFunc == RB_StageIteratorVertexLitTexture ) {
|
||||
} else if ( shader->optimalStageIteratorFunc == RB_StageIteratorVertexLitTextureUnfogged ) {
|
||||
ri.Printf( PRINT_ALL, "vlt " );
|
||||
} else {
|
||||
ri.Printf( PRINT_ALL, " " );
|
||||
|
||||
@@ -811,7 +811,7 @@ void RB_StageIteratorSky( void ) {
|
||||
if ( r_showsky->integer ) {
|
||||
qglDepthRange( 0.0, 0.0 );
|
||||
} else {
|
||||
qglDepthRange( 1.0, 1.0 );
|
||||
qglDepthRange( 1.875, 1.875 );
|
||||
}
|
||||
|
||||
// draw the outer skybox
|
||||
|
||||
@@ -24,13 +24,40 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "tr_local.h"
|
||||
|
||||
vec3_t spheredef[6];
|
||||
suninfo_t s_sun;
|
||||
static vec3_t ambientlight;
|
||||
static qboolean bEntityOverbright;
|
||||
static int iEntityLightingMax;
|
||||
static int light_reference_count = 0;
|
||||
|
||||
int compare_light_intensities(const void* p1, const void* p2)
|
||||
{
|
||||
return ((const reallightinfo_t*)p2)->fIntensity - ((const reallightinfo_t*)p1)->fIntensity;
|
||||
}
|
||||
|
||||
static void RB_OptimizeLights()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
static void RB_Light_CubeMap(const color4ub_t colors)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void RB_Light_Real(const color4ub_t colors)
|
||||
void RB_Light_Real(unsigned char* colors)
|
||||
{
|
||||
int i, j;
|
||||
float* normal;
|
||||
float* xyz;
|
||||
unsigned char* color;
|
||||
vec3_t v;
|
||||
vec3_t colorout;
|
||||
float fDot;
|
||||
reallightinfo_t* pLight;
|
||||
|
||||
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
@@ -42,16 +69,90 @@ static void RB_Sphere_Light_Sun()
|
||||
static qboolean RB_Sphere_CalculateSphereOrigin()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
static bool RB_Sphere_SetupGlobals()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
int i;
|
||||
|
||||
if (backEnd.refdef.rdflags & RDF_NOWORLDMODEL) {
|
||||
if (!(backEnd.refdef.rdflags & RDF_FULLBRIGHT)) {
|
||||
backEnd.currentSphere->TessFunction = &RB_Light_Fullbright;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!(backEnd.refdef.rdflags & RDF_FULLBRIGHT)) {
|
||||
if (!RB_Sphere_CalculateSphereOrigin()) {
|
||||
backEnd.currentSphere->TessFunction = &RB_CalcLightGridColor;
|
||||
|
||||
if (!backEnd.currentEntity->bLightGridCalculated) {
|
||||
RB_SetupEntityGridLighting();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (backEnd.refdef.vieworg[0] == 0 && backEnd.refdef.vieworg[1] == 0 && backEnd.refdef.vieworg[2] == 0) {
|
||||
backEnd.currentSphere->TessFunction = &RB_Light_Fullbright;
|
||||
return false;
|
||||
}
|
||||
|
||||
VectorCopy(backEnd.refdef.vieworg, backEnd.currentSphere->worldOrigin);
|
||||
VectorClear(backEnd.currentSphere->origin);
|
||||
backEnd.currentSphere->radius = 2.0;
|
||||
}
|
||||
|
||||
light_reference_count++;
|
||||
for (i = 0; i < 8; i++) {
|
||||
backEnd.currentSphere->leaves[i] = 0;
|
||||
}
|
||||
|
||||
R_SphereInLeafs(backEnd.currentSphere->worldOrigin, backEnd.currentSphere->radius, backEnd.currentSphere->leaves, 8);
|
||||
|
||||
backEnd.currentSphere->TessFunction = &RB_Light_Real;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool RB_Sphere_ResetPointColors()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
vec3_t light_offset, amb;
|
||||
|
||||
R_GetLightingGridValue(backEnd.currentSphere->worldOrigin, light_offset);
|
||||
light_offset[0] = ambientlight[0] + light_offset[0] * 0.18;
|
||||
light_offset[1] = ambientlight[1] + light_offset[1] * 0.18;
|
||||
light_offset[2] = ambientlight[2] + light_offset[2] * 0.18;
|
||||
if (tr.refdef.rdflags & RDF_FULLBRIGHT)
|
||||
{
|
||||
float fMin = tr.identityLight * 20.0;
|
||||
|
||||
if (fMin <= light_offset[0] || fMin <= light_offset[1] || fMin <= light_offset[2]) {
|
||||
light_offset[0] += fMin;
|
||||
light_offset[1] += fMin;
|
||||
light_offset[2] += fMin;
|
||||
}
|
||||
}
|
||||
|
||||
backEnd.currentSphere->ambient.level[0] = r_entlight_scale->value * tr.overbrightMult * light_offset[0];
|
||||
if (backEnd.currentSphere->ambient.level[0] >= 255.0) {
|
||||
backEnd.currentSphere->ambient.level[0] = -1;
|
||||
}
|
||||
|
||||
backEnd.currentSphere->ambient.level[1] = r_entlight_scale->value * tr.overbrightMult * light_offset[0];
|
||||
if (backEnd.currentSphere->ambient.level[1] >= 255.0) {
|
||||
backEnd.currentSphere->ambient.level[1] = -1;
|
||||
}
|
||||
|
||||
backEnd.currentSphere->ambient.level[2] = r_entlight_scale->value * tr.overbrightMult * light_offset[0];
|
||||
if (backEnd.currentSphere->ambient.level[2] >= 255.0) {
|
||||
backEnd.currentSphere->ambient.level[2] = -1;
|
||||
}
|
||||
|
||||
backEnd.currentSphere->ambient.level[3] = -1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void RB_Sphere_DrawDebugLine(const spherel_t* thislight, float falloff, const vec3_t origin)
|
||||
@@ -81,7 +182,19 @@ void RB_Sphere_BuildDLights()
|
||||
|
||||
void RB_Sphere_SetupEntity()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
if (r_light_nolight->integer)
|
||||
{
|
||||
backEnd.currentSphere->TessFunction = &RB_Light_Fullbright;
|
||||
}
|
||||
else if (RB_Sphere_SetupGlobals() && RB_Sphere_ResetPointColors())
|
||||
{
|
||||
backEnd.currentSphere->numRealLights = 0;
|
||||
RB_Sphere_Light_Sun();
|
||||
RB_Sphere_BuildStaticLights();
|
||||
RB_Sphere_BuildDLights();
|
||||
backEnd.pc.c_characterlights += backEnd.currentSphere->numRealLights;
|
||||
RB_OptimizeLights();
|
||||
}
|
||||
}
|
||||
|
||||
void RB_Grid_SetupEntity()
|
||||
@@ -91,17 +204,103 @@ void RB_Grid_SetupEntity()
|
||||
|
||||
void RB_Grid_SetupStaticModel()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
RB_SetupStaticModelGridLighting(&tr.refdef, backEnd.currentStaticModel, backEnd.currentStaticModel->origin);
|
||||
}
|
||||
|
||||
void RB_Light_Fullbright(const color4ub_t colors)
|
||||
void RB_Light_Fullbright(unsigned char* colors)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
memset((void*)colors, 0xFF, tess.numVertexes);
|
||||
}
|
||||
|
||||
void R_Sphere_InitLights()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
const char* ents;
|
||||
const char* ret;
|
||||
qboolean bFlareDirSet;
|
||||
|
||||
ents = ri.CM_EntityString();
|
||||
bFlareDirSet = qfalse;
|
||||
s_sun.szFlareName[0] = 0;
|
||||
s_sun.exists = qfalse;
|
||||
|
||||
for (int i = 0; i < 128; i++) {
|
||||
backEnd.spheres[i].TessFunction = &RB_Light_Real;
|
||||
}
|
||||
|
||||
VectorClear(ambientlight);
|
||||
backEnd.spareSphere.TessFunction = &RB_Light_Real;
|
||||
backEnd.currentSphere = &backEnd.spareSphere;
|
||||
bEntityOverbright = qfalse;
|
||||
iEntityLightingMax = tr.identityLightByte;
|
||||
s_sun.color[0] = s_sun.color[1] = s_sun.color[2] = tr.overbrightMult * 70;
|
||||
|
||||
while (ents)
|
||||
{
|
||||
ret = COM_Parse((char**)&ents);
|
||||
if (*ret == '{' || *ret == '}') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strcmp(ret, "suncolor") || !strcmp(ret, "sunlight"))
|
||||
{
|
||||
sscanf(COM_Parse((char**)&ents), "%f %f %f", &s_sun.color[0], &s_sun.color[1], &s_sun.color[2]);
|
||||
s_sun.color[0] *= tr.overbrightMult;
|
||||
s_sun.color[1] *= tr.overbrightMult;
|
||||
s_sun.color[2] *= tr.overbrightMult;
|
||||
s_sun.exists = qtrue;
|
||||
}
|
||||
else if (!strcmp(ret, "sundirection"))
|
||||
{
|
||||
vec3_t dir;
|
||||
|
||||
sscanf(COM_Parse((char**)&ents), "%f %f %f", &dir[0], &dir[1], &dir[2]);
|
||||
AngleVectorsLeft(dir, s_sun.direction, 0, 0);
|
||||
|
||||
s_sun.exists = qtrue;
|
||||
if (!bFlareDirSet)
|
||||
{
|
||||
s_sun.flaredirection[0] = s_sun.direction[0];
|
||||
s_sun.flaredirection[1] = s_sun.direction[1];
|
||||
s_sun.flaredirection[2] = s_sun.direction[2];
|
||||
}
|
||||
}
|
||||
else if (!strcmp(ret, "sunflaredirection"))
|
||||
{
|
||||
vec3_t dir;
|
||||
|
||||
sscanf(COM_Parse((char**)&ents), "%f %f %f", &dir[0], &dir[1], &dir[2]);
|
||||
AngleVectorsLeft(dir, s_sun.flaredirection, 0, 0);
|
||||
bFlareDirSet = qtrue;
|
||||
}
|
||||
else if (!strcmp(ret, "sunflarename"))
|
||||
{
|
||||
strcpy(s_sun.szFlareName, COM_Parse((char**)&ents));
|
||||
}
|
||||
else if (!strcmp(ret, "ambientlight"))
|
||||
{
|
||||
sscanf(COM_Parse((char**)&ents), "%f %f %f", &ambientlight[0], &ambientlight[1], &ambientlight[2]);
|
||||
}
|
||||
else if (!strcmp(ret, "overbright"))
|
||||
{
|
||||
ret = COM_Parse((char**)&ents);
|
||||
if (strcmp(ret, "world") || strcmp(ret, "none"))
|
||||
{
|
||||
bEntityOverbright = qtrue;
|
||||
iEntityLightingMax = 0xFF;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
COM_Parse((char**)&ents);
|
||||
}
|
||||
}
|
||||
|
||||
if (s_sun.exists)
|
||||
{
|
||||
if (!s_sun.szFlareName[0]) {
|
||||
strcpy(s_sun.szFlareName, "sun");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int R_GatherLightSources(const vec3_t vPos, vec3_t* pvLightPos, vec3_t* pvLightIntensity, int iMaxLights)
|
||||
|
||||
@@ -60,7 +60,7 @@ void R_InitStaticModels(void) {
|
||||
{
|
||||
float t;
|
||||
|
||||
t = 255.0 / (float)max(r, max(g, b));
|
||||
t = 255.0 / (float)Q_max(r, Q_max(g, b));
|
||||
|
||||
r = (int)((float)r * t);
|
||||
g = (int)((float)g * t);
|
||||
@@ -114,7 +114,7 @@ void R_InitStaticModels(void) {
|
||||
surf->hShader[k] = sh->index;
|
||||
}
|
||||
else {
|
||||
surf->hShader[k] = NULL;
|
||||
surf->hShader[k] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -390,7 +390,34 @@ void R_AddStaticModelSurfaces(void) {
|
||||
|
||||
void RB_Static_BuildDLights()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
int i;
|
||||
|
||||
backEnd.currentStaticModel->useSpecialLighting = backEnd.refdef.num_dlights > 0;
|
||||
backEnd.currentStaticModel->numdlights = 0;
|
||||
|
||||
if (!backEnd.currentStaticModel->useSpecialLighting) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < backEnd.refdef.num_dlights && backEnd.currentStaticModel->numdlights != 32; i++) {
|
||||
vec3_t lightorigin, delta;
|
||||
|
||||
VectorCopy(backEnd.refdef.dlights[i].origin, lightorigin);
|
||||
VectorSubtract(lightorigin, backEnd.currentStaticModel->origin, delta);
|
||||
if (backEnd.refdef.dlights[i].radius * 2.0 >= VectorLength(delta)) {
|
||||
MatrixTransformVectorRight(
|
||||
backEnd.currentStaticModel->axis,
|
||||
delta,
|
||||
backEnd.currentStaticModel->dlights[backEnd.currentStaticModel->numdlights].transformed
|
||||
);
|
||||
|
||||
backEnd.currentStaticModel->dlights[backEnd.currentStaticModel->numdlights++].index = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (!backEnd.currentStaticModel->numdlights) {
|
||||
backEnd.currentStaticModel->useSpecialLighting = qfalse;
|
||||
}
|
||||
}
|
||||
|
||||
void R_InfoStaticModels_f()
|
||||
@@ -476,7 +503,9 @@ void RB_StaticMesh(staticSurface_t* staticSurf) {
|
||||
Vector4Copy(surf->pStaticXyz[j], tess.xyz[baseVertex + j]);
|
||||
Vector4Copy(surf->pStaticNormal[j], tess.normal[baseVertex + j]);
|
||||
tess.texCoords[baseVertex + j][0][0] = surf->pStaticTexCoords[j][0][0];
|
||||
tess.texCoords[baseVertex + j][0][1] = surf->pStaticTexCoords[j][0][1];
|
||||
tess.texCoords[baseVertex + j][0][1] = surf->pStaticTexCoords[j][0][1];
|
||||
tess.texCoords[baseVertex + j][1][0] = surf->pStaticTexCoords[j][1][0];
|
||||
tess.texCoords[baseVertex + j][1][1] = surf->pStaticTexCoords[j][1][1];
|
||||
}
|
||||
|
||||
if (backEndData[backEnd.smpFrame]->staticModelData) {
|
||||
|
||||
@@ -28,3 +28,8 @@ void R_InitLensFlare()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void R_DrawLensFlares()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
+33
-11
@@ -343,6 +343,7 @@ RB_SurfaceFace
|
||||
*/
|
||||
void RB_SurfaceFace( srfSurfaceFace_t *surf ) {
|
||||
int i;
|
||||
qboolean needsNormal;
|
||||
unsigned *indices, *tessIndexes;
|
||||
float *v;
|
||||
float *normal;
|
||||
@@ -366,27 +367,48 @@ void RB_SurfaceFace( srfSurfaceFace_t *surf ) {
|
||||
|
||||
tess.numIndexes += surf->numIndices;
|
||||
|
||||
numPoints = surf->numPoints;
|
||||
|
||||
needsNormal = qfalse;
|
||||
if (tess.shader->needsNormal || tess.shader->needsLSpherical || tr.refdef.num_dlights) {
|
||||
needsNormal = qtrue;
|
||||
}
|
||||
|
||||
v = surf->points[0];
|
||||
|
||||
ndx = tess.numVertexes;
|
||||
|
||||
numPoints = surf->numPoints;
|
||||
|
||||
if ( tess.shader->needsNormal || tess.shader->needsLSpherical || tr.refdef.num_dlights ) {
|
||||
if (needsNormal) {
|
||||
normal = surf->plane.normal;
|
||||
for ( i = 0, ndx = tess.numVertexes; i < numPoints; i++, ndx++ ) {
|
||||
VectorCopy( normal, tess.normal[ndx] );
|
||||
}
|
||||
}
|
||||
|
||||
for ( i = 0, v = surf->points[0], ndx = tess.numVertexes; i < numPoints; i++, v += VERTEXSIZE, ndx++ ) {
|
||||
VectorCopy( v, tess.xyz[ndx]);
|
||||
tess.texCoords[ndx][0][0] = v[3];
|
||||
tess.texCoords[ndx][0][1] = v[4];
|
||||
tess.texCoords[ndx][1][0] = v[5];
|
||||
tess.texCoords[ndx][1][1] = v[6];
|
||||
* ( unsigned int * ) &tess.vertexColors[ndx] = * ( unsigned int * ) &v[7];
|
||||
tess.vertexDlightBits[ndx] = dlightBits;
|
||||
if (tess.dlightMap)
|
||||
{
|
||||
|
||||
for (i = 0, v = surf->points[0], ndx = tess.numVertexes; i < numPoints; i++, v += VERTEXSIZE, ndx++) {
|
||||
VectorCopy(v, tess.xyz[ndx]);
|
||||
tess.texCoords[ndx][0][0] = v[3];
|
||||
tess.texCoords[ndx][0][1] = v[4];
|
||||
tess.texCoords[ndx][1][0] = v[5] + surf->lightmapOffset[0];
|
||||
tess.texCoords[ndx][1][1] = v[6] + surf->lightmapOffset[1];
|
||||
*(unsigned int*)&tess.vertexColors[ndx] = *(unsigned int*)&v[7];
|
||||
tess.vertexDlightBits[ndx] = dlightBits;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0, v = surf->points[0], ndx = tess.numVertexes; i < numPoints; i++, v += VERTEXSIZE, ndx++) {
|
||||
VectorCopy(v, tess.xyz[ndx]);
|
||||
tess.texCoords[ndx][0][0] = v[3];
|
||||
tess.texCoords[ndx][0][1] = v[4];
|
||||
tess.texCoords[ndx][1][0] = v[5];
|
||||
tess.texCoords[ndx][1][1] = v[6];
|
||||
*(unsigned int*)&tess.vertexColors[ndx] = *(unsigned int*)&v[7];
|
||||
tess.vertexDlightBits[ndx] = dlightBits;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ static void R_ValidateHeightmapForVertex(terraTri_t* pTri)
|
||||
}
|
||||
}
|
||||
|
||||
static int R_AllocateVert(cTerraPatchUnpacked_t* patch)
|
||||
static terraInt R_AllocateVert(cTerraPatchUnpacked_t* patch)
|
||||
{
|
||||
terraInt iVert = g_vert.iFreeHead;
|
||||
|
||||
@@ -227,12 +227,13 @@ static void R_ReleaseTri(cTerraPatchUnpacked_t* patch, terraInt iTri)
|
||||
|
||||
static int R_ConstChecksForTri(terraTri_t* pTri)
|
||||
{
|
||||
varnodeUnpacked_t vn = *pTri->varnode;
|
||||
varnodeUnpacked_t vn;
|
||||
|
||||
if (pTri->lod == MAX_TERRAIN_LOD) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
vn = *pTri->varnode;
|
||||
vn.s.flags &= 0xF0u;
|
||||
|
||||
if (vn.fVariance == 0.0 && !(pTri->varnode->s.flags & 8)) {
|
||||
@@ -340,7 +341,7 @@ void R_SplitTri(terraInt iSplit, terraInt iNewPt, terraInt iLeft, terraInt iRigh
|
||||
|
||||
int iNextLod = pSplit->lod + 1;
|
||||
int index = pSplit->index;
|
||||
varnodeUnpacked_t* varnode = pSplit->varnode + index;
|
||||
varnodeUnpacked_t* varnode = &pSplit->varnode[index];
|
||||
|
||||
if (pLeft)
|
||||
{
|
||||
@@ -747,8 +748,8 @@ static void R_PreTessellateTerrain()
|
||||
const float t11 = patch->texCoord[1][1][1] - tMin;
|
||||
|
||||
const float lmapSize = (float)(patch->drawinfo.lmapSize - 1) / TERRAIN_LIGHTMAP_SIZE;
|
||||
const float ls = patch->s * lmapSize;
|
||||
const float lt = patch->t * lmapSize;
|
||||
const float ls = patch->s + lmapSize;
|
||||
const float lt = patch->t + lmapSize;
|
||||
|
||||
terraInt iTri0 = R_AllocateTri(patch, qfalse);
|
||||
terraInt iTri1 = R_AllocateTri(patch, qfalse);
|
||||
|
||||
@@ -539,7 +539,10 @@ static void R_RecursiveWorldNode( mnode_t *node, int planeBits, int dlightBits )
|
||||
|
||||
}
|
||||
|
||||
|
||||
int R_SphereInLeafs(vec_t* p, float r, mnode_t** nodes, int nMaxNodes) {
|
||||
// FIXME: unimplemented
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
===============
|
||||
R_PointInLeaf
|
||||
|
||||
+28
-6
@@ -439,9 +439,15 @@ gotnewcl:
|
||||
Com_DPrintf( "Going from CS_FREE to CS_CONNECTED for %s\n", newcl->name );
|
||||
|
||||
newcl->state = CS_CONNECTED;
|
||||
newcl->nextSnapshotTime = svs.time;
|
||||
newcl->lastPacketTime = svs.time;
|
||||
newcl->lastConnectTime = svs.time;
|
||||
if (sv_maxclients->integer > 1) {
|
||||
newcl->nextSnapshotTime = svs.time + 800;
|
||||
newcl->lastPacketTime = svs.time + 800;
|
||||
newcl->lastConnectTime = svs.time + 800;
|
||||
} else {
|
||||
newcl->nextSnapshotTime = svs.time + 300;
|
||||
newcl->lastPacketTime = svs.time + 300;
|
||||
newcl->lastConnectTime = svs.time + 300;
|
||||
}
|
||||
|
||||
// when we receive the first packet from the client, we will
|
||||
// notice that it is from a different serverid and that the
|
||||
@@ -530,6 +536,19 @@ void SV_DropClient( client_t *drop, const char *reason ) {
|
||||
}
|
||||
}
|
||||
|
||||
#if TARGET_GAME_PROTOCOL >= 15
|
||||
|
||||
void MSG_WriteServerFrameTime(msg_t* msg, float f) {
|
||||
MSG_WriteFloat(msg, f);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void MSG_WriteServerFrameTime(msg_t* msg, float f) {
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
SV_SendClientGameState
|
||||
@@ -583,7 +602,7 @@ void SV_SendClientGameState( client_t *client ) {
|
||||
if (sv.configstrings[start][0]) {
|
||||
MSG_WriteSVC( &msg, svc_configstring );
|
||||
MSG_WriteShort( &msg, start );
|
||||
MSG_WriteString( &msg, sv.configstrings[start] );
|
||||
MSG_WriteScrambledBigString( &msg, sv.configstrings[start] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -604,7 +623,10 @@ void SV_SendClientGameState( client_t *client ) {
|
||||
MSG_WriteLong( &msg, client - svs.clients);
|
||||
|
||||
// write the checksum feed
|
||||
MSG_WriteLong( &msg, sv.checksumFeed);
|
||||
MSG_WriteLong( &msg, 0);
|
||||
|
||||
// write the server frametime to the client (only on TA/TT)
|
||||
MSG_WriteServerFrameTime(&msg, sv.frameTime);
|
||||
|
||||
// deliver this to the client
|
||||
SV_SendMessageToClient( &msg, client );
|
||||
@@ -1310,7 +1332,7 @@ static qboolean SV_ClientCommand( client_t *cl, msg_t *msg ) {
|
||||
qboolean clientOk = qtrue;
|
||||
|
||||
seq = MSG_ReadLong( msg );
|
||||
s = MSG_ReadString( msg );
|
||||
s = MSG_ReadScrambledString( msg );
|
||||
|
||||
// see if we have already executed it
|
||||
if ( cl->lastClientCommand >= seq ) {
|
||||
|
||||
@@ -521,6 +521,7 @@ void SV_ClearServer(void) {
|
||||
}
|
||||
}
|
||||
Com_Memset (&sv, 0, sizeof(sv));
|
||||
sv.frameTime = 1.0 / sv_fps->value;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1012,7 +1013,7 @@ void SV_Init( void ) {
|
||||
sv_showloss = Cvar_Get ("sv_showloss", "0", 0);
|
||||
sv_padPackets = Cvar_Get ("sv_padPackets", "0", 0);
|
||||
sv_killserver = Cvar_Get ("sv_killserver", "0", 0);
|
||||
sv_mapChecksum = Cvar_Get ("sv_mapChecksum", "", CVAR_ROM);
|
||||
sv_mapChecksum = Cvar_Get ("sv_mapChecksum", "", CVAR_ROM | CVAR_SERVERINFO);
|
||||
sv_drawentities = Cvar_Get( "sv_drawentities", "1", 0 );
|
||||
sv_deeptracedebug = Cvar_Get( "sv_deeptracedebug", "0", 0 );
|
||||
sv_chatter = Cvar_Get( "sv_chatter", "0", 0 );
|
||||
|
||||
@@ -109,7 +109,7 @@ static void SV_EmitPacketEntities( clientSnapshot_t *from, clientSnapshot_t *to,
|
||||
}
|
||||
}
|
||||
|
||||
MSG_WriteBits( msg, (MAX_GENTITIES-1), GENTITYNUM_BITS ); // end of packetentities
|
||||
MSG_WriteEntityNum(msg, (MAX_GENTITIES - 1)); // end of packetentities
|
||||
}
|
||||
|
||||
|
||||
@@ -217,11 +217,11 @@ static void SV_WriteSnapshotToClient( client_t *client, msg_t *msg ) {
|
||||
MSG_WriteSVC( msg, svc_locprint );
|
||||
MSG_WriteShort( msg, client->XOffset );
|
||||
MSG_WriteShort( msg, client->YOffset );
|
||||
MSG_WriteString( msg, client->centerprint );
|
||||
MSG_WriteScrambledString( msg, client->centerprint );
|
||||
}
|
||||
else {
|
||||
MSG_WriteSVC( msg, svc_centerprint );
|
||||
MSG_WriteString( msg, client->centerprint );
|
||||
MSG_WriteScrambledString( msg, client->centerprint );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ void SV_UpdateServerCommandsToClient( client_t *client, msg_t *msg ) {
|
||||
for ( i = client->reliableAcknowledge + 1 ; i <= client->reliableSequence ; i++ ) {
|
||||
MSG_WriteSVC( msg, svc_serverCommand );
|
||||
MSG_WriteLong( msg, i );
|
||||
MSG_WriteString( msg, client->reliableCommands[ i & (MAX_RELIABLE_COMMANDS-1) ] );
|
||||
MSG_WriteScrambledString( msg, client->reliableCommands[ i & (MAX_RELIABLE_COMMANDS-1) ] );
|
||||
}
|
||||
client->reliableSent = client->reliableSequence;
|
||||
}
|
||||
|
||||
+26
-16
@@ -328,13 +328,24 @@ TIKI_ParseIncludes
|
||||
*/
|
||||
qboolean TIKI_ParseIncludes( dloaddef_t *ld )
|
||||
{
|
||||
const char *token;
|
||||
const char* token;
|
||||
qboolean b_incl = false;
|
||||
const char *mapname;
|
||||
const char* mapname;
|
||||
const char* servertype;
|
||||
int depth = 0;
|
||||
|
||||
token = ld->tikiFile.GetToken( true );
|
||||
if( sv_mapname )
|
||||
static cvar_t* pServerType = Cvar_Get("g_servertype", "2", 0);
|
||||
static cvar_t* pGameType = Cvar_Get("cg_gametype", "0", CVAR_SERVERINFO | CVAR_LATCH);
|
||||
|
||||
if (pGameType->integer && pServerType->integer == 1) {
|
||||
servertype = "spearheadserver";
|
||||
}
|
||||
else {
|
||||
servertype = "breakthroughserver";
|
||||
}
|
||||
|
||||
token = ld->tikiFile.GetToken(true);
|
||||
if (sv_mapname)
|
||||
{
|
||||
mapname = sv_mapname->string;
|
||||
}
|
||||
@@ -343,38 +354,37 @@ qboolean TIKI_ParseIncludes( dloaddef_t *ld )
|
||||
mapname = "utils";
|
||||
}
|
||||
|
||||
while( 1 )
|
||||
while (1)
|
||||
{
|
||||
if( !strncmp( token, mapname, strlen( token ) )
|
||||
|| !strncmp( token, "spearheadserver", strlen( token ) )
|
||||
|| !strncmp( token, "breakthroughserver", strlen( token ) ) )
|
||||
if (!strncmp(token, mapname, strlen(token))
|
||||
|| !strncmp(token, servertype, strlen(token)))
|
||||
{
|
||||
b_incl = true;
|
||||
}
|
||||
else if( ( !stricmp( token, "{" ) || !ld->tikiFile.TokenAvailable( true ) ) )
|
||||
else if ((!stricmp(token, "{") || !ld->tikiFile.TokenAvailable(true)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
token = ld->tikiFile.GetToken( true );
|
||||
token = ld->tikiFile.GetToken(true);
|
||||
}
|
||||
|
||||
if( b_incl )
|
||||
if (b_incl)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
while( ld->tikiFile.TokenAvailable( true ) )
|
||||
while (ld->tikiFile.TokenAvailable(true))
|
||||
{
|
||||
token = ld->tikiFile.GetAndIgnoreLine( false );
|
||||
if( strstr( token, "{" ) )
|
||||
token = ld->tikiFile.GetAndIgnoreLine(false);
|
||||
if (strstr(token, "{"))
|
||||
{
|
||||
depth++;
|
||||
}
|
||||
|
||||
if( strstr( token, "}" ) )
|
||||
if (strstr(token, "}"))
|
||||
{
|
||||
if( !depth )
|
||||
if (!depth)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ typedef struct uiimport_s {
|
||||
const char *( *Client_TranslateWidgetName )( const char *widget );
|
||||
void( *Connect )( const char *server );
|
||||
const char *( *Key_GetKeynameForCommand )( const char *command );
|
||||
char *( *Key_GetCommandForKey )( int keynum );
|
||||
const char *( *Key_GetCommandForKey )( int keynum );
|
||||
void ( *Key_SetBinding )( int keynum, const char *binding );
|
||||
void ( *Key_GetKeysForCommand )( const char *command, int *key1, int *key2 );
|
||||
const char *( *Key_KeynumToString )( int keynum );
|
||||
@@ -230,5 +230,7 @@ void UI_SetCvarInt( const char *cvar, int value );
|
||||
void UI_SetCvarFloat( const char *cvar, float value );
|
||||
void UI_ListFiles( const char *filespec );
|
||||
const char *UI_ConfigString( int index );
|
||||
void UI_UpdateCenterPrint(const char* s, float alpha);
|
||||
void UI_UpdateLocationPrint(int x, int y, const char* s, float alpha);
|
||||
|
||||
#endif
|
||||
+2
-2
@@ -44,8 +44,8 @@ public:
|
||||
void Pressed( void );
|
||||
void SetCommand( Event *ev );
|
||||
void SetCommand( str s );
|
||||
void DrawUnpressed( void );
|
||||
void DrawPressed( void );
|
||||
void DrawUnpressed( void ) override;
|
||||
void DrawPressed( void ) override;
|
||||
void Clear( void );
|
||||
qboolean KeyEvent( int key, unsigned int time ) override;
|
||||
void SetAlternate( qboolean a );
|
||||
|
||||
+14
-40
@@ -233,26 +233,13 @@ void UIButton::DrawPressed
|
||||
clientFrame.pos.x += 1;
|
||||
clientFrame.pos.y += 1;
|
||||
|
||||
if (m_bVirtual)
|
||||
{
|
||||
m_font->PrintJustified(
|
||||
clientFrame,
|
||||
m_iFontAlignmentHorizontal,
|
||||
m_iFontAlignmentVertical,
|
||||
Sys_LV_CL_ConvertString(m_title.c_str()),
|
||||
NULL
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_font->PrintJustified(
|
||||
clientFrame,
|
||||
m_iFontAlignmentHorizontal,
|
||||
m_iFontAlignmentVertical,
|
||||
Sys_LV_CL_ConvertString(m_title.c_str()),
|
||||
m_vVirtualScale
|
||||
);
|
||||
}
|
||||
m_font->PrintJustified(
|
||||
clientFrame,
|
||||
m_iFontAlignmentHorizontal,
|
||||
m_iFontAlignmentVertical,
|
||||
Sys_LV_CL_ConvertString(m_title.c_str()),
|
||||
m_bVirtual ? m_vVirtualScale : NULL
|
||||
);
|
||||
}
|
||||
|
||||
void UIButton::DrawUnpressed
|
||||
@@ -266,26 +253,13 @@ void UIButton::DrawUnpressed
|
||||
|
||||
UIRect2D clientFrame = getClientFrame();
|
||||
|
||||
if (m_bVirtual)
|
||||
{
|
||||
m_font->PrintJustified(
|
||||
clientFrame,
|
||||
m_iFontAlignmentHorizontal,
|
||||
m_iFontAlignmentVertical,
|
||||
Sys_LV_CL_ConvertString(m_title.c_str()),
|
||||
NULL
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_font->PrintJustified(
|
||||
clientFrame,
|
||||
m_iFontAlignmentHorizontal,
|
||||
m_iFontAlignmentVertical,
|
||||
Sys_LV_CL_ConvertString(m_title.c_str()),
|
||||
m_vVirtualScale
|
||||
);
|
||||
}
|
||||
m_font->PrintJustified(
|
||||
clientFrame,
|
||||
m_iFontAlignmentHorizontal,
|
||||
m_iFontAlignmentVertical,
|
||||
Sys_LV_CL_ConvertString(m_title.c_str()),
|
||||
m_bVirtual ? m_vVirtualScale : NULL
|
||||
);
|
||||
}
|
||||
|
||||
qboolean UIButton::KeyEvent
|
||||
|
||||
@@ -77,8 +77,6 @@ int UIConsole::getNextItem
|
||||
return -1;
|
||||
}
|
||||
|
||||
m_numitems = m_numitems;
|
||||
m_firstitem = m_firstitem;
|
||||
prev = prev + 1;
|
||||
|
||||
if (m_numitems < MAX_CONSOLE_ITEMS)
|
||||
@@ -827,16 +825,16 @@ void UIFloatingConsole::FrameInitialized
|
||||
m_status->setTitle(str());
|
||||
|
||||
m_console = new UIConsole();
|
||||
m_console->InitFrame(getChildSpace(), UIRect2D(0, 0, 20.0, 20.0), 0, "verdana-12");
|
||||
m_console->InitFrame(getChildSpace(), UIRect2D(0, 0, 20.0, 20.0), 0, "verdana-14");
|
||||
setConsoleColor(m_consoleColor);
|
||||
setConsoleBackground(m_consoleBackground, m_consoleAlpha);
|
||||
m_console->setConsoleHandler(m_handler);
|
||||
|
||||
Connect(this, W_SizeChanged, W_Console_ChildSizeChanged);
|
||||
getChildSpace()->Connect(this, W_SizeChanged, W_Console_ChildSizeChanged);
|
||||
getChildSpace()->AllowActivate(false);
|
||||
OnChildSizeChanged(NULL);
|
||||
|
||||
m_background_color.a = 1.0;
|
||||
m_background_color.a = 0.0;
|
||||
m_alpha = 1.0;
|
||||
|
||||
getChildSpace()->setBackgroundAlpha(1.0);
|
||||
@@ -907,6 +905,7 @@ void UIFloatingConsole::setConsoleBackground
|
||||
)
|
||||
|
||||
{
|
||||
m_alpha = alpha;
|
||||
m_consoleBackground = color;
|
||||
m_consoleAlpha = alpha;
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ void UIFloatingWindow::MinimizePressed
|
||||
// so the window can be restored later
|
||||
m_restoredHeight = size.height;
|
||||
size.height = 20.0;
|
||||
m_minimizeButton->setTitle(1);
|
||||
m_minimizeButton->setTitle("1");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -296,9 +296,9 @@ void UIFloatingWindow::SizeChanged
|
||||
return;
|
||||
}
|
||||
|
||||
setFrame(childRect);
|
||||
setFrame(UIRect2D(m_frame.size.width - 18.0, 2.0, 16.0, 16.0));
|
||||
setFrame(UIRect2D(m_frame.size.width - 36.0, 2.0, 16.0, 16.0));
|
||||
m_childspace->setFrame(childRect);
|
||||
m_closeButton->setFrame(UIRect2D(m_frame.size.width - 18.0, 2.0, 16.0, 16.0));
|
||||
m_minimizeButton->setFrame(UIRect2D(m_frame.size.width - 36.0, 2.0, 16.0, 16.0));
|
||||
}
|
||||
|
||||
void UIFloatingWindow::OnActivated
|
||||
@@ -368,6 +368,8 @@ void UIFloatingWindow::Draw
|
||||
textColor = m_textColor;
|
||||
|
||||
UColorHSV tmp(titleBar);
|
||||
tmp.s *= 0.75;
|
||||
tmp.v *= 1.333;
|
||||
newColor = tmp;
|
||||
|
||||
titleBorder.dark = newColor;
|
||||
@@ -379,7 +381,7 @@ void UIFloatingWindow::Draw
|
||||
{
|
||||
UColor newColor(0.1125, 0.147, 0.2085, 1.0);
|
||||
|
||||
titleBar = titleBar;
|
||||
titleBar = newColor;
|
||||
textColor = UBlack;
|
||||
|
||||
titleBorder.CreateSolidBorder(newColor, DARK);
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
public:
|
||||
UIChildSpaceWidget();
|
||||
|
||||
qboolean KeyEvent( int key, unsigned int time );
|
||||
qboolean KeyEvent( int key, unsigned int time ) override;
|
||||
};
|
||||
|
||||
class UIFloatingWindow : public UIWidget {
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
CLASS_PROTOTYPE( UIGlobalGameList );
|
||||
|
||||
public:
|
||||
virtual void UpdateServers();
|
||||
virtual void UpdateServers() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
void EventConnect( Event *ev );
|
||||
void PlayEnterSound( void );
|
||||
qboolean SetActiveRow( UIWidget *w );
|
||||
void Realign( void );
|
||||
void Realign( void ) override;
|
||||
};
|
||||
|
||||
class UILanGameListLabel : public UILabel {
|
||||
|
||||
@@ -174,7 +174,6 @@ void UILayout::ProcessCommands
|
||||
cl = "UI";
|
||||
cl += newname;
|
||||
cls = getClass( cl );
|
||||
assert( cls );
|
||||
if( !cls )
|
||||
{
|
||||
Com_Printf( "Failed to find resource type '%s'\n", token );
|
||||
|
||||
@@ -55,6 +55,19 @@ UIList::UIList()
|
||||
}
|
||||
}
|
||||
|
||||
UIList::~UIList()
|
||||
{
|
||||
for (int i = m_itemlist.NumObjects(); i > 0; i--)
|
||||
{
|
||||
UIListItem* item = m_itemlist.ObjectAt(i);
|
||||
m_itemlist.RemoveObjectAt(i);
|
||||
delete item;
|
||||
}
|
||||
|
||||
if (m_prev_arrow_region) delete m_prev_arrow_region;
|
||||
if (m_next_arrow_region) delete m_next_arrow_region;
|
||||
}
|
||||
|
||||
void UIList::Draw
|
||||
(
|
||||
void
|
||||
|
||||
+7
-6
@@ -48,27 +48,28 @@ public:
|
||||
|
||||
protected:
|
||||
void Draw( void ) override;
|
||||
qboolean KeyEvent( int key, unsigned int time );
|
||||
void CharEvent( int ch );
|
||||
qboolean KeyEvent( int key, unsigned int time ) override;
|
||||
void CharEvent( int ch ) override;
|
||||
void Pressed( Event *ev );
|
||||
void Released( Event *ev );
|
||||
void ScrollNext( void );
|
||||
void ScrollPrev( void );
|
||||
void FrameInitialized( void );
|
||||
void FrameInitialized( void ) override;
|
||||
void LayoutAddListItem( Event *ev );
|
||||
void AddItem( str item, str alias );
|
||||
public:
|
||||
UIList();
|
||||
~UIList();
|
||||
|
||||
void UpdateUIElement( void );
|
||||
void UpdateData( void );
|
||||
void UpdateUIElement( void ) override;
|
||||
void UpdateData( void ) override;
|
||||
};
|
||||
|
||||
class UIListIndex : public UIList {
|
||||
public:
|
||||
CLASS_PROTOTYPE( UIListIndex );
|
||||
|
||||
qboolean KeyEvent( int key, unsigned int time );
|
||||
qboolean KeyEvent( int key, unsigned int time ) override;
|
||||
};
|
||||
|
||||
#endif /* __UILIST_H__ */
|
||||
@@ -35,12 +35,12 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void TrySelectItem( int which );
|
||||
qboolean KeyEvent( int key, unsigned int time );
|
||||
qboolean KeyEvent( int key, unsigned int time ) override;
|
||||
|
||||
public:
|
||||
UIListBase();
|
||||
|
||||
void FrameInitialized( void );
|
||||
void FrameInitialized( void ) override;
|
||||
int getCurrentItem( void );
|
||||
virtual int getNumItems( void );
|
||||
virtual void DeleteAllItems( void );
|
||||
@@ -78,20 +78,20 @@ protected:
|
||||
void MouseReleased( Event *ev );
|
||||
void DeleteAllItems( Event *ev );
|
||||
void SetListFont( Event *ev );
|
||||
void TrySelectItem( int which );
|
||||
void TrySelectItem( int which ) override;
|
||||
|
||||
public:
|
||||
UIListBox();
|
||||
|
||||
void AddItem( const char *item, const char *command );
|
||||
void AddItem( int index, const char *command );
|
||||
void FrameInitialized( void );
|
||||
void FrameInitialized( void ) override;
|
||||
void LayoutAddListItem( Event *ev );
|
||||
void LayoutAddConfigstringListItem( Event *ev );
|
||||
str getItemText( int which );
|
||||
int getNumItems( void );
|
||||
void DeleteAllItems( void );
|
||||
void DeleteItem( int which );
|
||||
int getNumItems( void ) override;
|
||||
void DeleteAllItems( void ) override;
|
||||
void DeleteItem( int which ) override;
|
||||
};
|
||||
|
||||
#endif /* __UILISTBOX_H__ */
|
||||
@@ -52,6 +52,14 @@ UIListCtrl::UIListCtrl()
|
||||
m_foreground_color = UHudColor;
|
||||
}
|
||||
|
||||
UIListCtrl::~UIListCtrl()
|
||||
{
|
||||
if (m_headerfont) {
|
||||
delete m_headerfont;
|
||||
m_headerfont = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int UIListCtrl::StringCompareFunction
|
||||
(
|
||||
const UIListCtrlItem *i1,
|
||||
|
||||
@@ -87,8 +87,9 @@ protected:
|
||||
void DrawContent( void );
|
||||
public:
|
||||
UIListCtrl();
|
||||
~UIListCtrl();
|
||||
|
||||
void FrameInitialized( void );
|
||||
void FrameInitialized( void ) override;
|
||||
void SetDrawHeader( qboolean bDrawHeader );
|
||||
void AddItem( UIListCtrlItem *item );
|
||||
void InsertItem( UIListCtrlItem *item, int where );
|
||||
@@ -96,9 +97,9 @@ public:
|
||||
UIListCtrlItem *GetItem( int item );
|
||||
void AddColumn( str title, int name, int width, bool numeric, bool reverse_sort );
|
||||
void RemoveAllColumns( void );
|
||||
int getNumItems( void );
|
||||
void DeleteAllItems( void );
|
||||
void DeleteItem( int which );
|
||||
int getNumItems( void ) override;
|
||||
void DeleteAllItems( void ) override;
|
||||
void DeleteItem( int which ) override;
|
||||
virtual void SortByColumn( int column );
|
||||
void SortByLastSortColumn( void );
|
||||
void setCompareFunction( int( *func ) ( const UIListCtrlItem *i1, const UIListCtrlItem *i2, int columnname ) );
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
CLASS_PROTOTYPE( UIMultiLineEdit );
|
||||
|
||||
protected:
|
||||
void FrameInitialized( void );
|
||||
void FrameInitialized( void ) override;
|
||||
void PointToSelectionPoint( UIPoint2D& p, selectionpoint_t& sel );
|
||||
str& LineFromLineNumber( int num, bool resetpos );
|
||||
void EnsureSelectionPointVisible( selectionpoint_t& point );
|
||||
@@ -67,8 +67,8 @@ public:
|
||||
UIMultiLineEdit();
|
||||
|
||||
void Draw( void ) override;
|
||||
qboolean KeyEvent( int key, unsigned int time );
|
||||
void CharEvent( int ch );
|
||||
qboolean KeyEvent( int key, unsigned int time ) override;
|
||||
void CharEvent( int ch ) override;
|
||||
UIPoint2D getEndSelPoint( void );
|
||||
void MouseDown( Event *ev );
|
||||
void MouseUp( Event *ev );
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
public:
|
||||
UINotepadEdit();
|
||||
|
||||
void CharEvent( int ch );
|
||||
void CharEvent( int ch ) override;
|
||||
void setNotepad( UINotepad *notepad );
|
||||
bool GotoLine( int line );
|
||||
bool FindText( const char *text, int offsetFromSel );
|
||||
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
void setPopupBGColor( str menu, UColor c );
|
||||
void setPulldownShader( const char *title, UIReggedMaterial *mat );
|
||||
void setSelectedPulldownShader( const char *title, UIReggedMaterial *mat );
|
||||
void Realign( void );
|
||||
void Realign( void ) override;
|
||||
void Draw( void ) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -35,10 +35,10 @@ public:
|
||||
UIPulldownMenuContainer();
|
||||
|
||||
protected:
|
||||
void FrameInitialized( void );
|
||||
void setBackgroundAlpha( float f );
|
||||
void setBackgroundColor( const UColor& color, bool setbordercolor );
|
||||
void setForegroundColor( const UColor& color );
|
||||
void FrameInitialized( void ) override;
|
||||
void setBackgroundAlpha( float f ) override;
|
||||
void setBackgroundColor( const UColor& color, bool setbordercolor ) override;
|
||||
void setForegroundColor( const UColor& color ) override;
|
||||
void SetPopupHighlightFGColor( Event *ev );
|
||||
void SetPopupHighlightBGColor( Event *ev );
|
||||
void SetPopupFGColor( Event *ev );
|
||||
@@ -47,7 +47,7 @@ protected:
|
||||
void SetHighlightBGColor( Event *ev );
|
||||
void SetMenuShader( Event *ev );
|
||||
void SetSelectedMenuShader( Event *ev );
|
||||
void Realign( void );
|
||||
void Realign( void ) override;
|
||||
void PulldownVirtualRes( Event *ev );
|
||||
|
||||
public:
|
||||
|
||||
+126
-18
@@ -21,25 +21,40 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "ui_local.h"
|
||||
#include "localization.h"
|
||||
|
||||
CLASS_DECLARATION( UIWidget, UIWindowSizer, NULL )
|
||||
{
|
||||
{ &W_LeftMouseDown, &UIWindowSizer::MouseDown },
|
||||
{ &W_LeftMouseUp, &UIWindowSizer::MouseUp },
|
||||
{ &W_LeftMouseDragged, &UIWindowSizer::MouseDragged },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
UIWindowSizer::UIWindowSizer()
|
||||
{
|
||||
// FIXME: stub
|
||||
m_draggingwidget = NULL;
|
||||
m_mouseState = M_NONE;
|
||||
}
|
||||
|
||||
|
||||
UIWindowSizer::UIWindowSizer(UIWidget* w)
|
||||
: UIWindowSizer()
|
||||
{
|
||||
m_draggingwidget = w;
|
||||
}
|
||||
|
||||
void UIWindowSizer::Draw
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: stub
|
||||
m_font->setColor(UWhite);
|
||||
m_font->Print(0, 0, "o", -1, m_bVirtual);
|
||||
|
||||
m_font->setColor(UBlack);
|
||||
m_font->Print(0, 0, "p", -1, m_bVirtual);
|
||||
}
|
||||
|
||||
void UIWindowSizer::FrameInitialized
|
||||
@@ -48,7 +63,7 @@ void UIWindowSizer::FrameInitialized
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: stub
|
||||
setFont("marlett");
|
||||
}
|
||||
|
||||
void UIWindowSizer::MouseDown
|
||||
@@ -57,7 +72,10 @@ void UIWindowSizer::MouseDown
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: stub
|
||||
m_screenDragPoint.x = ev->GetFloat(1);
|
||||
m_screenDragPoint.y = ev->GetFloat(2);
|
||||
m_mouseState = M_DRAGGING;
|
||||
uWinMan.setFirstResponder(this);
|
||||
}
|
||||
|
||||
void UIWindowSizer::MouseUp
|
||||
@@ -66,7 +84,11 @@ void UIWindowSizer::MouseUp
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: stub
|
||||
if (uWinMan.getFirstResponder() == this) {
|
||||
uWinMan.setFirstResponder(NULL);
|
||||
}
|
||||
|
||||
m_mouseState = M_NONE;
|
||||
}
|
||||
|
||||
void UIWindowSizer::MouseDragged
|
||||
@@ -75,7 +97,29 @@ void UIWindowSizer::MouseDragged
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: stub
|
||||
UIPoint2D newpoint, delta;
|
||||
UISize2D newsize;
|
||||
|
||||
if (m_mouseState != M_DRAGGING) {
|
||||
return;
|
||||
}
|
||||
|
||||
newpoint.x = ev->GetFloat(1);
|
||||
newpoint.y = ev->GetFloat(2);
|
||||
delta = UIPoint2D(newpoint.x - m_screenDragPoint.x, newpoint.y - m_screenDragPoint.y);
|
||||
|
||||
if (delta.x || delta.y)
|
||||
{
|
||||
m_screenDragPoint = newpoint;
|
||||
newsize = m_draggingwidget->getSize();
|
||||
newsize.width += delta.x;
|
||||
newsize.height += delta.y;
|
||||
|
||||
if (newsize.width < 32) newsize.width = 32;
|
||||
if (newsize.height < 16) newsize.height = 16;
|
||||
|
||||
m_draggingwidget->setSize(newsize);
|
||||
}
|
||||
}
|
||||
|
||||
void UIWindowSizer::setDraggingWidget
|
||||
@@ -84,7 +128,7 @@ void UIWindowSizer::setDraggingWidget
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: stub
|
||||
m_draggingwidget = w;
|
||||
}
|
||||
|
||||
UIWidget *UIWindowSizer::getDraggingWidget
|
||||
@@ -93,18 +137,23 @@ UIWidget *UIWindowSizer::getDraggingWidget
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: stub
|
||||
return NULL;
|
||||
return m_draggingwidget;
|
||||
}
|
||||
|
||||
CLASS_DECLARATION( UIWidget, UIStatusBar, NULL )
|
||||
{
|
||||
{ &W_RealignWidget, &UIStatusBar::ParentSized },
|
||||
{ &W_SizeChanged, &UIStatusBar::SelfSized },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
UIStatusBar::UIStatusBar()
|
||||
{
|
||||
// FIXME: stub
|
||||
m_sizeenabled = NULL;
|
||||
m_created = false;
|
||||
m_sizer = NULL;
|
||||
m_align.alignment = WND_ALIGN_NONE;
|
||||
m_iFontAlignmentHorizontal = FONT_JUSTHORZ_LEFT;
|
||||
}
|
||||
|
||||
UIStatusBar::UIStatusBar
|
||||
@@ -112,9 +161,10 @@ UIStatusBar::UIStatusBar
|
||||
alignment_t align,
|
||||
float height
|
||||
)
|
||||
: UIStatusBar()
|
||||
|
||||
{
|
||||
// FIXME: stub
|
||||
AlignBar(align, height);
|
||||
}
|
||||
|
||||
void UIStatusBar::FrameInitialized
|
||||
@@ -123,7 +173,14 @@ void UIStatusBar::FrameInitialized
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: stub
|
||||
m_created = true;
|
||||
Connect(this, W_SizeChanged, W_SizeChanged);
|
||||
if (m_parent) {
|
||||
m_parent->Connect(this, W_SizeChanged, W_RealignWidget);
|
||||
}
|
||||
|
||||
SelfSized(NULL);
|
||||
ParentSized(NULL);
|
||||
}
|
||||
|
||||
void UIStatusBar::Draw
|
||||
@@ -132,7 +189,25 @@ void UIStatusBar::Draw
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: stub
|
||||
if (m_align.alignment == WND_ALIGN_BOTTOM) {
|
||||
DrawBox(0.0, 0.0, m_frame.size.width, 1.0, m_border_color.dark, 1.0);
|
||||
}
|
||||
|
||||
m_font->setColor(m_foreground_color);
|
||||
m_font->PrintJustified(
|
||||
getClientFrame(),
|
||||
m_iFontAlignmentHorizontal,
|
||||
m_iFontAlignmentVertical,
|
||||
Sys_LV_CL_ConvertString(m_title.c_str()),
|
||||
m_bVirtual ? m_vVirtualScale : NULL
|
||||
);
|
||||
|
||||
if (m_sizer)
|
||||
{
|
||||
m_sizer->setForegroundColor(m_foreground_color);
|
||||
m_sizer->setBackgroundColor(m_background_color, true);
|
||||
m_sizer->setBackgroundAlpha(m_local_alpha);
|
||||
}
|
||||
}
|
||||
|
||||
void UIStatusBar::AlignBar
|
||||
@@ -142,7 +217,8 @@ void UIStatusBar::AlignBar
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: stub
|
||||
m_align.alignment = align;
|
||||
m_align.dist = height;
|
||||
}
|
||||
|
||||
void UIStatusBar::DontAlignBar
|
||||
@@ -151,7 +227,7 @@ void UIStatusBar::DontAlignBar
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: stub
|
||||
m_align.alignment = WND_ALIGN_NONE;
|
||||
}
|
||||
|
||||
void UIStatusBar::EnableSizeBox
|
||||
@@ -160,7 +236,10 @@ void UIStatusBar::EnableSizeBox
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: stub
|
||||
m_sizeenabled = which;
|
||||
if (m_created) {
|
||||
SelfSized(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void UIStatusBar::ParentSized
|
||||
@@ -169,7 +248,12 @@ void UIStatusBar::ParentSized
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: stub
|
||||
if (m_align.alignment == WND_ALIGN_BOTTOM)
|
||||
{
|
||||
UISize2D parentSize = m_parent->getSize();
|
||||
|
||||
setFrame(UIRect2D(0.0, parentSize.height - m_align.dist, parentSize.width, m_align.dist));
|
||||
}
|
||||
}
|
||||
|
||||
void UIStatusBar::SelfSized
|
||||
@@ -178,6 +262,30 @@ void UIStatusBar::SelfSized
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: stub
|
||||
if (m_sizeenabled)
|
||||
{
|
||||
if (m_sizer) {
|
||||
if (m_sizer->getDraggingWidget() != m_sizeenabled) {
|
||||
m_sizer->setDraggingWidget(m_sizeenabled);
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_sizer = new UIWindowSizer(m_sizeenabled);
|
||||
m_sizer->InitFrame(this, 0, 0, 16.0, 16.0, 0);
|
||||
}
|
||||
|
||||
|
||||
UISize2D sizerFrame = m_sizer->getSize();
|
||||
|
||||
m_sizer->setFrame(UIRect2D(
|
||||
UIPoint2D(m_frame.size.width - sizerFrame.width, m_frame.size.height - sizerFrame.height),
|
||||
sizerFrame
|
||||
));
|
||||
}
|
||||
else if (m_sizer)
|
||||
{
|
||||
delete m_sizer;
|
||||
m_sizer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ public:
|
||||
CLASS_PROTOTYPE( UIWindowSizer );
|
||||
|
||||
UIWindowSizer();
|
||||
UIWindowSizer(UIWidget* w);
|
||||
|
||||
void Draw( void ) override;
|
||||
void FrameInitialized( void ) override;
|
||||
@@ -60,6 +61,7 @@ protected:
|
||||
bool m_created;
|
||||
|
||||
UIWindowSizer *m_sizer;
|
||||
|
||||
public:
|
||||
CLASS_PROTOTYPE( UIStatusBar );
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ void UIVertScroll::DrawThumb
|
||||
m_local_alpha
|
||||
);
|
||||
}
|
||||
else
|
||||
else if (m_pressed == VS_PAGE_DOWN)
|
||||
{
|
||||
DrawBox(
|
||||
0.0,
|
||||
|
||||
@@ -2969,7 +2969,7 @@ bool UIWidget::PassEventToWidget
|
||||
|
||||
if( m_enabledCvar.length() )
|
||||
{
|
||||
if( !UI_GetCvarInt( m_cvarname, NULL ) )
|
||||
if( !UI_GetCvarInt( m_cvarname, 0 ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,8 +69,8 @@ public:
|
||||
UIWidget *FindPrevControl( UIWidget *control );
|
||||
void setCursor( const char *string );
|
||||
void showCursor( bool show );
|
||||
virtual void CharEvent( int ch );
|
||||
virtual qboolean KeyEvent( int key, unsigned int time );
|
||||
virtual void CharEvent( int ch ) override;
|
||||
virtual qboolean KeyEvent( int key, unsigned int time ) override;
|
||||
void CreateMenus( void );
|
||||
UIReggedMaterial *RegisterShader( const str& name );
|
||||
UIReggedMaterial *RefreshShader( const str& name );
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
void BindKeyToCommand( str command, int key, int index, qboolean alternate );
|
||||
UIWidget *BindActive( void );
|
||||
void SetBindActive( UIWidget *w );
|
||||
virtual void Shutdown( void );
|
||||
virtual void Shutdown( void ) override;
|
||||
void DeactiveFloatingWindows( void );
|
||||
bool DialogExists( void );
|
||||
void RemoveAllDialogBoxes( void );
|
||||
|
||||
@@ -404,6 +404,12 @@ void ( APIENTRY * qglVertex4sv )(const GLshort *v);
|
||||
void ( APIENTRY * qglVertexPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
void ( APIENTRY * qglViewport )(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
void (APIENTRY* qglCompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data);
|
||||
void (APIENTRY* qglCompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
|
||||
void (APIENTRY* qglCompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data);
|
||||
void (APIENTRY* qglCompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);
|
||||
void (APIENTRY* qglGetCompressedTexImageARB)(GLenum target, GLint lod, void* img);
|
||||
|
||||
void ( APIENTRY * qglMultiTexCoord2fARB )( GLenum texture, GLfloat s, GLfloat t );
|
||||
void ( APIENTRY * qglActiveTextureARB )( GLenum texture );
|
||||
void ( APIENTRY * qglClientActiveTextureARB )( GLenum texture );
|
||||
@@ -755,6 +761,12 @@ static void ( APIENTRY * dllVertex4sv )(const GLshort *v);
|
||||
static void ( APIENTRY * dllVertexPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
static void ( APIENTRY * dllViewport )(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
void (APIENTRY* dllCompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data);
|
||||
void (APIENTRY* dllCompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
|
||||
void (APIENTRY* dllCompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data);
|
||||
void (APIENTRY* dllCompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);
|
||||
void (APIENTRY* dllGetCompressedTexImageARB)(GLenum target, GLint lod, void* img);
|
||||
|
||||
static void APIENTRY logAccum(GLenum op, GLfloat value)
|
||||
{
|
||||
fprintf( glw_state.log_fp, "glAccum\n" );
|
||||
@@ -2994,6 +3006,12 @@ void QGL_Shutdown( void )
|
||||
qglVertexPointer = NULL;
|
||||
qglViewport = NULL;
|
||||
|
||||
qglCompressedTexImage3DARB = NULL;
|
||||
qglCompressedTexImage2DARB = NULL;
|
||||
qglCompressedTexSubImage3DARB = NULL;
|
||||
qglCompressedTexSubImage2DARB = NULL;
|
||||
qglGetCompressedTexImageARB = NULL;
|
||||
|
||||
// bk001129 - from cvs1.17 (mkv)
|
||||
#if defined(__FX__)
|
||||
qfxMesaCreateContext = NULL;
|
||||
@@ -3391,6 +3409,12 @@ qboolean QGL_Init( const char *dllname )
|
||||
qglVertexPointer = dllVertexPointer = GPA( "glVertexPointer" );
|
||||
qglViewport = dllViewport = GPA( "glViewport" );
|
||||
|
||||
qglCompressedTexImage3DARB = dllCompressedTexImage3DARB = GPA("glCompressedTexImage3DARB");
|
||||
qglCompressedTexImage2DARB = dllCompressedTexImage2DARB = GPA("qglCompressedTexImage2DARB");
|
||||
qglCompressedTexSubImage3DARB = dllCompressedTexSubImage3DARB = GPA("qglCompressedTexSubImage3DARB");
|
||||
qglCompressedTexSubImage2DARB = dllCompressedTexSubImage2DARB = GPA("qglCompressedTexSubImage2DARB");
|
||||
qglGetCompressedTexImageARB = dllGetCompressedTexImageARB = GPA("qglGetCompressedTexImageARB");
|
||||
|
||||
// bk001129 - from cvs1.17 (mkv)
|
||||
#if defined(__FX__)
|
||||
qfxMesaCreateContext = GPA("fxMesaCreateContext");
|
||||
@@ -4141,6 +4165,12 @@ void QGL_EnableLogging( qboolean enable ) {
|
||||
qglVertex4sv = dllVertex4sv ;
|
||||
qglVertexPointer = dllVertexPointer ;
|
||||
qglViewport = dllViewport ;
|
||||
|
||||
qglCompressedTexImage3DARB = dllCompressedTexImage3DARB;
|
||||
qglCompressedTexImage2DARB = dllCompressedTexImage2DARB;
|
||||
qglCompressedTexSubImage3DARB = dllCompressedTexSubImage3DARB;
|
||||
qglCompressedTexSubImage2DARB = dllCompressedTexSubImage2DARB;
|
||||
qglGetCompressedTexImageARB = dllGetCompressedTexImageARB;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,14 @@ static int tty_eof;
|
||||
|
||||
static struct termios tty_tc;
|
||||
|
||||
#define MAX_EDIT_LINE 256
|
||||
typedef struct {
|
||||
int cursor;
|
||||
int scroll;
|
||||
int widthInChars;
|
||||
char buffer[MAX_EDIT_LINE];
|
||||
} field_t;
|
||||
|
||||
static field_t tty_con;
|
||||
|
||||
// history
|
||||
@@ -459,6 +467,163 @@ void floating_point_exception_handler(int whatever)
|
||||
signal(SIGFPE, floating_point_exception_handler);
|
||||
}
|
||||
|
||||
/*
|
||||
===========================================
|
||||
command line completion
|
||||
===========================================
|
||||
*/
|
||||
|
||||
/*
|
||||
==================
|
||||
Field_Clear
|
||||
==================
|
||||
*/
|
||||
void Field_Clear(field_t* edit) {
|
||||
memset(edit->buffer, 0, MAX_EDIT_LINE);
|
||||
edit->cursor = 0;
|
||||
edit->scroll = 0;
|
||||
}
|
||||
|
||||
static const char* completionString;
|
||||
static char shortestMatch[MAX_TOKEN_CHARS];
|
||||
static int matchCount;
|
||||
// field we are working on, passed to Field_CompleteCommand (&g_consoleCommand for instance)
|
||||
static field_t* completionField;
|
||||
|
||||
/*
|
||||
===============
|
||||
FindMatches
|
||||
|
||||
===============
|
||||
*/
|
||||
static void FindMatches(const char* s) {
|
||||
int i;
|
||||
|
||||
if (Q_stricmpn(s, completionString, strlen(completionString))) {
|
||||
return;
|
||||
}
|
||||
matchCount++;
|
||||
if (matchCount == 1) {
|
||||
Q_strncpyz(shortestMatch, s, sizeof(shortestMatch));
|
||||
return;
|
||||
}
|
||||
|
||||
// cut shortestMatch to the amount common with s
|
||||
for (i = 0; s[i]; i++) {
|
||||
if (tolower(shortestMatch[i]) != tolower(s[i])) {
|
||||
shortestMatch[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
PrintMatches
|
||||
|
||||
===============
|
||||
*/
|
||||
static void PrintMatches(const char* s) {
|
||||
if (!Q_stricmpn(s, shortestMatch, strlen(shortestMatch))) {
|
||||
Com_Printf(" %s\n", s);
|
||||
}
|
||||
}
|
||||
|
||||
static void keyConcatArgs(void) {
|
||||
int i;
|
||||
char* arg;
|
||||
|
||||
for (i = 1; i < Cmd_Argc(); i++) {
|
||||
Q_strcat(completionField->buffer, sizeof(completionField->buffer), " ");
|
||||
arg = Cmd_Argv(i);
|
||||
while (*arg) {
|
||||
if (*arg == ' ') {
|
||||
Q_strcat(completionField->buffer, sizeof(completionField->buffer), "\"");
|
||||
break;
|
||||
}
|
||||
arg++;
|
||||
}
|
||||
Q_strcat(completionField->buffer, sizeof(completionField->buffer), Cmd_Argv(i));
|
||||
if (*arg == ' ') {
|
||||
Q_strcat(completionField->buffer, sizeof(completionField->buffer), "\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ConcatRemaining(const char* src, const char* start) {
|
||||
char* str;
|
||||
|
||||
str = strstr(src, start);
|
||||
if (!str) {
|
||||
keyConcatArgs();
|
||||
return;
|
||||
}
|
||||
|
||||
str += strlen(start);
|
||||
Q_strcat(completionField->buffer, sizeof(completionField->buffer), str);
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
Field_CompleteCommand
|
||||
|
||||
perform Tab expansion
|
||||
NOTE TTimo this was originally client code only
|
||||
moved to common code when writing tty console for *nix dedicated server
|
||||
===============
|
||||
*/
|
||||
void Field_CompleteCommand(field_t* field) {
|
||||
field_t temp;
|
||||
|
||||
completionField = field;
|
||||
|
||||
// only look at the first token for completion purposes
|
||||
Cmd_TokenizeString(completionField->buffer);
|
||||
|
||||
completionString = Cmd_Argv(0);
|
||||
if (completionString[0] == '\\' || completionString[0] == '/') {
|
||||
completionString++;
|
||||
}
|
||||
matchCount = 0;
|
||||
shortestMatch[0] = 0;
|
||||
|
||||
if (strlen(completionString) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Cmd_CommandCompletion(FindMatches);
|
||||
Cvar_CommandCompletion(FindMatches);
|
||||
|
||||
if (matchCount == 0) {
|
||||
return; // no matches
|
||||
}
|
||||
|
||||
Com_Memcpy(&temp, completionField, sizeof(field_t));
|
||||
|
||||
if (matchCount == 1) {
|
||||
Com_sprintf(completionField->buffer, sizeof(completionField->buffer), "\\%s", shortestMatch);
|
||||
if (Cmd_Argc() == 1) {
|
||||
Q_strcat(completionField->buffer, sizeof(completionField->buffer), " ");
|
||||
}
|
||||
else {
|
||||
ConcatRemaining(temp.buffer, completionString);
|
||||
}
|
||||
completionField->cursor = strlen(completionField->buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
// multiple matches, complete to shortest
|
||||
Com_sprintf(completionField->buffer, sizeof(completionField->buffer), "\\%s", shortestMatch);
|
||||
completionField->cursor = strlen(completionField->buffer);
|
||||
ConcatRemaining(temp.buffer, completionString);
|
||||
|
||||
Com_Printf("]%s\n", completionField->buffer);
|
||||
|
||||
// run through again, printing matches
|
||||
Cmd_CommandCompletion(PrintMatches);
|
||||
Cvar_CommandCompletion(PrintMatches);
|
||||
}
|
||||
|
||||
|
||||
// initialize the console input (tty mode if wanted and possible)
|
||||
void Sys_ConsoleInputInit()
|
||||
{
|
||||
|
||||
@@ -25,9 +25,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include "win_localization.h"
|
||||
#include <tiki.h>
|
||||
|
||||
#define MAX_BUFFERS 3
|
||||
#define MAX_LOCALIZATION_LENGTH 1024
|
||||
|
||||
cLocalization *g_localization;
|
||||
static char buf[ 1024 ];
|
||||
static char global_buf[MAX_BUFFERS][MAX_LOCALIZATION_LENGTH];
|
||||
static char szTemp[ 100 ];
|
||||
static size_t buf_index = 0;
|
||||
|
||||
void Sys_InitLocalization()
|
||||
{
|
||||
@@ -342,6 +346,7 @@ const char *cLocalization::ConvertString( const char *var )
|
||||
n++;
|
||||
}
|
||||
|
||||
char* buf = global_buf[(buf_index++) % MAX_BUFFERS];
|
||||
for( i = 1; i <= m_entries.NumObjects(); i++ )
|
||||
{
|
||||
entry = &m_entries.ObjectAt( i );
|
||||
@@ -354,12 +359,12 @@ const char *cLocalization::ConvertString( const char *var )
|
||||
|
||||
if( !( m + n ) )
|
||||
{
|
||||
strncpy( buf, entry->m_locName, sizeof( buf ) );
|
||||
bjb_rebreak( var, buf, sizeof( buf ) );
|
||||
strncpy( buf, entry->m_locName, MAX_LOCALIZATION_LENGTH );
|
||||
bjb_rebreak( var, buf, MAX_LOCALIZATION_LENGTH );
|
||||
return buf;
|
||||
}
|
||||
|
||||
if( entry->m_l1_rep + m + n < sizeof( buf ) )
|
||||
if( entry->m_l1_rep + m + n < MAX_LOCALIZATION_LENGTH )
|
||||
{
|
||||
memcpy( buf, var, n );
|
||||
memcpy( &buf[ n ], entry->m_locName.c_str(), entry->m_l1_rep );
|
||||
|
||||
@@ -404,6 +404,11 @@ void ( APIENTRY * qglVertex4s )(GLshort x, GLshort y, GLshort z, GLshort w);
|
||||
void ( APIENTRY * qglVertex4sv )(const GLshort *v);
|
||||
void ( APIENTRY * qglVertexPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
void ( APIENTRY * qglViewport )(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
void (APIENTRY* qglCompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data);
|
||||
void (APIENTRY* qglCompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
|
||||
void (APIENTRY* qglCompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data);
|
||||
void (APIENTRY* qglCompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);
|
||||
void (APIENTRY* qglGetCompressedTexImageARB)(GLenum target, GLint lod, void* img);
|
||||
|
||||
void ( APIENTRY * qglMultiTexCoord2fARB )( GLenum texture, GLfloat s, GLfloat t );
|
||||
void ( APIENTRY * qglActiveTextureARB )( GLenum texture );
|
||||
@@ -749,6 +754,12 @@ static void ( APIENTRY * dllVertex4sv )(const GLshort *v);
|
||||
static void ( APIENTRY * dllVertexPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
static void ( APIENTRY * dllViewport )(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
void (APIENTRY* dllCompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data);
|
||||
void (APIENTRY* dllCompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
|
||||
void (APIENTRY* dllCompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data);
|
||||
void (APIENTRY* dllCompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);
|
||||
void (APIENTRY* dllGetCompressedTexImageARB)(GLenum target, GLint lod, void* img);
|
||||
|
||||
static const char * BooleanToString( GLboolean b )
|
||||
{
|
||||
if ( b == GL_FALSE )
|
||||
@@ -3159,6 +3170,12 @@ void QGL_Shutdown( void )
|
||||
qglVertexPointer = NULL;
|
||||
qglViewport = NULL;
|
||||
|
||||
qglCompressedTexImage3DARB = NULL;
|
||||
qglCompressedTexImage2DARB = NULL;
|
||||
qglCompressedTexSubImage3DARB = NULL;
|
||||
qglCompressedTexSubImage2DARB = NULL;
|
||||
qglGetCompressedTexImageARB = NULL;
|
||||
|
||||
qwglCopyContext = NULL;
|
||||
qwglCreateContext = NULL;
|
||||
qwglCreateLayerContext = NULL;
|
||||
@@ -3611,6 +3628,12 @@ qboolean QGL_Init( const char *dllname )
|
||||
qglVertexPointer = dllVertexPointer = GPA( "glVertexPointer" );
|
||||
qglViewport = dllViewport = GPA( "glViewport" );
|
||||
|
||||
qglCompressedTexImage3DARB = dllCompressedTexImage3DARB = GPA("glCompressedTexImage3D");
|
||||
qglCompressedTexImage2DARB = dllCompressedTexImage2DARB = GPA("glCompressedTexImage2D");
|
||||
qglCompressedTexSubImage3DARB = dllCompressedTexSubImage3DARB = GPA("glCompressedTexSubImage3D");
|
||||
qglCompressedTexSubImage2DARB = dllCompressedTexSubImage2DARB = GPA("glCompressedTexSubImage2D");
|
||||
qglGetCompressedTexImageARB = dllGetCompressedTexImageARB = GPA("glGetCompressedTexImage");
|
||||
|
||||
qwglCopyContext = GPA( "wglCopyContext" );
|
||||
qwglCreateContext = GPA( "wglCreateContext" );
|
||||
qwglCreateLayerContext = GPA( "wglCreateLayerContext" );
|
||||
@@ -4370,6 +4393,12 @@ void QGL_EnableLogging( qboolean enable )
|
||||
qglVertex4sv = dllVertex4sv ;
|
||||
qglVertexPointer = dllVertexPointer ;
|
||||
qglViewport = dllViewport ;
|
||||
|
||||
qglCompressedTexImage3DARB = dllCompressedTexImage3DARB;
|
||||
qglCompressedTexImage2DARB = dllCompressedTexImage2DARB;
|
||||
qglCompressedTexSubImage3DARB = dllCompressedTexSubImage3DARB;
|
||||
qglCompressedTexSubImage2DARB = dllCompressedTexSubImage2DARB;
|
||||
qglGetCompressedTexImageARB = dllGetCompressedTexImageARB;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loaded 100 of 101 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user