mirror of
https://github.com/bearstonem/openmohaa-vr.git
synced 2026-10-28 06:00:26 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aef54d05ae | ||
|
|
15633626fe | ||
|
|
d43b60c818 | ||
|
|
7941524aad | ||
|
|
3aa4a6157c | ||
|
|
fc9cf41557 | ||
|
|
527131e513 | ||
|
|
b79163f998 | ||
|
|
121aaa164a | ||
|
|
2522559a04 | ||
|
|
cf61471b2d | ||
|
|
9ebdc6a238 | ||
|
|
0c65f5dab3 |
No files matched your search
@@ -477,6 +477,8 @@ void CG_PredictPlayerState(void)
|
||||
}
|
||||
|
||||
cg_pmove.noFootsteps = (cgs.dmflags & DF_NO_FOOTSTEPS) > 0;
|
||||
// Leaning while moving is allowed in mohta and mohtt only with a specific dm flag bit set
|
||||
cg_pmove.alwaysAllowLean = (cg_protocol < PROTOCOL_MOHTA_MIN) || (cgs.dmflags & DF_ALLOW_LEAN_MOVEMENT);
|
||||
|
||||
// save the state before the pmove so we can detect transitions
|
||||
oldPlayerState = cg.predicted_player_state;
|
||||
|
||||
+10
-2
@@ -1442,8 +1442,11 @@ void PmoveSingle( pmove_t *pmove )
|
||||
|
||||
pml.frametime = pml.msec * 0.001;
|
||||
|
||||
if( ( pm->cmd.buttons & ( BUTTON_LEAN_LEFT | BUTTON_LEAN_RIGHT ) &&
|
||||
( pm->cmd.buttons & ( BUTTON_LEAN_LEFT | BUTTON_LEAN_RIGHT ) ) != ( BUTTON_LEAN_LEFT | BUTTON_LEAN_RIGHT ) ) )
|
||||
if ((pm->cmd.buttons & (BUTTON_LEAN_LEFT | BUTTON_LEAN_RIGHT) &&
|
||||
(pm->cmd.buttons & (BUTTON_LEAN_LEFT | BUTTON_LEAN_RIGHT)) != (BUTTON_LEAN_LEFT | BUTTON_LEAN_RIGHT)) &&
|
||||
(!pm->cmd.forwardmove || pm->alwaysAllowLean) &&
|
||||
(!pm->cmd.rightmove || pm->alwaysAllowLean) &&
|
||||
(!pm->cmd.upmove || pm->alwaysAllowLean))
|
||||
{
|
||||
if( pm->cmd.buttons & BUTTON_LEAN_LEFT )
|
||||
{
|
||||
@@ -1515,6 +1518,10 @@ void PmoveSingle( pmove_t *pmove )
|
||||
}
|
||||
}
|
||||
|
||||
if (pm->ps->pm_flags & PMF_NO_LEAN) {
|
||||
pm->ps->fLeanAngle = 0;
|
||||
}
|
||||
|
||||
// update the viewangles
|
||||
PM_UpdateViewAngles( pm->ps, &pm->cmd );
|
||||
|
||||
@@ -1540,6 +1547,7 @@ void PmoveSingle( pmove_t *pmove )
|
||||
|
||||
if( ( pm->ps->pm_flags & PMF_NO_MOVE ) || ( pm->ps->pm_flags & PMF_FROZEN ) )
|
||||
{
|
||||
PM_CheckDuck();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -266,6 +266,7 @@ typedef enum {
|
||||
#define PMF_NO_GRAVITY (1<<12)
|
||||
#define PMF_NO_HUD (1<<13)
|
||||
#define PMF_UNKNOWN (1<<14)
|
||||
#define PMF_NO_LEAN (1<<15)
|
||||
|
||||
// moveposflags
|
||||
#define MPF_POSITION_STANDING (1<<0)
|
||||
@@ -293,6 +294,7 @@ typedef struct {
|
||||
int tracemask; // collide against these types of surfaces
|
||||
int debugLevel; // if set, diagnostic output will be printed
|
||||
qboolean noFootsteps; // if the game is setup for no footsteps by the server
|
||||
qboolean alwaysAllowLean;
|
||||
|
||||
int framecount;
|
||||
|
||||
@@ -551,6 +553,7 @@ extern const char *means_of_death_strings[];
|
||||
#define DF_FIXED_FOV (1<<15)
|
||||
#define DF_NO_DROP_WEAPONS (1<<16)
|
||||
#define DF_NO_FOOTSTEPS (1<<17)
|
||||
#define DF_ALLOW_LEAN_MOVEMENT (1<<18)
|
||||
|
||||
#define DF_WEAPON_LANDMINE_ALWAYS (1<<21)
|
||||
#define DF_WEAPON_NO_RIFLE (1<<22)
|
||||
|
||||
@@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
//
|
||||
// These values are the only one that must be set for the version
|
||||
#define PRODUCT_VERSION_MAJOR 0
|
||||
#define PRODUCT_VERSION_MINOR 56
|
||||
#define PRODUCT_VERSION_MINOR 57
|
||||
#define PRODUCT_VERSION_PATCH 0
|
||||
#define PRODUCT_VERSION_SUFFIX "alpha"
|
||||
|
||||
|
||||
@@ -848,7 +848,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
||||
}
|
||||
else if (shader->needsLSpherical)
|
||||
{
|
||||
if ((tr.refdef.rdflags & 2) != 0)
|
||||
if (tr.refdef.rdflags & RDF_HUD)
|
||||
{
|
||||
backEnd.currentSphere = &backEnd.hudSphere;
|
||||
backEnd.hudSphere.TessFunction = 0;
|
||||
|
||||
+19
-3
@@ -1986,9 +1986,25 @@ void R_LoadLightGrid(gamelump_t* plPal, gamelump_t* plOffsets, gamelump_t* plDat
|
||||
return;
|
||||
}
|
||||
|
||||
w->lightGridSize[0] = 32.0;
|
||||
w->lightGridSize[1] = 32.0;
|
||||
w->lightGridSize[2] = 32.0;
|
||||
switch (map_version)
|
||||
{
|
||||
case 21:
|
||||
w->lightGridSize[0] = 80.0;
|
||||
w->lightGridSize[1] = 80.0;
|
||||
w->lightGridSize[2] = 80.0;
|
||||
break;
|
||||
case 20:
|
||||
w->lightGridSize[0] = 48.0;
|
||||
w->lightGridSize[1] = 48.0;
|
||||
w->lightGridSize[2] = 64.0;
|
||||
break;
|
||||
default:
|
||||
w->lightGridSize[0] = 32.0;
|
||||
w->lightGridSize[1] = 32.0;
|
||||
w->lightGridSize[2] = 32.0;
|
||||
break;
|
||||
}
|
||||
|
||||
w->lightGridOOSize[0] = 1.0f / w->lightGridSize[0];
|
||||
w->lightGridOOSize[1] = 1.0f / w->lightGridSize[1];
|
||||
w->lightGridOOSize[2] = 1.0f / w->lightGridSize[2];
|
||||
|
||||
+166
-6
@@ -561,6 +561,8 @@ int R_RealDlightTerrain(cTerraPatchUnpacked_t* srf, int dlightBits) {
|
||||
vec[1] = srf->y0;
|
||||
|
||||
for (j = 0; j < 8; j++) {
|
||||
dj = 0;
|
||||
|
||||
for (;;) {
|
||||
if (j == 7) {
|
||||
if (dj >= lumelsPerHeight + 1) {
|
||||
@@ -581,11 +583,12 @@ int R_RealDlightTerrain(cTerraPatchUnpacked_t* srf, int dlightBits) {
|
||||
} else if (dj >= lumelsPerHeight) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
di = 0;
|
||||
z00 = srf->heightmap[9 * j + i];
|
||||
z01 = srf->heightmap[9 * (j + 1) + i];
|
||||
z10 = srf->heightmap[9 * j + (i + 1)];
|
||||
z01 = srf->heightmap[9 * (j + 1) + (i + 1)];
|
||||
z11 = srf->heightmap[9 * (j + 1) + (i + 1)];
|
||||
|
||||
heightPerLumelSquared = 2.f / (lumelsPerHeight * lumelsPerHeight);
|
||||
|
||||
@@ -703,23 +706,180 @@ void R_DlightBmodel( bmodel_t *bmodel ) {
|
||||
|
||||
static byte* R_GetLightGridPalettedColor(int iColor)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
return &tr.world->lightGridPalette[iColor * 3];
|
||||
}
|
||||
|
||||
void R_GetLightingGridValue(const vec3_t vPos, vec3_t vLight)
|
||||
{
|
||||
byte* pColor;
|
||||
int iBaseOffset;
|
||||
int i;
|
||||
int iOffset;
|
||||
int iRowPos;
|
||||
int iData;
|
||||
int iLen;
|
||||
int iGridPos[3];
|
||||
int iArrayXStep;
|
||||
float fV;
|
||||
float fFrac[3];
|
||||
float fOMFrac[3];
|
||||
float fWeight, fWeight2;
|
||||
float fTotalFactor;
|
||||
vec3_t vLightOrigin;
|
||||
byte* pCurData;
|
||||
|
||||
if (!tr.world || !tr.world->lightGridData || !tr.world->lightGridOffsets) {
|
||||
vLight[0] = vLight[1] = vLight[2] = tr.identityLightByte;
|
||||
return;
|
||||
}
|
||||
|
||||
vLight[0] = vLight[1] = vLight[2] = tr.identityLightByte;
|
||||
// FIXME: unimplemented
|
||||
VectorSubtract(vPos, tr.world->lightGridMins, vLightOrigin);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
fV = vLightOrigin[i] * tr.world->lightGridOOSize[i];
|
||||
iGridPos[i] = myftol(fV);
|
||||
fFrac[i] = fV - iGridPos[i];
|
||||
fOMFrac[i] = 1.0 - fFrac[i];
|
||||
|
||||
if (iGridPos[i] < 0) {
|
||||
iGridPos[i] = 0;
|
||||
} else if (iGridPos[i] > tr.world->lightGridBounds[i] - 2) {
|
||||
iGridPos[i] = tr.world->lightGridBounds[i] - 2;
|
||||
}
|
||||
}
|
||||
|
||||
fTotalFactor = 0;
|
||||
iArrayXStep = tr.world->lightGridBounds[1];
|
||||
iBaseOffset = tr.world->lightGridBounds[0] + iGridPos[0] * iArrayXStep + iGridPos[1];
|
||||
vLight[0] = vLight[1] = vLight[2] = 0;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
fWeight = fOMFrac[0] * fOMFrac[1] * fOMFrac[2];
|
||||
fWeight2 = fWeight;
|
||||
iOffset = tr.world->lightGridOffsets[iBaseOffset] + (tr.world->lightGridOffsets[iGridPos[0]] << 8);
|
||||
break;
|
||||
case 1:
|
||||
fWeight = fFrac[0] * fFrac[1] * fOMFrac[2];
|
||||
fWeight2 = fFrac[0] * fFrac[1] * fFrac[2];
|
||||
iOffset = tr.world->lightGridOffsets[iArrayXStep + 1 + iBaseOffset];
|
||||
break;
|
||||
case 2:
|
||||
fWeight = fFrac[0] * fOMFrac[1] * fOMFrac[2];
|
||||
fWeight2 = fFrac[0] * fOMFrac[1] * fFrac[2];
|
||||
iOffset = tr.world->lightGridOffsets[iArrayXStep + iBaseOffset];
|
||||
break;
|
||||
case 3:
|
||||
fWeight = fFrac[0] * fFrac[1] * fOMFrac[2];
|
||||
fWeight2 = fFrac[0] * fFrac[1] * fFrac[2];
|
||||
iOffset = tr.world->lightGridOffsets[iArrayXStep + 1 + iBaseOffset];
|
||||
break;
|
||||
}
|
||||
|
||||
iRowPos = iGridPos[2];
|
||||
pCurData = &tr.world->lightGridData[iOffset];
|
||||
iData = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
if (pCurData[iData] >= 0ul) {
|
||||
break;
|
||||
}
|
||||
|
||||
iLen = -pCurData[iData];
|
||||
if (iLen > iRowPos) {
|
||||
iData += iRowPos;
|
||||
if (pCurData[iData]) {
|
||||
pColor = R_GetLightGridPalettedColor(pCurData[iData]);
|
||||
VectorMA(vLight, fWeight, pColor, vLight);
|
||||
fTotalFactor += fWeight;
|
||||
}
|
||||
|
||||
iData++;
|
||||
if (iLen - 1 == iRowPos) {
|
||||
iData++;
|
||||
}
|
||||
|
||||
if (pCurData[iData]) {
|
||||
pColor = R_GetLightGridPalettedColor(pCurData[iData]);
|
||||
VectorMA(vLight, fWeight2, pColor, vLight);
|
||||
}
|
||||
|
||||
goto cont;
|
||||
}
|
||||
|
||||
iRowPos -= iLen;
|
||||
iData += iLen + 1;
|
||||
}
|
||||
|
||||
iLen = pCurData[iData] + 2;
|
||||
if (iLen - 1 >= iRowPos) {
|
||||
break;
|
||||
}
|
||||
|
||||
iRowPos -= iLen;
|
||||
iData++;
|
||||
}
|
||||
|
||||
if (iLen - 1 > iRowPos) {
|
||||
if (!pCurData[iData]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
pColor = R_GetLightGridPalettedColor(pCurData[iData]);
|
||||
VectorMA(vLight, fWeight + fWeight2, pColor, vLight);
|
||||
fTotalFactor += fWeight + fWeight2;
|
||||
} else {
|
||||
if (pCurData[iData]) {
|
||||
pColor = R_GetLightGridPalettedColor(pCurData[iData]);
|
||||
VectorMA(vLight, fWeight, pColor, vLight);
|
||||
fTotalFactor += fWeight;
|
||||
}
|
||||
|
||||
iData += 2;
|
||||
if (pCurData[iData]) {
|
||||
pColor = R_GetLightGridPalettedColor(pCurData[iData]);
|
||||
VectorMA(vLight, fWeight2, pColor, vLight);
|
||||
fTotalFactor += fWeight2;
|
||||
}
|
||||
}
|
||||
|
||||
cont:
|
||||
;
|
||||
}
|
||||
|
||||
if (fTotalFactor > 0.0 && fTotalFactor < 0.99) {
|
||||
VectorScale(vLight, 1.0 / fTotalFactor, vLight);
|
||||
}
|
||||
|
||||
if (fTotalFactor) {
|
||||
if (vLight[0] > 255.0 || vLight[1] > 255.0 || vLight[2] > 255.0) {
|
||||
float t;
|
||||
// normalize color values
|
||||
t = 255.0 / (float)Q_max(vLight[0], Q_max(vLight[1], vLight[2]));
|
||||
|
||||
vLight[0] = (float)vLight[0] * t;
|
||||
vLight[1] = (float)vLight[1] * t;
|
||||
vLight[2] = (float)vLight[2] * t;
|
||||
}
|
||||
} else {
|
||||
vLight[0] = vLight[1] = vLight[2] = tr.identityLightByte;
|
||||
}
|
||||
}
|
||||
|
||||
void R_GetLightingGridValueFast(const vec3_t vPos, vec3_t vLight)
|
||||
{
|
||||
if (!tr.world->lightGridData || !tr.world->lightGridOffsets) {
|
||||
vLight[0] = vLight[1] = vLight[2] = tr.identityLightByte;
|
||||
return;
|
||||
}
|
||||
|
||||
// FIXME: unimplemented
|
||||
VectorSet(vLight, 1.f, 1.f, 1.f);
|
||||
vLight[0] = vLight[1] = vLight[2] = tr.identityLightByte;
|
||||
}
|
||||
|
||||
void R_GetLightingForDecal(vec3_t vLight, const vec3_t vFacing, const vec3_t vOrigin)
|
||||
|
||||
@@ -148,7 +148,7 @@ typedef struct {
|
||||
int value;
|
||||
} ambient;
|
||||
int numRealLights;
|
||||
reallightinfo_t light[32];
|
||||
reallightinfo_t light[MAX_REAL_LIGHTS];
|
||||
int bUsesCubeMap;
|
||||
float cubemap[24][3][4];
|
||||
} sphereor_t;
|
||||
@@ -958,7 +958,7 @@ typedef struct cStaticModelUnpacked_s {
|
||||
int numVertexData;
|
||||
int visCount;
|
||||
dtiki_t* tiki;
|
||||
sphere_dlight_t dlights[32];
|
||||
sphere_dlight_t dlights[MAX_DLIGHTS];
|
||||
int numdlights;
|
||||
float radius;
|
||||
float cull_radius;
|
||||
@@ -1869,7 +1869,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);
|
||||
int R_SphereInLeafs(const vec3_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);
|
||||
|
||||
+1148
-28
File diff suppressed because it is too large.
Load diff
@@ -581,9 +581,50 @@ 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;
|
||||
int R_SphereInLeafs(const vec3_t p, float r, mnode_t** nodes, int nMaxNodes) {
|
||||
mnode_t* nodestack[1024];
|
||||
int iNodeStackPos;
|
||||
mnode_t* pCurNode;
|
||||
int nFoundNodes;
|
||||
|
||||
iNodeStackPos = 0;
|
||||
pCurNode = tr.world->nodes;
|
||||
nFoundNodes = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
cplane_t* plane;
|
||||
float d;
|
||||
|
||||
while (pCurNode->contents == -1)
|
||||
{
|
||||
plane = pCurNode->plane;
|
||||
if (plane->type >= PLANE_NON_AXIAL) {
|
||||
d = DotProduct(p, plane->normal) - plane->dist;
|
||||
} else {
|
||||
d = p[plane->type] - plane->dist;
|
||||
}
|
||||
|
||||
if (d < r) {
|
||||
if (d > -r) {
|
||||
nodestack[iNodeStackPos++] = pCurNode->children[0];
|
||||
}
|
||||
pCurNode = pCurNode->children[1];
|
||||
} else {
|
||||
pCurNode = pCurNode->children[0];
|
||||
}
|
||||
}
|
||||
|
||||
nodes[nFoundNodes++] = pCurNode;
|
||||
if (!iNodeStackPos || nFoundNodes == nMaxNodes) {
|
||||
break;
|
||||
}
|
||||
|
||||
iNodeStackPos--;
|
||||
pCurNode = nodestack[iNodeStackPos];
|
||||
}
|
||||
|
||||
return nFoundNodes;
|
||||
}
|
||||
/*
|
||||
===============
|
||||
|
||||
@@ -24,7 +24,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#define __TR_TYPES_H
|
||||
|
||||
|
||||
#define MAX_DLIGHTS 32 // can't be increased, because bit flags are used on surfaces
|
||||
#define MAX_DLIGHTS 32 // can't be increased, because bit flags are used on surfaces
|
||||
#define MAX_REAL_LIGHTS 32
|
||||
|
||||
#define REFENTITYNUM_BITS 10 // can't be increased without changing drawsurf bit packing
|
||||
#define REFENTITYNUM_MASK ((1<<REFENTITYNUM_BITS) - 1)
|
||||
@@ -60,6 +61,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
// refdef flags
|
||||
#define RDF_NOWORLDMODEL 0x0001 // used for player configuration screen
|
||||
#define RDF_HUD 0x0002
|
||||
#define RDF_HYPERSPACE 0x0004 // teleportation effect
|
||||
|
||||
typedef struct {
|
||||
|
||||
Reference in new issue
Block a user