This commit is contained in:
OM 2023-05-27 16:19:31 +02:00
parent 3d223f5a5d
commit f1f9ed744d
12 changed files with 233 additions and 269 deletions

View file

@ -25,247 +25,4 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#pragma once #pragma once
#define MAX_DLIGHTS 32 // can't be increased, because bit flags are used on surfaces #include "../renderercommon/tr_types.h"
#define MAX_ENTITIES 1023 // can't be increased without changing drawsurf bit packing
#define MAX_POINTS 32
#define MAX_SPRITES 1024
// 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
{
float pos[2];
float size[2];
} letterloc_t;
typedef struct fontheader_s
{
int indirection[256];
letterloc_t locations[256];
char name[64];
float height;
float aspectRatio;
void *shader;
int trhandle; // the last renderer handle this font used
} fontheader_t;
typedef struct {
vec3_t xyz;
float st[2];
byte modulate[4];
} polyVert_t;
typedef struct poly_s {
qhandle_t hShader;
int numVerts;
polyVert_t *verts;
} poly_t;
typedef enum {
RT_MODEL,
RT_SPRITE,
RT_BEAM,
RT_PORTALSURFACE, // doesn't draw anything, just info for portals
RT_MAX_REF_ENTITY_TYPE
} refEntityType_t;
typedef enum {
lensflare = ( 1 << 0 ),
viewlensflare = ( 1 << 1 ),
additive = ( 1 << 2 )
} dlighttype_t;
struct tikiFrame_s;
struct dtiki_s;
typedef struct {
refEntityType_t reType;
int renderfx;
qhandle_t hModel; // opaque type outside refresh
qhandle_t hOldModel;
// most recent data
vec3_t lightingOrigin; // so multi-part models can be lit identically (RF_LIGHTING_ORIGIN)
int parentEntity;
vec3_t axis[3]; // rotation vectors
qboolean nonNormalizedAxes; // axis are not normalized, i.e. they have scale
float origin[3]; // also used as MODEL_BEAM's "from"
frameInfo_t frameInfo[MAX_FRAMEINFOS];
float actionWeight;
short wasframe;
float scale; // scale of the thing
// previous data for frame interpolation
float oldorigin[3]; // also used as MODEL_BEAM's "to"
// texturing
int skinNum; // inline skin index
qhandle_t customShader; // use one image for the entire thing
// misc
byte shaderRGBA[4]; // colors used by colorSrc=vertex shaders
float shaderTexCoord[2]; // texture coordinates used by tcMod=vertex modifiers
float shaderTime; // subtracted from refdef time to control effect start times
int entityNumber; // the real entity number
byte surfaces[MAX_MODEL_SURFACES]; // the surface state of the entity
float shader_data[ 2 ]; // data passed in from shader manipulation
int *bone_tag;
vec4_t *bone_quat;
// renderer use only
struct tikiFrame_s *of,
*nf;
struct dtiki_s *tiki;
int bonestart;
int morphstart;
qboolean hasMorph;
// extra sprite information
float radius;
float rotation;
} refEntity_t;
#define MAX_RENDER_STRINGS 8
#define MAX_RENDER_STRING_LENGTH 32
typedef struct {
int x, y, width, height;
float fov_x, fov_y;
vec3_t vieworg;
vec3_t viewaxis[3]; // transformation matrix
// time in milliseconds for shader effects and other time dependent rendering issues
int time;
int rdflags; // RDF_NOWORLDMODEL, etc
// 1 bits will prevent the associated area from rendering at all
byte areamask[MAX_MAP_AREA_BYTES];
// fog stuff
float farplane_distance;
vec3_t farplane_color;
qboolean farplane_cull;
// sky portal stuff
qboolean sky_portal;
float sky_alpha;
vec3_t sky_origin;
vec3_t sky_axis[ 3 ];
} refdef_t;
typedef enum {
STEREO_CENTER,
STEREO_LEFT,
STEREO_RIGHT
} stereoFrame_t;
/*
** glconfig_t
**
** Contains variables specific to the OpenGL configuration
** being run right now. These are constant once the OpenGL
** subsystem is initialized.
*/
typedef enum {
TC_NONE,
TC_S3TC, // this is for the GL_S3_s3tc extension.
TC_S3TC_ARB // this is for the GL_EXT_texture_compression_s3tc extension.
} textureCompression_t;
typedef enum {
GLDRV_ICD, // driver is integrated with window system
// WARNING: there are tests that check for
// > GLDRV_ICD for minidriverness, so this
// should always be the lowest value in this
// enum set
GLDRV_STANDALONE, // driver is a non-3Dfx standalone driver
GLDRV_VOODOO, // driver is a 3Dfx standalone driver
// XreaL BEGIN
GLDRV_DEFAULT, // old OpenGL system
GLDRV_OPENGL3, // new driver system
GLDRV_MESA // crap
// XreaL END
} glDriverType_t;
typedef enum {
GLHW_GENERIC, // where everthing works the way it should
GLHW_3DFX_2D3D, // Voodoo Banshee or Voodoo3, relevant since if this is
// the hardware type then there can NOT exist a secondary
// display adapter
GLHW_RIVA128, // where you can't interpolate alpha
GLHW_RAGEPRO, // where you can't modulate alpha on alpha textures
GLHW_PERMEDIA2, // where you don't have src*dst
// XreaL BEGIN
GLHW_ATI, // where you don't have proper GLSL support
GLHW_ATI_DX10, // ATI Radeon HD series DX10 hardware
GLHW_NV_DX10 // Geforce 8/9 class DX10 hardware
// XreaL END
} glHardwareType_t;
typedef struct {
char renderer_string[ MAX_STRING_CHARS ];
char vendor_string[ MAX_STRING_CHARS ];
char version_string[ MAX_STRING_CHARS ];
char extensions_string[ MAX_STRING_CHARS * 2 ];
int maxTextureSize; // queried from GL
int maxActiveTextures; // multitexture ability
int colorBits, depthBits, stencilBits;
glDriverType_t driverType;
glHardwareType_t hardwareType;
qboolean deviceSupportsGamma;
textureCompression_t textureCompression;
qboolean textureEnvAddAvailable;
int vidWidth, vidHeight;
// aspect is the screen's physical width / height, which may be different
// than scrWidth / scrHeight if the pixels are non-square
// normal screens should be 4/3, but wide aspect monitors may be 16/9
float windowAspect;
int displayFrequency;
// synonymous with "does rendering consume the entire screen?", therefore
// a Voodoo or Voodoo2 will have this set to TRUE, as will a Win32 ICD that
// used CDS.
qboolean isFullscreen;
qboolean stereoEnabled;
qboolean smpActive; // dual processor
int registerCombinerAvailable;
qboolean secondaryColorAvailable;
qboolean VAR;
qboolean fence;
// ioq3
int numTextureUnits;
} glconfig_t;
#if !defined _WIN32
#define _3DFX_DRIVER_NAME "libMesaVoodooGL.so.3.1"
#define OPENGL_DRIVER_NAME "libGL.so"
#else
#define _3DFX_DRIVER_NAME "3dfxvgl"
#define OPENGL_DRIVER_NAME "opengl32"
#endif // !defined _WIN32

View file

@ -2708,7 +2708,10 @@ void CL_RefFS_WriteFile(const char* qpath, const void* buffer, int size) {
} }
char** CL_RefFS_ListFiles(const char* name, const char* extension, int* numfilesfound) { char** CL_RefFS_ListFiles(const char* name, const char* extension, int* numfilesfound) {
return FS_ListFiles(path, extension, qtrue, numfilesfound); return FS_ListFiles(name, extension, qtrue, numfilesfound);
}
void CL_RefCIN_UploadCinematic(int handle) {
} }
/* /*
@ -2786,6 +2789,28 @@ void CL_InitRef( void ) {
ri.newri.GetCentroidRadiusInternal = TIKI_GetCentroidRadiusInternal; ri.newri.GetCentroidRadiusInternal = TIKI_GetCentroidRadiusInternal;
ri.newri.GetFrameInternal = TIKI_GetFrameInternal; ri.newri.GetFrameInternal = TIKI_GetFrameInternal;
//
// ioq3 stuff
//
ri.Cvar_CheckRange = Cvar_CheckRange;
ri.Cvar_SetDescription = Cvar_SetDescription;
ri.Cvar_VariableIntegerValue = Cvar_VariableIntegerValue;
ri.CIN_UploadCinematic = CL_RefCIN_UploadCinematic;
ri.CIN_PlayCinematic = CIN_PlayCinematic;
ri.CIN_RunCinematic = CIN_RunCinematic;
ri.CL_WriteAVIVideoFrame = CL_WriteAVIVideoFrame;
ri.IN_Init = IN_Init;
ri.IN_Shutdown = IN_Shutdown;
ri.IN_Restart = IN_Restart;
ri.ftol = Q_ftol;
ri.Sys_SetEnv = Sys_SetEnv;
ri.Sys_GLimpSafeInit = Sys_GLimpSafeInit;
ri.Sys_GLimpInit = Sys_GLimpInit;
ri.Sys_LowPhysicalMemory = Sys_LowPhysicalMemory;
#ifdef USE_RENDERER_DLL #ifdef USE_RENDERER_DLL
// su44: load renderer dll // su44: load renderer dll
cl_renderer = Cvar_Get("cl_renderer", "glom", CVAR_ARCHIVE); cl_renderer = Cvar_Get("cl_renderer", "glom", CVAR_ARCHIVE);
@ -2843,7 +2868,7 @@ void CL_InitRef( void ) {
qboolean CL_SetVidMode( int mode ) { qboolean CL_SetVidMode( int mode ) {
qboolean ret; qboolean ret;
ret = re.SetMode( mode, &cls.glconfig ); ret = re.newre.SetMode( mode, &cls.glconfig );
if( cge ) { if( cge ) {
cge->CG_GetRendererConfig(); cge->CG_GetRendererConfig();
@ -2854,7 +2879,7 @@ qboolean CL_SetVidMode( int mode ) {
} }
void CL_SetFullscreen( qboolean fullscreen ) { void CL_SetFullscreen( qboolean fullscreen ) {
re.SetFullscreen( fullscreen ); re.newre.SetFullscreen( fullscreen );
if( cge ) { if( cge ) {
cge->CG_GetRendererConfig(); cge->CG_GetRendererConfig();
@ -2900,7 +2925,7 @@ void CL_TikiInfoCommand_f( void ) {
COM_DefaultExtension( modelname, sizeof( modelname ), ".tik" ); COM_DefaultExtension( modelname, sizeof( modelname ), ".tik" );
hModel = re.RegisterModel( modelname ); hModel = re.RegisterModel( modelname );
tiki = re.R_Model_GetHandle( hModel ); tiki = re.newre.R_Model_GetHandle( hModel );
TIKI_ModelInfo( tiki ); TIKI_ModelInfo( tiki );
} }

View file

@ -1027,6 +1027,39 @@ void Cvar_InfoStringBuffer( int bit, char* buff, int buffsize ) {
Q_strncpyz(buff,Cvar_InfoString(bit),buffsize); Q_strncpyz(buff,Cvar_InfoString(bit),buffsize);
} }
/*
=====================
Cvar_CheckRange
=====================
*/
void Cvar_CheckRange( cvar_t *var, float min, float max, qboolean integral )
{
var->validate = qtrue;
var->min = min;
var->max = max;
var->integral = integral;
// Force an initial range check
Cvar_Set( var->name, var->string );
}
/*
=====================
Cvar_SetDescription
=====================
*/
void Cvar_SetDescription( cvar_t *var, const char *var_description )
{
if( var_description && var_description[0] != '\0' )
{
if( var->description != NULL )
{
Z_Free( var->description );
}
var->description = CopyString( var_description );
}
}
/* /*
===================== =====================
Cvar_Register Cvar_Register
@ -1090,6 +1123,22 @@ void Cvar_Update( vmCvar_t *vmCvar ) {
vmCvar->integer = cv->integer; vmCvar->integer = cv->integer;
} }
/*
==================
Cvar_CompleteCvarName
==================
*/
void Cvar_CompleteCvarName( const char *args, int argNum )
{
if( argNum == 2 )
{
// Skip "<cmd> "
char *p = Com_SkipTokens( args, 1, " " );
if( p > args )
Field_CompleteCommand( p, qfalse, qtrue );
}
}
/* /*
============ ============

View file

@ -1284,7 +1284,9 @@ default values.
#define CVAR_NONEXISTENT 0xFFFFFFFF // Cvar doesn't exist. #define CVAR_NONEXISTENT 0xFFFFFFFF // Cvar doesn't exist.
// nothing outside the Cvar_*() functions should modify these fields! // nothing outside the Cvar_*() functions should modify these fields!
typedef struct cvar_s { typedef struct cvar_s cvar_t;
struct cvar_s {
char *name; char *name;
char *string; char *string;
char *resetString; // cvar_restart will reset to this value char *resetString; // cvar_restart will reset to this value
@ -1294,9 +1296,18 @@ typedef struct cvar_s {
int modificationCount; // incremented each time the cvar is changed int modificationCount; // incremented each time the cvar is changed
float value; // atof( string ) float value; // atof( string )
int integer; // atoi( string ) int integer; // atoi( string )
struct cvar_s *next; qboolean validate;
struct cvar_s *hashNext; qboolean integral;
} cvar_t; float min;
float max;
char *description;
cvar_t *next;
cvar_t *prev;
cvar_t *hashNext;
cvar_t *hashPrev;
int hashIndex;
};
#define MAX_CVAR_VALUE_STRING 256 #define MAX_CVAR_VALUE_STRING 256

View file

@ -608,10 +608,14 @@ char *Cvar_InfoString_Big( int bit );
// returns an info string containing all the cvars that have the given bit set // returns an info string containing all the cvars that have the given bit set
// in their flags ( CVAR_USERINFO, CVAR_SERVERINFO, CVAR_SYSTEMINFO, etc ) // in their flags ( CVAR_USERINFO, CVAR_SERVERINFO, CVAR_SYSTEMINFO, etc )
void Cvar_InfoStringBuffer( int bit, char *buff, int buffsize ); void Cvar_InfoStringBuffer( int bit, char *buff, int buffsize );
void Cvar_CheckRange( cvar_t *cv, float minVal, float maxVal, qboolean shouldBeIntegral );
void Cvar_SetDescription( cvar_t *var, const char *var_description );
void Cvar_Restart_f( void ); void Cvar_Restart_f( void );
void Cvar_SaveGameRestart_f( void ); void Cvar_SaveGameRestart_f( void );
void Cvar_CompleteCvarName(const char* args, int argNum);
extern int cvar_modifiedFlags; extern int cvar_modifiedFlags;
extern qboolean cvar_global_force; extern qboolean cvar_global_force;
// whenever a cvar is modifed, its flags will be OR'd into this, so // whenever a cvar is modifed, its flags will be OR'd into this, so
@ -1136,7 +1140,7 @@ qboolean SV_GameCommand( void );
// //
// input interface // input interface
// //
void IN_Init(void); void IN_Init(void *windowData);
void IN_Frame(void); void IN_Frame(void);
void IN_Shutdown(void); void IN_Shutdown(void);
void IN_Restart(void); void IN_Restart(void);
@ -1272,7 +1276,9 @@ void Sys_EndStreamedFile(fileHandle_t f);
int Sys_StreamedRead(void* buffer, int size, int count, fileHandle_t f); int Sys_StreamedRead(void* buffer, int size, int count, fileHandle_t f);
void Sys_StreamSeek(fileHandle_t f, int offset, int origin); void Sys_StreamSeek(fileHandle_t f, int offset, int origin);
qboolean Sys_LowPhysicalMemory( void ); qboolean Sys_LowPhysicalMemory(void);
void Sys_SetEnv(const char* name, const char* value);
void SetNormalThreadPriority( void ); void SetNormalThreadPriority( void );
void SetBelowNormalThreadPriority( void ); void SetBelowNormalThreadPriority( void );

View file

@ -20,8 +20,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=========================================================================== ===========================================================================
*/ */
#include "../../cgame/tr_types.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View file

@ -0,0 +1,50 @@
/*
===========================================================================
Copyright (C) 2023 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#define MAX_ENTITIES 1023 // can't be increased without changing drawsurf bit packing
#define MAX_POINTS 32
#define MAX_SPRITES 1024
#define RDF_FULLBRIGHT 2 // fullbright intensity
typedef struct
{
float pos[2];
float size[2];
} letterloc_t;
typedef struct fontheader_s
{
int indirection[256];
letterloc_t locations[256];
char name[64];
float height;
float aspectRatio;
void* shader;
int trhandle; // the last renderer handle this font used
} fontheader_t;
typedef enum {
lensflare = (1 << 0),
viewlensflare = (1 << 1),
additive = (1 << 2)
} dlighttype_t;

View file

@ -25,6 +25,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "tr_types.h" #include "tr_types.h"
#include "new/tr_public_new.h" #include "new/tr_public_new.h"
#ifdef __cplusplus
extern "C" {
#endif
#define REF_API_VERSION 8 #define REF_API_VERSION 8
// //
@ -197,4 +201,8 @@ typedef refexport_t* (QDECL *GetRefAPI_t) (int apiVersion, refimport_t * rimp);
refexport_t*GetRefAPI( int apiVersion, refimport_t *rimp ); refexport_t*GetRefAPI( int apiVersion, refimport_t *rimp );
#endif #endif
#ifdef __cplusplus
}
#endif
#endif // __TR_PUBLIC_H #endif // __TR_PUBLIC_H

View file

@ -84,6 +84,9 @@ typedef enum {
RT_MAX_REF_ENTITY_TYPE RT_MAX_REF_ENTITY_TYPE
} refEntityType_t; } refEntityType_t;
struct tikiFrame_s;
struct dtiki_s;
typedef struct { typedef struct {
refEntityType_t reType; refEntityType_t reType;
int renderfx; int renderfx;
@ -117,6 +120,34 @@ typedef struct {
// extra sprite information // extra sprite information
float radius; float radius;
float rotation; float rotation;
//
// Non-IOQ3 stuff
//
int parentEntity;
frameInfo_t frameInfo[MAX_FRAMEINFOS];
float actionWeight;
short wasframe;
float scale; // scale of the thing
qhandle_t hOldModel;
int entityNumber; // the real entity number
byte surfaces[MAX_MODEL_SURFACES]; // the surface state of the entity
float shader_data[ 2 ]; // data passed in from shader manipulation
int *bone_tag;
vec4_t *bone_quat;
// renderer use only
struct tikiFrame_s *of,
*nf;
struct dtiki_s *tiki;
int bonestart;
int morphstart;
qboolean hasMorph;
} refEntity_t; } refEntity_t;
@ -139,6 +170,21 @@ typedef struct {
// text messages for deform text shaders // text messages for deform text shaders
char text[MAX_RENDER_STRINGS][MAX_RENDER_STRING_LENGTH]; char text[MAX_RENDER_STRINGS][MAX_RENDER_STRING_LENGTH];
//
// Non-IOQ3 stuff
//
// fog stuff
float farplane_distance;
vec3_t farplane_color;
qboolean farplane_cull;
// sky portal stuff
qboolean sky_portal;
float sky_alpha;
vec3_t sky_origin;
vec3_t sky_axis[3];
} refdef_t; } refdef_t;
@ -214,6 +260,12 @@ typedef struct {
qboolean isFullscreen; qboolean isFullscreen;
qboolean stereoEnabled; qboolean stereoEnabled;
qboolean smpActive; // UNUSED, present for compatibility qboolean smpActive; // UNUSED, present for compatibility
int registerCombinerAvailable;
qboolean secondaryColorAvailable;
qboolean VAR;
qboolean fence;
} glconfig_t; } glconfig_t;
#include "new/tr_types_new.h"
#endif // __TR_TYPES_H #endif // __TR_TYPES_H

View file

@ -1425,8 +1425,8 @@ void R_Init( void ) {
Com_Memset( &backEnd, 0, sizeof( backEnd ) ); Com_Memset( &backEnd, 0, sizeof( backEnd ) );
Com_Memset( &tess, 0, sizeof( tess ) ); Com_Memset( &tess, 0, sizeof( tess ) );
if(sizeof(glconfig_t) != 11332) //if(sizeof(glconfig_t) != 11332)
ri.Error( ERR_FATAL, "Mod ABI incompatible: sizeof(glconfig_t) == %u != 11332", (unsigned int) sizeof(glconfig_t)); // ri.Error( ERR_FATAL, "Mod ABI incompatible: sizeof(glconfig_t) == %u != 11332", (unsigned int) sizeof(glconfig_t));
// Swap_Init(); // Swap_Init();

View file

@ -23,6 +23,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../qcommon/q_shared.h" #include "../qcommon/q_shared.h"
#include "../qcommon/qcommon.h" #include "../qcommon/qcommon.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef DEDICATED #ifndef DEDICATED
#ifdef USE_LOCAL_HEADERS #ifdef USE_LOCAL_HEADERS
# include "SDL_version.h" # include "SDL_version.h"
@ -71,3 +75,7 @@ char *Sys_ParseProtocolUri( const char *uri );
#endif #endif
#include "new/sys_local_new.h" #include "new/sys_local_new.h"
#ifdef __cplusplus
}
#endif

View file

@ -39,7 +39,7 @@ int main(int argc, const char** argv)
while (std::getline(ifp, buffer)) while (std::getline(ifp, buffer))
{ {
// Strip trailing whitespace from line // Strip trailing whitespace from line
const char* end = buffer.c_str() + buffer.length() - 1; const char* end = buffer.c_str() + buffer.length();
while (end >= buffer.c_str() && isspace(*end)) { while (end >= buffer.c_str() && isspace(*end)) {
end--; end--;
} }