Add shared/platform.h which will send hints as to what target platform
we're dealing with (pc, touch, web, console etc.)
This commit is contained in:
parent
75dfffaf4b
commit
7f00e9354d
6 changed files with 77 additions and 15 deletions
|
@ -272,9 +272,9 @@ CBaseEntity::ReceiveEntity(float flChanged)
|
||||||
origin[2] = readcoord();
|
origin[2] = readcoord();
|
||||||
}
|
}
|
||||||
if (flChanged & BASEFL_CHANGED_ANGLES) {
|
if (flChanged & BASEFL_CHANGED_ANGLES) {
|
||||||
angles[0] = readshort() / (65535/360);
|
angles[0] = readshort() / (32767 / 360);
|
||||||
angles[1] = readshort() / (65535/360);
|
angles[1] = readshort() / (32767 / 360);
|
||||||
angles[2] = readshort() / (65535/360);
|
angles[2] = readshort() / (32767 / 360);
|
||||||
}
|
}
|
||||||
if (flChanged & BASEFL_CHANGED_MODELINDEX) {
|
if (flChanged & BASEFL_CHANGED_MODELINDEX) {
|
||||||
setmodelindex(this, readshort());
|
setmodelindex(this, readshort());
|
||||||
|
@ -473,12 +473,9 @@ CBaseEntity::SendEntity(entity ePEnt, float fChanged)
|
||||||
WriteCoord(MSG_ENTITY, origin[2]);
|
WriteCoord(MSG_ENTITY, origin[2]);
|
||||||
}
|
}
|
||||||
if (fChanged & BASEFL_CHANGED_ANGLES) {
|
if (fChanged & BASEFL_CHANGED_ANGLES) {
|
||||||
angles[0] = Math_FixDelta(angles[0]);
|
WriteShort(MSG_ENTITY, angles[0] * 32767 / 360);
|
||||||
angles[1] = Math_FixDelta(angles[1]);
|
WriteShort(MSG_ENTITY, angles[1] * 32767 / 360);
|
||||||
angles[2] = Math_FixDelta(angles[2]);
|
WriteShort(MSG_ENTITY, angles[2] * 32767 / 360);
|
||||||
WriteShort(MSG_ENTITY, angles[0] * (65535/360));
|
|
||||||
WriteShort(MSG_ENTITY, angles[1] * (65535/360));
|
|
||||||
WriteShort(MSG_ENTITY, angles[2] * (65535/360));
|
|
||||||
}
|
}
|
||||||
if (fChanged & BASEFL_CHANGED_MODELINDEX) {
|
if (fChanged & BASEFL_CHANGED_MODELINDEX) {
|
||||||
WriteShort(MSG_ENTITY, modelindex);
|
WriteShort(MSG_ENTITY, modelindex);
|
||||||
|
@ -566,6 +563,10 @@ CBaseEntity::ParentUpdate(void)
|
||||||
SendFlags |= BASEFL_CHANGED_ORIGIN;
|
SendFlags |= BASEFL_CHANGED_ORIGIN;
|
||||||
}
|
}
|
||||||
if (net_angles != angles) {
|
if (net_angles != angles) {
|
||||||
|
angles[0] = Math_FixDelta(angles[0]);
|
||||||
|
angles[1] = Math_FixDelta(angles[1]);
|
||||||
|
angles[2] = Math_FixDelta(angles[2]);
|
||||||
|
|
||||||
net_angles = angles;
|
net_angles = angles;
|
||||||
SendFlags |= BASEFL_CHANGED_ANGLES;
|
SendFlags |= BASEFL_CHANGED_ANGLES;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
../shared/fteextensions.qc
|
../shared/fteextensions.qc
|
||||||
../shared/math.h
|
../shared/math.h
|
||||||
../shared/math.qc
|
../shared/math.qc
|
||||||
|
../shared/platform.h
|
||||||
defs.h
|
defs.h
|
||||||
bitmaps.h
|
bitmaps.h
|
||||||
strings.h
|
strings.h
|
||||||
|
|
|
@ -250,8 +250,8 @@ filestream
|
||||||
games_find_in_gamedir(string filename, string gamedirname)
|
games_find_in_gamedir(string filename, string gamedirname)
|
||||||
{
|
{
|
||||||
searchhandle sh;
|
searchhandle sh;
|
||||||
filestream fh;
|
|
||||||
searchhandle psh;
|
searchhandle psh;
|
||||||
|
filestream fh;
|
||||||
|
|
||||||
/* first let's see if we've got a liblist.gam just floating inside the gamedir */
|
/* first let's see if we've got a liblist.gam just floating inside the gamedir */
|
||||||
sh = search_begin(filename, SB_FULLPACKAGEPATH | SB_FORCESEARCH, FALSE, gamedirname);
|
sh = search_begin(filename, SB_FULLPACKAGEPATH | SB_FORCESEARCH, FALSE, gamedirname);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "pmove.h"
|
#include "pmove.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "spectator.h"
|
#include "spectator.h"
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
#define BSPVER_PREREL 28
|
#define BSPVER_PREREL 28
|
||||||
#define BSPVER_Q1 29
|
#define BSPVER_Q1 29
|
||||||
|
@ -39,7 +40,7 @@
|
||||||
|
|
||||||
#define CLASSEXPORT(classname,classa) void classname(void) { spawnfunc_##classa(); }
|
#define CLASSEXPORT(classname,classa) void classname(void) { spawnfunc_##classa(); }
|
||||||
|
|
||||||
#define printf(a) print(sprintf(a))
|
#define printf(x, ...) print(sprintf(x, ...))
|
||||||
|
|
||||||
const vector VEC_HULL_MIN = [-16,-16,-36];
|
const vector VEC_HULL_MIN = [-16,-16,-36];
|
||||||
const vector VEC_HULL_MAX = [16,16,36];
|
const vector VEC_HULL_MAX = [16,16,36];
|
||||||
|
|
59
src/shared/platform.h
Normal file
59
src/shared/platform.h
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
PLATFORM_UNINITIALIZED = -1,
|
||||||
|
PLATFORM_UNKNOWN = 0,
|
||||||
|
PLATFORM_PC,
|
||||||
|
PLATFORM_CONSOLE,
|
||||||
|
PLATFORM_TOUCH,
|
||||||
|
PLATFORM_WEB
|
||||||
|
} platform;
|
||||||
|
|
||||||
|
var platform g_platform = PLATFORM_UNINITIALIZED;
|
||||||
|
|
||||||
|
/* fast way to query which system we're on */
|
||||||
|
platform
|
||||||
|
Platform_GetPlatform(void)
|
||||||
|
{
|
||||||
|
if (g_platform == PLATFORM_UNINITIALIZED) {
|
||||||
|
string osname = cvar_string("sys_platform");
|
||||||
|
g_platform = PLATFORM_UNKNOWN;
|
||||||
|
|
||||||
|
switch (osname) {
|
||||||
|
case "Web":
|
||||||
|
g_platform = PLATFORM_WEB;
|
||||||
|
break;
|
||||||
|
case "WinCE":
|
||||||
|
case "Xbox":
|
||||||
|
g_platform = PLATFORM_CONSOLE;
|
||||||
|
break;
|
||||||
|
case "WinRT":
|
||||||
|
case "iOSSim":
|
||||||
|
case "iOS":
|
||||||
|
case "Android":
|
||||||
|
g_platform = PLATFORM_TOUCH;
|
||||||
|
break;
|
||||||
|
case "Unknown":
|
||||||
|
case "Nacl":
|
||||||
|
case "Win":
|
||||||
|
case "Win16":
|
||||||
|
case "Cygwin":
|
||||||
|
case "Linux":
|
||||||
|
case "Mac":
|
||||||
|
case "Apple":
|
||||||
|
case "FreeBSD":
|
||||||
|
case "OpenBSD":
|
||||||
|
case "NetBSD":
|
||||||
|
case "BSD":
|
||||||
|
case "MorphOS":
|
||||||
|
case "AmigaOS":
|
||||||
|
case "MacOS X":
|
||||||
|
case "Dos":
|
||||||
|
default:
|
||||||
|
g_platform = PLATFORM_PC;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_platform;
|
||||||
|
}
|
|
@ -49,9 +49,9 @@ base_player::ReceiveEntity(float new, float fl)
|
||||||
if (fl & PLAYER_ORIGIN_Z)
|
if (fl & PLAYER_ORIGIN_Z)
|
||||||
origin[2] = readcoord();
|
origin[2] = readcoord();
|
||||||
if (fl & PLAYER_ANGLES_X)
|
if (fl & PLAYER_ANGLES_X)
|
||||||
pitch = readshort() / (65535/360);
|
pitch = readshort() / (32767 / 360);
|
||||||
if (fl & PLAYER_ANGLES_Y)
|
if (fl & PLAYER_ANGLES_Y)
|
||||||
angles[1] = readshort() / (65535/360);
|
angles[1] = readshort() / (32767 / 360);
|
||||||
if (fl & PLAYER_COLORMAP)
|
if (fl & PLAYER_COLORMAP)
|
||||||
colormap = readfloat();
|
colormap = readfloat();
|
||||||
|
|
||||||
|
@ -288,9 +288,9 @@ base_player::SendEntity(entity ePEnt, float fChanged)
|
||||||
WriteCoord(MSG_ENTITY, origin[2]);
|
WriteCoord(MSG_ENTITY, origin[2]);
|
||||||
|
|
||||||
if (fChanged & PLAYER_ANGLES_X)
|
if (fChanged & PLAYER_ANGLES_X)
|
||||||
WriteShort(MSG_ENTITY, v_angle[0] * (65535/360));
|
WriteShort(MSG_ENTITY, v_angle[0] * 32767 / 360);
|
||||||
if (fChanged & PLAYER_ANGLES_Y)
|
if (fChanged & PLAYER_ANGLES_Y)
|
||||||
WriteShort(MSG_ENTITY, angles[1] * (65535/360));
|
WriteShort(MSG_ENTITY, angles[1] * 32767 / 360);
|
||||||
if (fChanged & PLAYER_COLORMAP)
|
if (fChanged & PLAYER_COLORMAP)
|
||||||
WriteFloat(MSG_ENTITY, colormap);
|
WriteFloat(MSG_ENTITY, colormap);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue