27 Jun 2012

This commit is contained in:
g-cont 2012-06-27 00:00:00 +04:00 committed by Alibek Omarov
parent 0b296ece60
commit 70a8a7f40e
19 changed files with 155 additions and 931 deletions

View File

@ -35,6 +35,38 @@ Engine: implement new system of engine features that can be enabled by Mod-Maker
Engine: build BSP surface meshes for Mod-Makers. e.g. for build collision tree of VBO\VA custom rendering
Engine: allow support of large maps up to +\- 16384 units (need to edit delta.lst and enable feature in the engine)
Engine: rewrite MOVETYPE_TOSS, MOVETYPE_BOUNCE etc
Client: implement new draw type TRI_POINTS for TriAPI
Client: changed snapshot name from mapnameXXXX.bmp to mapname_XXXX.bmp (by Qwertyus request)
Client: write experimental code for interpolate bmodels movement (pev->animtime must not equal 0 for enable)
GameUI: allow scissor for enginefunc pfnDrawCharacter
Network: protocol changed. replace obsolete message svc_frame with message svc_restoresound
Client: remove pieces that stuck in the walls for TE_BREAKMODEL message
Render: added new internal texture that called a "*grayCube" without quotes
Render: fix mode r_lighting_extended 1 for prevent permanently black lighting in some cases
Render: global fog update. get the uniform color for all the underwater objects
Render: fix issues with conveyor HD-textures (it can moves slower than physical conveyor speed)
Render: added support for HD-textures for normal sprite frames (non-HUD sprites)
Render: sorting meshes for studiomodel surfaces (draw "adiitive" surfaces at end of the list)
Render: release GL-context when engine is shutting down
Render: set gl_allow_static to zero as default
Sound: set s_cull to zero as default
Input: fix problems with call WC_SYSMENU instead of user-defined command when ALT is pressed
Console: add a new command that called "mapstats" and works like bspinfo.exe
Physic: added new meta-type SOLID_CUSTOM that could be traced in game dlls with physic API
Pmove: get to work PM_CheckStuck on a servder-sdie
Server: added a new cvar that called a "sv_validate_changelevel" for skip any checks with changelevel problems
Server: make check for recursive changelevel (and ignore it)
Server: fix the problem with non-sended events when a player sight cross-line contents
Server: rewrite MOVETYPE_STEP and MOVETYPE_PUSHSTEP physics
Server: allow to MOVETYEP_PUSH blocking by dead bodies
Server: fix bug with MOVETYPE_FOLLOW
Server: added TriAPI through Server_PhysicsInterface for debug purposes
GameUI: replace broken letter '¸' with 'å'
GameUI: don't draw logo.avi for mods without this file in gamedir
GameUI: fix buttons loader bug
GameUI: enable scissor for all ScrollList menus
GameUI: restore the menu buttons control from keyboard
build 1905

View File

@ -1,29 +0,0 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "cl_dll"=.\cl_dll.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

Binary file not shown.

Binary file not shown.

View File

@ -1,16 +0,0 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: cl_dll - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
client.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -1,141 +0,0 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: hl - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ÌÈØÀ~1.E0B\LOCALS~1\Temp\RSP1048.tmp" with contents
[
/nologo /G5 /MT /W3 /O2 /I "..\dlls" /I "..\engine" /I "..\common" /I "..\pm_shared" /I "..\game_shared" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "QUIVER" /D "VOXEL" /D "QUAKE2" /D "VALVE_DLL" /D "CLIENT_WEAPONS" /Fr"..\temp\dlls\!release/" /Fp"..\temp\dlls\!release/hl.pch" /YX /Fo"..\temp\dlls\!release/" /Fd"..\temp\dlls\!release/" /FD /c
"D:\Xash3D\src_main\dlls\client.cpp"
]
Creating command line "cl.exe @"C:\DOCUME~1\ÌÈØÀ~1.E0B\LOCALS~1\Temp\RSP1048.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ~1.E0B\LOCALS~1\Temp\RSP1049.tmp" with contents
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"..\temp\dlls\!release/hl.pdb" /debug /machine:I386 /def:".\hl.def" /out:"..\temp\dlls\!release/hl.dll" /implib:"..\temp\dlls\!release/hl.lib"
"\Xash3D\src_main\temp\dlls\!release\aflock.obj"
"\Xash3D\src_main\temp\dlls\!release\agrunt.obj"
"\Xash3D\src_main\temp\dlls\!release\airtank.obj"
"\Xash3D\src_main\temp\dlls\!release\animating.obj"
"\Xash3D\src_main\temp\dlls\!release\animation.obj"
"\Xash3D\src_main\temp\dlls\!release\apache.obj"
"\Xash3D\src_main\temp\dlls\!release\barnacle.obj"
"\Xash3D\src_main\temp\dlls\!release\barney.obj"
"\Xash3D\src_main\temp\dlls\!release\bigmomma.obj"
"\Xash3D\src_main\temp\dlls\!release\bloater.obj"
"\Xash3D\src_main\temp\dlls\!release\bmodels.obj"
"\Xash3D\src_main\temp\dlls\!release\bullsquid.obj"
"\Xash3D\src_main\temp\dlls\!release\buttons.obj"
"\Xash3D\src_main\temp\dlls\!release\cbase.obj"
"\Xash3D\src_main\temp\dlls\!release\client.obj"
"\Xash3D\src_main\temp\dlls\!release\combat.obj"
"\Xash3D\src_main\temp\dlls\!release\controller.obj"
"\Xash3D\src_main\temp\dlls\!release\crossbow.obj"
"\Xash3D\src_main\temp\dlls\!release\crowbar.obj"
"\Xash3D\src_main\temp\dlls\!release\defaultai.obj"
"\Xash3D\src_main\temp\dlls\!release\doors.obj"
"\Xash3D\src_main\temp\dlls\!release\effects.obj"
"\Xash3D\src_main\temp\dlls\!release\egon.obj"
"\Xash3D\src_main\temp\dlls\!release\explode.obj"
"\Xash3D\src_main\temp\dlls\!release\flyingmonster.obj"
"\Xash3D\src_main\temp\dlls\!release\func_break.obj"
"\Xash3D\src_main\temp\dlls\!release\func_tank.obj"
"\Xash3D\src_main\temp\dlls\!release\game.obj"
"\Xash3D\src_main\temp\dlls\!release\gamerules.obj"
"\Xash3D\src_main\temp\dlls\!release\gargantua.obj"
"\Xash3D\src_main\temp\dlls\!release\gauss.obj"
"\Xash3D\src_main\temp\dlls\!release\genericmonster.obj"
"\Xash3D\src_main\temp\dlls\!release\ggrenade.obj"
"\Xash3D\src_main\temp\dlls\!release\globals.obj"
"\Xash3D\src_main\temp\dlls\!release\gman.obj"
"\Xash3D\src_main\temp\dlls\!release\h_ai.obj"
"\Xash3D\src_main\temp\dlls\!release\h_battery.obj"
"\Xash3D\src_main\temp\dlls\!release\h_cine.obj"
"\Xash3D\src_main\temp\dlls\!release\h_cycler.obj"
"\Xash3D\src_main\temp\dlls\!release\h_export.obj"
"\Xash3D\src_main\temp\dlls\!release\handgrenade.obj"
"\Xash3D\src_main\temp\dlls\!release\hassassin.obj"
"\Xash3D\src_main\temp\dlls\!release\headcrab.obj"
"\Xash3D\src_main\temp\dlls\!release\healthkit.obj"
"\Xash3D\src_main\temp\dlls\!release\hgrunt.obj"
"\Xash3D\src_main\temp\dlls\!release\hl_wpn_glock.obj"
"\Xash3D\src_main\temp\dlls\!release\hornet.obj"
"\Xash3D\src_main\temp\dlls\!release\hornetgun.obj"
"\Xash3D\src_main\temp\dlls\!release\houndeye.obj"
"\Xash3D\src_main\temp\dlls\!release\ichthyosaur.obj"
"\Xash3D\src_main\temp\dlls\!release\islave.obj"
"\Xash3D\src_main\temp\dlls\!release\items.obj"
"\Xash3D\src_main\temp\dlls\!release\leech.obj"
"\Xash3D\src_main\temp\dlls\!release\lights.obj"
"\Xash3D\src_main\temp\dlls\!release\maprules.obj"
"\Xash3D\src_main\temp\dlls\!release\monstermaker.obj"
"\Xash3D\src_main\temp\dlls\!release\monsters.obj"
"\Xash3D\src_main\temp\dlls\!release\monsterstate.obj"
"\Xash3D\src_main\temp\dlls\!release\mortar.obj"
"\Xash3D\src_main\temp\dlls\!release\mp5.obj"
"\Xash3D\src_main\temp\dlls\!release\multiplay_gamerules.obj"
"\Xash3D\src_main\temp\dlls\!release\nihilanth.obj"
"\Xash3D\src_main\temp\dlls\!release\nodes.obj"
"\Xash3D\src_main\temp\dlls\!release\osprey.obj"
"\Xash3D\src_main\temp\dlls\!release\pathcorner.obj"
"\Xash3D\src_main\temp\dlls\!release\plane.obj"
"\Xash3D\src_main\temp\dlls\!release\plats.obj"
"\Xash3D\src_main\temp\dlls\!release\player.obj"
"\Xash3D\src_main\temp\dlls\!release\pm_debug.obj"
"\Xash3D\src_main\temp\dlls\!release\pm_math.obj"
"\Xash3D\src_main\temp\dlls\!release\pm_shared.obj"
"\Xash3D\src_main\temp\dlls\!release\python.obj"
"\Xash3D\src_main\temp\dlls\!release\rat.obj"
"\Xash3D\src_main\temp\dlls\!release\roach.obj"
"\Xash3D\src_main\temp\dlls\!release\rpg.obj"
"\Xash3D\src_main\temp\dlls\!release\satchel.obj"
"\Xash3D\src_main\temp\dlls\!release\schedule.obj"
"\Xash3D\src_main\temp\dlls\!release\scientist.obj"
"\Xash3D\src_main\temp\dlls\!release\scripted.obj"
"\Xash3D\src_main\temp\dlls\!release\shotgun.obj"
"\Xash3D\src_main\temp\dlls\!release\singleplay_gamerules.obj"
"\Xash3D\src_main\temp\dlls\!release\skill.obj"
"\Xash3D\src_main\temp\dlls\!release\sound.obj"
"\Xash3D\src_main\temp\dlls\!release\soundent.obj"
"\Xash3D\src_main\temp\dlls\!release\spectator.obj"
"\Xash3D\src_main\temp\dlls\!release\squadmonster.obj"
"\Xash3D\src_main\temp\dlls\!release\squeakgrenade.obj"
"\Xash3D\src_main\temp\dlls\!release\subs.obj"
"\Xash3D\src_main\temp\dlls\!release\talkmonster.obj"
"\Xash3D\src_main\temp\dlls\!release\teamplay_gamerules.obj"
"\Xash3D\src_main\temp\dlls\!release\tempmonster.obj"
"\Xash3D\src_main\temp\dlls\!release\tentacle.obj"
"\Xash3D\src_main\temp\dlls\!release\triggers.obj"
"\Xash3D\src_main\temp\dlls\!release\tripmine.obj"
"\Xash3D\src_main\temp\dlls\!release\turret.obj"
"\Xash3D\src_main\temp\dlls\!release\util.obj"
"\Xash3D\src_main\temp\dlls\!release\voice_gamemgr.obj"
"\Xash3D\src_main\temp\dlls\!release\weapons.obj"
"\Xash3D\src_main\temp\dlls\!release\world.obj"
"\Xash3D\src_main\temp\dlls\!release\xen.obj"
"\Xash3D\src_main\temp\dlls\!release\zombie.obj"
]
Creating command line "link.exe @"C:\DOCUME~1\ÌÈØÀ~1.E0B\LOCALS~1\Temp\RSP1049.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ~1.E0B\LOCALS~1\Temp\RSP104A.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\dlls\!release\hl.dll "D:\Xash3D\valve\dlls\hl.dll"
]
Creating command line ""C:\DOCUME~1\ÌÈØÀ~1.E0B\LOCALS~1\Temp\RSP104A.bat""
Compiling...
client.cpp
Linking...
Creating library ..\temp\dlls\!release/hl.lib and object ..\temp\dlls\!release/hl.exp
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\dlls\!release\hl.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
<h3>Results</h3>
hl.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -855,7 +855,7 @@ qboolean CL_GetComment( const char *demoname, char *comment )
// split comment to sections
Q_strncpy( comment, demohdr.mapname, CS_SIZE );
Q_strncpy( comment + CS_SIZE, "<No Title>", CS_SIZE ); // FIXME: write titles or somewhat
Q_strncpy( comment + CS_SIZE, "<No Title>", CS_SIZE ); // TODO: write titles or somewhat
Q_strncpy( comment + CS_SIZE * 2, va( "%g sec", playtime ), CS_TIME );
// all done

View File

@ -2662,7 +2662,7 @@ const model_t *pfnPrecacheSprite( HSPRITE hSprite )
=============
pfnEnableTexSort
FIXME: implement
TODO: implement
=============
*/
void pfnEnableTexSort( int enable )
@ -2673,7 +2673,7 @@ void pfnEnableTexSort( int enable )
=============
pfnSetLightmapColor
FIXME: implement
TODO: implement
=============
*/
void pfnSetLightmapColor( float red, float green, float blue )
@ -2684,7 +2684,7 @@ void pfnSetLightmapColor( float red, float green, float blue )
=============
pfnSetLightmapScale
FIXME: implement
TODO: implement
=============
*/
void pfnSetLightmapScale( float scale )
@ -2708,7 +2708,7 @@ void pfnSPR_DrawGeneric( int frame, int x, int y, const wrect_t *prc, int blends
=============
pfnDrawLocalizedHudString
FIXME: implement
TODO: implement
=============
*/
int pfnDrawLocalizedHudString( int x, int y, const char* str, int r, int g, int b )
@ -2720,7 +2720,7 @@ int pfnDrawLocalizedHudString( int x, int y, const char* str, int r, int g, int
=============
pfnDrawLocalizedConsoleString
FIXME: implement
TODO: implement
=============
*/
int pfnDrawLocalizedConsoleString( int x, int y, const char* str )
@ -2743,7 +2743,7 @@ const char *LocalPlayerInfo_ValueForKey( const char* key )
=============
pfnDrawText
FIXME: implement
TODO: implement
=============
*/
void pfnDrawText( int x, int y, const char* text, unsigned long font )
@ -2754,7 +2754,7 @@ void pfnDrawText( int x, int y, const char* text, unsigned long font )
=============
pfnDrawUnicodeCharacter
FIXME: implement
TODO: implement
=============
*/
int pfnDrawUnicodeCharacter( int x, int y, short number, int r, int g, int b, unsigned long hfont )
@ -3302,7 +3302,7 @@ void NetAPI_SendRequest( int context, int request, int flags, double timeout, ne
if( request == NETAPI_REQUEST_SERVERLIST )
{
// FIXME: build request for master-server
// UNDONE: build request for master-server
}
else
{

View File

@ -880,7 +880,7 @@ static void R_EndGL( void )
R_CheckFog
check for underwater fog
UNDONE: this code is wrong, we need to compute fog volumes (as water volumes)
FIXME: this code is wrong, we need to compute fog volumes (as water volumes)
and get fog params from texture water on a surface.
=============
*/

View File

@ -1,363 +0,0 @@
/*
img_quant.c - image quantizer. based on hl2 beta original code
Copyright (C) 2011 Uncle Mike
This program 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 3 of the License, or
(at your option) any later version.
This program 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.
*/
#include "imagelib.h"
#define MAX_PAL_SIZE 256
#define MAX_NUM_NODES ( MAX_PAL_SIZE * 8 + 1 )
typedef struct quantnode_s
{
qboolean isLeaf;
int timesUsed;
vec3_t cumulativeColor;
int paletteIndex;
struct quantnode_s *children[8];
struct quantnode_s *parent;
struct quantnode_s *next; // next in the priority list for this level of the tree.
// also next for the free list.
} quantnode_t;
static quantnode_t nodePool[MAX_NUM_NODES];
static int nextFreeID;
static quantnode_t *freeList;
static quantnode_t *root;
static int numColorsUsed;
static int desiredNumColors;
static byte insertColor[3];
static int currNumPalIndices;
static byte *pal;
static int debugNumNodes = 0;
static quantnode_t *priorityQueues[9]; // not prioritized for now.
static quantnode_t *AllocNode()
{
quantnode_t *node;
debugNumNodes++;
if( nextFreeID < MAX_NUM_NODES )
{
node = &nodePool[nextFreeID];
nextFreeID++;
}
else
{
node = freeList;
if( !node )
{
ASSERT( node );
return NULL;
}
freeList = freeList->next;
}
Q_memset( node, 0, sizeof( quantnode_t ));
return node;
}
static void FreeNode( quantnode_t *node )
{
debugNumNodes--;
node->next = freeList;
freeList = node;
}
static void InitNodeAllocation( void )
{
freeList = NULL;
nextFreeID = 0;
}
static void RemoveFromPriorityQueue( int level, quantnode_t *node )
{
quantnode_t *searchNode, *prev;
quantnode_t dummy;
dummy.next = priorityQueues[level];
prev = &dummy;
for( searchNode = dummy.next; searchNode; searchNode = searchNode->next )
{
if( searchNode == node )
{
prev->next = node->next;
FreeNode( node );
priorityQueues[level] = dummy.next;
return;
}
prev = searchNode;
}
ASSERT( 0 );
}
static void ReduceNode( quantnode_t *node, int nodeLevel )
{
int childNum;
if( node->timesUsed == 0 )
{
numColorsUsed++;
}
for( childNum = 0; childNum < 8; childNum++ )
{
quantnode_t *child;
child = node->children[childNum];
if( child )
{
node->cumulativeColor[0] += child->cumulativeColor[0];
node->cumulativeColor[1] += child->cumulativeColor[1];
node->cumulativeColor[2] += child->cumulativeColor[2];
node->timesUsed += child->timesUsed;
RemoveFromPriorityQueue( nodeLevel + 1, child );
numColorsUsed--;
node->children[childNum] = NULL;
}
}
if( !node->isLeaf )
{
node->next = priorityQueues[nodeLevel];
priorityQueues[nodeLevel] = node;
}
node->isLeaf = true;
}
static void ReduceTree( void )
{
int i;
for( i = 8; i > 0; i-- )
{
if( priorityQueues[i] )
{
ReduceNode( priorityQueues[i]->parent, i - 1 );
return;
}
}
ASSERT( 0 );
}
static void AddToNode( quantnode_t *node, int depth, byte *color )
{
node->timesUsed++;
node->cumulativeColor[0] += ( 1.0f / 255.0f ) * color[0];
node->cumulativeColor[1] += ( 1.0f / 255.0f ) * color[1];
node->cumulativeColor[2] += ( 1.0f / 255.0f ) * color[2];
node->isLeaf = true;
// insert into priority queue if not already there.
if( node->timesUsed == 1 )
{
node->next = priorityQueues[depth];
priorityQueues[depth] = node;
numColorsUsed++;
}
}
static void Insert( quantnode_t *node, quantnode_t *parent, int depth, uint r, uint g, uint b )
{
int childNum;
if( depth == 8 || node->isLeaf )
{
if( numColorsUsed < desiredNumColors )
{
// just add it and go since we have pal entries to use.
AddToNode( node, depth, insertColor );
}
else
{
// make space and try again.
while( numColorsUsed >= desiredNumColors )
{
ReduceTree();
}
Insert( root, NULL, 0, insertColor[0], insertColor[1], insertColor[2] );
}
return;
}
// figure out which child to go to.
childNum = (( r & ( 1 << 7 )) >> 5 ) | (( g & ( 1 << 7 )) >> 6 ) | (( b & ( 1 << 7 )) >> 7 );
ASSERT( childNum >= 0 && childNum < 8 );
// does the child already exist?
if( !node->children[childNum] )
{
// before allocating anything new, make sure we have
// space for something new and start over
if( numColorsUsed >= desiredNumColors )
{
do
{
ReduceTree();
} while( numColorsUsed >= desiredNumColors );
Insert( root, NULL, 0, insertColor[0], insertColor[1], insertColor[2] );
return;
}
node->children[childNum] = AllocNode();
node->children[childNum]->parent = node;
}
Insert( node->children[childNum], node, depth + 1, ( r << 1 ) & 0xff, ( g << 1 ) & 0xff, ( b << 1 ) & 0xff );
}
void Quantize( byte *image, int numPixels, int bytesPerPixel, int numPalEntries, byte *palette )
{
int i;
pal = palette;
desiredNumColors = numPalEntries;
root = AllocNode();
ASSERT( root );
numColorsUsed = 0;
desiredNumColors = numPalEntries;
for( i = 0; i < 9; i++ )
{
priorityQueues[i] = NULL;
}
for( i = 0; i < numPixels; i++ )
{
Q_memcpy( insertColor, &image[i*bytesPerPixel], 3 );
Insert( root, NULL, 0, (uint)insertColor[0], (uint)insertColor[1], (uint)insertColor[2] );
}
}
static void AverageColorsAndBuildPalette( quantnode_t *node )
{
vec3_t fColor;
float ooTimesUsed;
int i;
if( !node ) return;
if( node->isLeaf )
{
ooTimesUsed = 1.0f / node->timesUsed;
for( i = 0; i < 3; i++ )
{
fColor[i] = node->cumulativeColor[i] * ooTimesUsed;
if( fColor[i] > 1.0f ) fColor[i] = 1.0f;
pal[currNumPalIndices*3+i] = (byte)( fColor[i] * 255 );
}
node->paletteIndex = currNumPalIndices;
currNumPalIndices++;
return;
}
for( i = 0; i < 8; i++ )
{
AverageColorsAndBuildPalette( node->children[i] );
}
}
static void RemapPixel( quantnode_t *node, int depth, int pixel, uint r, uint g, uint b )
{
int childNum;
if( !node ) return;
if( node->isLeaf )
{
image.tempbuffer[pixel] = node->paletteIndex;
return;
}
// figure out which child to go to.
childNum = (( r & ( 1 << 7 )) >> 5 ) | (( g & ( 1 << 7 )) >> 6 ) | (( b & ( 1 << 7 )) >> 7 );
ASSERT( childNum >= 0 && childNum < 8 );
RemapPixel( node->children[childNum], depth + 1, pixel, ( r << 1 ) & 0xff, ( g << 1 ) & 0xff, ( b << 1 ) & 0xff );
}
static void MapImageToPalette( byte *in, int numPixels, int bpp )
{
int i;
for( i = 0; i < numPixels; i++ )
{
RemapPixel( root, 0, i, (uint)in[i*bpp+0], (uint)in[i*bpp+1], (uint)in[i*bpp+2] );
}
}
// returns the actual number of palette entries.
rgbdata_t *Image_Quantize( rgbdata_t *pic )
{
byte palette[768];
int bpp;
// quick case to reject unneeded conversions
if( pic->type == PF_INDEXED_24 || pic->type == PF_INDEXED_32 )
return pic;
// get image description
switch( pic->type )
{
case PF_RGB_24:
case PF_BGR_24:
bpp = 3;
break;
case PF_RGBA_32:
case PF_BGRA_32:
bpp = 4;
break;
default:
MsgDev( D_ERROR, "Image_Quantize: unsupported image type %s\n", PFDesc[pic->type].name );
return pic;
}
Image_CopyParms( pic );
image.size = image.width * image.height;
image.palette = palette;
image.ptr = 0;
// allocate 8-bit buffer
image.tempbuffer = Mem_Realloc( host.imagepool, image.tempbuffer, image.size );
InitNodeAllocation();
Quantize( pic->buffer, image.size, bpp, 256, palette );
currNumPalIndices = 0;
AverageColorsAndBuildPalette( root );
MapImageToPalette( pic->buffer, image.size, bpp );
pic->buffer = Mem_Realloc( host.imagepool, pic->buffer, image.size );
Q_memcpy( pic->buffer, image.tempbuffer, image.size );
pic->palette = Mem_Alloc( host.imagepool, sizeof( palette ));
Q_memcpy( pic->palette, palette, sizeof( palette ));
pic->type = PF_INDEXED_24;
pic->size = image.size;
image.palette = NULL;
return pic;
}

View File

@ -1,363 +0,0 @@
/*
img_quant.c - image quantizer. based on hl2 beta original code
Copyright (C) 2011 Uncle Mike
This program 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 3 of the License, or
(at your option) any later version.
This program 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.
*/
#include "imagelib.h"
#define MAX_PAL_SIZE 256
#define MAX_NUM_NODES ( MAX_PAL_SIZE * 8 + 1 )
typedef struct quantnode_s
{
qboolean isLeaf;
int timesUsed;
vec3_t cumulativeColor;
int paletteIndex;
struct quantnode_s *children[8];
struct quantnode_s *parent;
struct quantnode_s *next; // next in the priority list for this level of the tree.
// also next for the free list.
} quantnode_t;
static quantnode_t nodePool[MAX_NUM_NODES];
static int nextFreeID;
static quantnode_t *freeList;
static quantnode_t *root;
static int numColorsUsed;
static int desiredNumColors;
static byte insertColor[3];
static int currNumPalIndices;
static byte *pal;
static int debugNumNodes = 0;
static quantnode_t *priorityQueues[9]; // not prioritized for now.
static quantnode_t *AllocNode()
{
quantnode_t *node;
debugNumNodes++;
if( nextFreeID < MAX_NUM_NODES )
{
node = &nodePool[nextFreeID];
nextFreeID++;
}
else
{
node = freeList;
if( !node )
{
ASSERT( node );
return NULL;
}
freeList = freeList->next;
}
Q_memset( node, 0, sizeof( quantnode_t ));
return node;
}
static void FreeNode( quantnode_t *node )
{
debugNumNodes--;
node->next = freeList;
freeList = node;
}
static void InitNodeAllocation( void )
{
freeList = NULL;
nextFreeID = 0;
}
static void RemoveFromPriorityQueue( int level, quantnode_t *node )
{
quantnode_t *searchNode, *prev;
quantnode_t dummy;
dummy.next = priorityQueues[level];
prev = &dummy;
for( searchNode = dummy.next; searchNode; searchNode = searchNode->next )
{
if( searchNode == node )
{
prev->next = node->next;
FreeNode( node );
priorityQueues[level] = dummy.next;
return;
}
prev = searchNode;
}
ASSERT( 0 );
}
static void ReduceNode( quantnode_t *node, int nodeLevel )
{
int childNum;
if( node->timesUsed == 0 )
{
numColorsUsed++;
}
for( childNum = 0; childNum < 8; childNum++ )
{
quantnode_t *child;
child = node->children[childNum];
if( child )
{
node->cumulativeColor[0] += child->cumulativeColor[0];
node->cumulativeColor[1] += child->cumulativeColor[1];
node->cumulativeColor[2] += child->cumulativeColor[2];
node->timesUsed += child->timesUsed;
RemoveFromPriorityQueue( nodeLevel + 1, child );
numColorsUsed--;
node->children[childNum] = NULL;
}
}
if( !node->isLeaf )
{
node->next = priorityQueues[nodeLevel];
priorityQueues[nodeLevel] = node;
}
node->isLeaf = true;
}
static void ReduceTree( void )
{
int i;
for( i = 8; i > 0; i-- )
{
if( priorityQueues[i] )
{
ReduceNode( priorityQueues[i]->parent, i - 1 );
return;
}
}
ASSERT( 0 );
}
static void AddToNode( quantnode_t *node, int depth, byte *color )
{
node->timesUsed++;
node->cumulativeColor[0] += ( 1.0f / 255.0f ) * color[0];
node->cumulativeColor[1] += ( 1.0f / 255.0f ) * color[1];
node->cumulativeColor[2] += ( 1.0f / 255.0f ) * color[2];
node->isLeaf = true;
// insert into priority queue if not already there.
if( node->timesUsed == 1 )
{
node->next = priorityQueues[depth];
priorityQueues[depth] = node;
numColorsUsed++;
}
}
static void Insert( quantnode_t *node, quantnode_t *parent, int depth, uint r, uint g, uint b )
{
int childNum;
if( depth == 8 || node->isLeaf )
{
if( numColorsUsed < desiredNumColors )
{
// just add it and go since we have pal entries to use.
AddToNode( node, depth, insertColor );
}
else
{
// make space and try again.
while( numColorsUsed >= desiredNumColors )
{
ReduceTree();
}
Insert( root, NULL, 0, insertColor[0], insertColor[1], insertColor[2] );
}
return;
}
// figure out which child to go to.
childNum = (( r & ( 1 << 7 )) >> 5 ) | (( g & ( 1 << 7 )) >> 6 ) | (( b & ( 1 << 7 )) >> 7 );
ASSERT( childNum >= 0 && childNum < 8 );
// does the child already exist?
if( !node->children[childNum] )
{
// before allocating anything new, make sure we have
// space for something new and start over
if( numColorsUsed >= desiredNumColors )
{
do
{
ReduceTree();
} while( numColorsUsed >= desiredNumColors );
Insert( root, NULL, 0, insertColor[0], insertColor[1], insertColor[2] );
return;
}
node->children[childNum] = AllocNode();
node->children[childNum]->parent = node;
}
Insert( node->children[childNum], node, depth + 1, ( r << 1 ) & 0xff, ( g << 1 ) & 0xff, ( b << 1 ) & 0xff );
}
void Quantize( byte *image, int numPixels, int bytesPerPixel, int numPalEntries, byte *palette )
{
int i;
pal = palette;
desiredNumColors = numPalEntries;
root = AllocNode();
ASSERT( root );
numColorsUsed = 0;
desiredNumColors = numPalEntries;
for( i = 0; i < 9; i++ )
{
priorityQueues[i] = NULL;
}
for( i = 0; i < numPixels; i++ )
{
Q_memcpy( insertColor, &image[i*bytesPerPixel], 3 );
Insert( root, NULL, 0, (uint)insertColor[0], (uint)insertColor[1], (uint)insertColor[2] );
}
}
static void AverageColorsAndBuildPalette( quantnode_t *node )
{
vec3_t fColor;
float ooTimesUsed;
int i;
if( !node ) return;
if( node->isLeaf )
{
ooTimesUsed = 1.0f / node->timesUsed;
for( i = 0; i < 3; i++ )
{
fColor[i] = node->cumulativeColor[i] * ooTimesUsed;
if( fColor[i] > 1.0f ) fColor[i] = 1.0f;
pal[currNumPalIndices*3+i] = (byte)( fColor[i] * 255 );
}
node->paletteIndex = currNumPalIndices;
currNumPalIndices++;
return;
}
for( i = 0; i < 8; i++ )
{
AverageColorsAndBuildPalette( node->children[i] );
}
}
static void RemapPixel( quantnode_t *node, int depth, int pixel, uint r, uint g, uint b )
{
int childNum;
if( !node ) return;
if( node->isLeaf )
{
image.tempbuffer[pixel] = node->paletteIndex;
return;
}
// figure out which child to go to.
childNum = (( r & ( 1 << 7 )) >> 5 ) | (( g & ( 1 << 7 )) >> 6 ) | (( b & ( 1 << 7 )) >> 7 );
ASSERT( childNum >= 0 && childNum < 8 );
RemapPixel( node->children[childNum], depth + 1, pixel, ( r << 1 ) & 0xff, ( g << 1 ) & 0xff, ( b << 1 ) & 0xff );
}
static void MapImageToPalette( byte *in, int numPixels, int bpp )
{
int i;
for( i = 0; i < numPixels; i++ )
{
RemapPixel( root, 0, i, (uint)in[i*bpp+0], (uint)in[i*bpp+1], (uint)in[i*bpp+2] );
}
}
// returns the actual number of palette entries.
rgbdata_t *Image_Quantize( rgbdata_t *pic )
{
byte palette[768];
int bpp;
// quick case to reject unneeded conversions
if( pic->type == PF_INDEXED_24 || pic->type == PF_INDEXED_32 )
return pic;
// get image description
switch( pic->type )
{
case PF_RGB_24:
case PF_BGR_24:
bpp = 3;
break;
case PF_RGBA_32:
case PF_BGRA_32:
bpp = 4;
break;
default:
MsgDev( D_ERROR, "Image_Quantize: unsupported image type %s\n", PFDesc[pic->type].name );
return pic;
}
Image_CopyParms( pic );
image.size = image.width * image.height;
image.palette = palette;
image.ptr = 0;
// allocate 8-bit buffer
image.tempbuffer = Mem_Realloc( host.imagepool, image.tempbuffer, image.size );
InitNodeAllocation();
Quantize( pic->buffer, image.size, bpp, 256, palette );
currNumPalIndices = 0;
AverageColorsAndBuildPalette( root );
MapImageToPalette( pic->buffer, image.size, bpp );
pic->buffer = Mem_Realloc( host.imagepool, pic->buffer, image.size );
Q_memcpy( pic->buffer, image.tempbuffer, image.size );
pic->palette = Mem_Alloc( host.imagepool, sizeof( palette ));
Q_memcpy( pic->palette, palette, sizeof( palette ));
pic->type = PF_INDEXED_24;
pic->size = image.size;
image.palette = NULL;
return pic;
}

View File

@ -64,6 +64,9 @@ typedef struct
msurface_t **draw_surfaces; // used for sorting translucent surfaces
int max_surfaces; // max surfaces per submodel (for all models)
size_t visdatasize; // actual size of the visdata
size_t litdatasize; // actual size of the lightdata
size_t entdatasize; // actual size of the entity string
size_t texdatasize; // actual size of the textures lump
qboolean loading; // true if worldmodel is loading
qboolean sky_sphere; // true when quake sky-sphere is used
qboolean has_mirrors; // one or more brush models contain reflective textures
@ -84,6 +87,7 @@ extern convar_t *mod_studiocache;
void Mod_Init( void );
void Mod_ClearAll( void );
void Mod_Shutdown( void );
void Mod_PrintBSPFileSizes( void );
void Mod_SetupHulls( float mins[4][3], float maxs[4][3] );
void Mod_GetBounds( int handle, vec3_t mins, vec3_t maxs );
void Mod_GetFrames( int handle, int *numFrames );

View File

@ -68,6 +68,92 @@ static vec3_t cm_hullmaxs[4] =
===============================================================================
*/
/*
================
Mod_SetupHulls
================
*/
int Mod_ArrayUsage( const char *szItem, int items, int maxitems, int itemsize )
{
float percentage = maxitems ? (items * 100.0f / maxitems) : 0.0f;
Msg( "%-12s %7i/%-7i %7i/%-7i (%4.1f%%)", szItem, items, maxitems, items * itemsize, maxitems * itemsize, percentage );
if( percentage > 99.9f )
Msg( "^1SIZE OVERFLOW!!!^7\n" );
else if( percentage > 95.0f )
Msg( "^3SIZE DANGER!^7\n" );
else if( percentage > 80.0f )
Msg( "^2VERY FULL!^7\n" );
else Msg( "\n" );
return items * itemsize;
}
/*
================
Mod_SetupHulls
================
*/
int Mod_GlobUsage( const char *szItem, int itemstorage, int maxstorage )
{
float percentage = maxstorage ? (itemstorage * 100.0f / maxstorage) : 0.0f;
Msg( "%-12s [variable] %7i/%-7i (%4.1f%%)", szItem, itemstorage, maxstorage, percentage );
if( percentage > 99.9f )
Msg( "^1SIZE OVERFLOW!!!^7\n" );
else if( percentage > 95.0f )
Msg( "^3SIZE DANGER!^7\n" );
else if( percentage > 80.0f )
Msg( "^2VERY FULL!^7\n" );
else Msg( "\n" );
return itemstorage;
}
/*
=============
Mod_PrintBSPFileSizes
Dumps info about current file
=============
*/
void Mod_PrintBSPFileSizes( void )
{
int totalmemory = 0;
model_t *w = worldmodel;
if( !w || !w->numsubmodels )
{
Msg( "No map loaded\n" );
return;
}
Msg( "\n" );
Msg( "Object names Objects/Maxobjs Memory / Maxmem Fullness\n" );
Msg( "------------ --------------- --------------- --------\n" );
totalmemory += Mod_ArrayUsage( "models", w->numsubmodels, MAX_MAP_MODELS, sizeof( dmodel_t ));
totalmemory += Mod_ArrayUsage( "planes", w->numplanes, MAX_MAP_PLANES, sizeof( dplane_t ));
totalmemory += Mod_ArrayUsage( "vertexes", w->numvertexes, MAX_MAP_VERTS, sizeof( dvertex_t ));
totalmemory += Mod_ArrayUsage( "nodes", w->numnodes, MAX_MAP_NODES, sizeof( dnode_t ));
totalmemory += Mod_ArrayUsage( "texinfos", w->numtexinfo, MAX_MAP_TEXINFO, sizeof( dtexinfo_t ));
totalmemory += Mod_ArrayUsage( "faces", w->numsurfaces, MAX_MAP_FACES, sizeof( dface_t ));
totalmemory += Mod_ArrayUsage( "clipnodes", w->numclipnodes, MAX_MAP_CLIPNODES, sizeof( dclipnode_t ));
totalmemory += Mod_ArrayUsage( "leaves", w->numleafs, MAX_MAP_LEAFS, sizeof( dleaf_t ));
totalmemory += Mod_ArrayUsage( "marksurfaces", w->nummarksurfaces, MAX_MAP_MARKSURFACES, sizeof( dmarkface_t ));
totalmemory += Mod_ArrayUsage( "surfedges", w->numsurfedges, MAX_MAP_SURFEDGES, sizeof( dsurfedge_t ));
totalmemory += Mod_ArrayUsage( "edges", w->numedges, MAX_MAP_EDGES, sizeof( dedge_t ));
totalmemory += Mod_GlobUsage( "texdata", world.texdatasize, MAX_MAP_MIPTEX );
totalmemory += Mod_GlobUsage( "lightdata", world.litdatasize, MAX_MAP_LIGHTING );
totalmemory += Mod_GlobUsage( "visdata", world.visdatasize, MAX_MAP_VISIBILITY );
totalmemory += Mod_GlobUsage( "entdata", world.entdatasize, MAX_MAP_ENTSTRING );
Msg( "=== Total BSP file data space used: %s ===\n", Q_memprint( totalmemory ));
}
/*
================
Mod_SetupHulls
@ -398,6 +484,8 @@ void Mod_Init( void )
mod_allow_materials = Cvar_Get( "host_allow_materials", "0", CVAR_LATCH|CVAR_ARCHIVE, "allow HD textures" );
else mod_allow_materials = NULL; // no reason to load HD-textures for dedicated server
Cmd_AddCommand( "mapstats", Mod_PrintBSPFileSizes, "show stats for currently loaded map" );
Mod_InitStudioHull ();
}
@ -504,6 +592,7 @@ static void Mod_LoadTextures( const dlump_t *l )
GL_FreeTexture( tr.solidskyTexture );
GL_FreeTexture( tr.alphaskyTexture );
tr.solidskyTexture = tr.alphaskyTexture = 0;
world.texdatasize = l->filelen;
world.has_mirrors = false;
world.sky_sphere = false;
}
@ -931,8 +1020,18 @@ static void Mod_LoadLighting( const dlump_t *l )
color24 *out;
int i;
if( !l->filelen ) return;
if( !l->filelen )
{
if( world.loading )
{
MsgDev( D_WARN, "map ^2%s^7 has no lighting\n", loadmodel->name );
loadmodel->lightdata = NULL;
world.litdatasize = 0;
}
return;
}
in = (void *)(mod_base + l->fileofs);
if( world.loading ) world.litdatasize = l->filelen;
switch( bmodel_version )
{
@ -1987,6 +2086,7 @@ static void Mod_LoadEntities( const dlump_t *l )
in = (void *)(mod_base + l->fileofs);
loadmodel->entities = Mem_Alloc( loadmodel->mempool, l->filelen );
Q_memcpy( loadmodel->entities, mod_base + l->fileofs, l->filelen );
if( world.loading ) world.entdatasize = l->filelen;
}
/*

Binary file not shown.

View File

@ -235,7 +235,7 @@ void SV_UpdateMovevars( qboolean initialize )
svgame.movevars.skydir_z = sv_skydir_z->value;
svgame.movevars.skyangle = sv_skyangle->value;
svgame.movevars.wateralpha = sv_wateralpha->value;
svgame.movevars.features = host.features; // just in case. no really need
svgame.movevars.features = host.features; // just in case. not really need
if( initialize ) return;

View File

@ -30,7 +30,7 @@ half-life implementation of saverestore system
#define SAVEFILE_HEADER (('V'<<24)+('L'<<16)+('A'<<8)+'V') // little-endian "VALV"
#define SAVEGAME_HEADER (('V'<<24)+('A'<<16)+('S'<<8)+'J') // little-endian "JSAV"
#define SAVEGAME_VERSION 0x0065 // Version 0.65
#define CLIENT_SAVEGAME_VERSION 0x0067 // Version 0.66
#define CLIENT_SAVEGAME_VERSION 0x0067 // Version 0.67
#define SAVE_AGED_COUNT 1
#define SAVENAME_LENGTH 128 // matches with MAX_OSPATH

View File

@ -1194,10 +1194,10 @@ static void SV_ClipToLinks( areanode_t *node, moveclip_t *clip )
continue; // don't clip against owner
}
if( touch->v.flags & FL_MONSTER )
SV_ClipMoveToEntity( touch, clip->start, clip->mins2, clip->maxs2, clip->end, &trace );
else if( touch->v.solid == SOLID_CUSTOM )
if( touch->v.solid == SOLID_CUSTOM )
SV_CustomClipMoveToEntity( touch, clip->start, clip->mins, clip->maxs, clip->end, &trace );
else if( touch->v.flags & FL_MONSTER )
SV_ClipMoveToEntity( touch, clip->start, clip->mins2, clip->maxs2, clip->end, &trace );
else SV_ClipMoveToEntity( touch, clip->start, clip->mins, clip->maxs, clip->end, &trace );
clip->trace = World_CombineTraces( &clip->trace, &trace, touch );

View File

@ -267,8 +267,8 @@ void UI_DrawString( int x, int y, int w, int h, const char *string, const int co
ch &= 255;
// fix for letter ¸
if( ch == '¸' ) ch = 'å';
if( ch == '¨' ) ch = 'Å';
if( ch == 0xB8 ) ch = (byte)'å';
if( ch == 0xA8 ) ch = (byte)'Å';
if( ch != ' ' )
{

View File

@ -70,7 +70,7 @@ static void UI_MultiPlayer_Callback( void *self, int event )
UI_InternetGames_Menu();
break;
case ID_SPECTATEGAMES:
// UNDONE: write menus
// UNDONE: not implemented
break;
case ID_LANGAME:
UI_LanGame_Menu();