#include "rSDL.h"
#include "gWall.h"
#include "gStuff.h"
#include "eGrid.h"
#include "eWall.h"
#include "math.h"
#include "gCycle.h"
#include "rTexture.h"
#include "eTimer.h"
#include "gGame.h"
#include "rScreen.h"
#include "rRender.h"
#include "eCamera.h"
#include "tConfiguration.h"
#include "gExplosion.h"
#include "tMath.h"
#include "ePlayer.h"
#include "eTess2.h"
#include "nConfig.h"
#include <fstream>
Go to the source code of this file.
Classes | |
class | gTopologyPoliceConsoleFiler |
Defines | |
#define | CHECKWALL |
#define | gCYCLE_LEN 1.5 |
#define | gBEG_OFFSET .25 |
#define | gBEG_LEN 2 |
#define | SEGLEN 2.5 |
#define | segs 5 |
Functions | |
static void | gWallRim_helper (eCoord p1, eCoord p2, REAL tBeg, REAL tEnd, REAL h, REAL Z_SCALE, bool sw) |
static void | clamp01 (REAL &c) |
void | sg_TopologyPoliceKill (gCycle *cycle) |
void | sg_TopologyPoliceCheck (gCycle *cycle, eWall *oldWall, gPlayerWall *newWall, const eCoord &point, bool split) |
bool | upperlinecolor (REAL r, REAL g, REAL b, REAL a) |
static REAL | hfunc (REAL x) |
static REAL | cfunc (REAL x) |
static REAL | afunc (REAL x) |
static REAL | sfunc (REAL x) |
static REAL | xfunc (REAL x) |
static void | login_callback () |
Variables | |
static bool | sg_bugTransparency |
static bool | sg_bugTransparencyDemand |
static tSettingItem< bool > | sgc_bugTransparency ("BUG_TRANSPARENCY", sg_bugTransparency) |
static tSettingItem< bool > | sgc_bugTransparencyDemand ("BUG_TRANSPARENCY_DEMAND", sg_bugTransparencyDemand) |
static rFileTexture | gWallRim_a (rTextureGroups::TEX_WALL,"moviepack/rim_wall_a.png", 0, 0) |
static rFileTexture | gWallRim_b (rTextureGroups::TEX_WALL,"moviepack/rim_wall_b.png", 0, 0) |
static rFileTexture | gWallRim_c (rTextureGroups::TEX_WALL,"moviepack/rim_wall_c.png", 0, 0) |
static rFileTexture | gWallRim_d (rTextureGroups::TEX_WALL,"moviepack/rim_wall_d.png", 0, 0) |
static rITexture * | gWallRim_mp [4] |
static REAL | sg_RimStretchX = 100 |
static tSettingItem< REAL > | sg_RimStretchXConf ("RIM_WALL_STRETCH_X", sg_RimStretchX) |
static REAL | sg_RimStretchY = 100 |
static tSettingItem< REAL > | sg_RimStretchYConf ("RIM_WALL_STRETCH_Y", sg_RimStretchY) |
static REAL | sg_MPRimStretchX = 50 |
static tSettingItem< REAL > | sg_MPRimStretchXConf ("MOVIEPACK_RIM_WALL_STRETCH_X", sg_MPRimStretchX) |
static REAL | sg_MPRimStretchY = 50 |
static tSettingItem< REAL > | sg_MPRimStretchYConf ("MOVIEPACK_RIM_WALL_STRETCH_Y", sg_MPRimStretchY) |
REAL | lower_height |
REAL | upper_height |
static REAL | sg_arenaWallShadowSize = 0.1 |
static tSettingItem< REAL > | sg_arenaWallShadowSizeConf ("ARENA_WALL_SHADOW_SIZE", sg_arenaWallShadowSize) |
static REAL | sg_arenaWallShadowSideDist = 10.0 |
static tSettingItem< REAL > | sg_arenaWallShadowSideDistConf ("ARENA_WALL_SHADOW_SIDEDIST", sg_arenaWallShadowSideDist) |
static REAL | sg_arenaWallShadowNear = 1.0 |
static tSettingItem< REAL > | sg_arenaWallShadowNearConf ("ARENA_WALL_SHADOW_NEAR", sg_arenaWallShadowNear) |
static REAL | sg_arenaWallShadowDist = 100.0 |
static tSettingItem< REAL > | sg_arenaWallShadowDistConf ("ARENA_WALL_SHADOW_DIST", sg_arenaWallShadowDist) |
static short | sg_topologyPolice = false |
static tSettingItem< short > | sg_topologyPoliceCofig ("TOPOLOGY_POLICE", sg_topologyPolice) |
static short | sg_topologyPoliceParallel = true |
static tSettingItem< short > | sg_topologyPoliceParallelCofig ("TOPOLOGY_POLICE_PARALLEL", sg_topologyPoliceParallel) |
bool | sg_gnuplotDebug |
tList< gNetPlayerWall > | sg_netPlayerWalls |
tList< gNetPlayerWall > | sg_netPlayerWallsGridded |
static bool | sg_ServerSentHoles = false |
static nNOInitialisator < gNetPlayerWall > | gNetPlayerWall_init (300,"gNetPlayerWall") |
static nCallbackLoginLogout sg_LoginLogout & | login_callback |
#define CHECKWALL |
Definition at line 552 of file gWall.cpp.
Referenced by gNetPlayerWall::Alpha(), gPlayerWall::Alpha(), gNetPlayerWall::BegPos(), gPlayerWall::BegPos(), gNetPlayerWall::BegTime(), gPlayerWall::BegTime(), gNetPlayerWall::BlowHole(), gPlayerWall::BlowHole(), gNetPlayerWall::Checkpoint(), gPlayerWall::Deletable(), gNetPlayerWall::EndPos(), gPlayerWall::EndPos(), gNetPlayerWall::EndTime(), gPlayerWall::EndTime(), gPlayerWall::Flip(), gPlayerWall::GlobalToLocal(), gPlayerWall::gPlayerWall(), gNetPlayerWall::Holer(), gPlayerWall::Holer(), gNetPlayerWall::IndexAlpha(), gNetPlayerWall::IndexPos(), gPlayerWall::Insert(), gNetPlayerWall::IsDangerous(), gPlayerWall::IsDangerous(), gNetPlayerWall::IsDangerousAnywhere(), gPlayerWall::IsDangerousAnywhere(), gNetPlayerWall::IsDangerousApartFromHoles(), gPlayerWall::LocalToGlobal(), gNetPlayerWall::Pos(), gPlayerWall::Pos(), gNetPlayerWall::SetEndPos(), gNetPlayerWall::SetEndTime(), gPlayerWall::Split(), gNetPlayerWall::Time(), gNetPlayerWall::Update(), and gPlayerWall::~gPlayerWall().
#define gBEG_LEN 2 |
#define gCYCLE_LEN 1.5 |
#define SEGLEN 2.5 |
Referenced by gNetPlayerWall::RenderList().
#define segs 5 |
Referenced by gNetPlayerWall::RenderBegin().
Definition at line 1132 of file gWall.cpp.
Referenced by gNetPlayerWall::RenderBegin().
Definition at line 1130 of file gWall.cpp.
Referenced by gNetPlayerWall::RenderBegin().
static void clamp01 | ( | REAL & | c | ) | [static] |
static void gWallRim_helper | ( | eCoord | p1, | |
eCoord | p2, | |||
REAL | tBeg, | |||
REAL | tEnd, | |||
REAL | h, | |||
REAL | Z_SCALE, | |||
bool | sw | |||
) | [static] |
Definition at line 164 of file gWall.cpp.
References BeginQuads(), rDisplayList::IsRecording(), lower_height, REAL, rITexture::Select(), sg_MoviePack(), sr_infinityPlane, sr_lowerSky, sr_upperSky, Swap(), TexCoord(), TexVertex(), upper_height, and Vertex().
Referenced by gWallRim::RenderReal().
00165 { 00166 00167 // draw additional upper line 00168 /* 00169 sr_DepthOffset(true); 00170 glPolygonOffset(-100,10000000); 00171 glDisable(GL_TEXTURE_2D); 00172 BeginLines(); 00173 Color(1,1,1); 00174 Vertex(p1.x,p1.y,1); 00175 Vertex(p2.x,p2.y,1); 00176 RenderEnd(); 00177 sr_DepthOffset(false); 00178 glDisable(GL_POLYGON_OFFSET_LINE); 00179 glEnable(GL_TEXTURE_2D); 00180 */ 00181 00182 if (sg_MoviePack()){ 00183 int t=int(floor((tBeg+tEnd)/2)); 00184 tBeg-=t; 00185 tEnd-=t; 00186 t=t%4; 00187 while (t<0) 00188 t+=4; 00189 gWallRim_mp[t]->Select(); 00190 } 00191 00192 if (sw){ 00193 Swap(p1,p2); 00194 Swap(tBeg,tEnd); 00195 } 00196 00197 00198 if (h>9000){ 00199 if (sr_lowerSky || sg_MoviePack()) h=lower_height; 00200 if (sr_upperSky && !sg_MoviePack()) h=upper_height; 00201 } 00202 00203 BeginQuads(); 00204 00205 // NOTE: display lists on nvidia cards don't like infinite points 00206 if (h<9000 || !sr_infinityPlane || rDisplayList::IsRecording() ){ 00207 TexVertex(p1.x, p1.y, 0, 00208 tBeg , 1); 00209 00210 TexVertex(p1.x, p1.y, h, 00211 tBeg, 1-h/Z_SCALE); 00212 00213 TexVertex(p2.x, p2.y, h, 00214 tEnd, 1-h/Z_SCALE); 00215 00216 TexVertex(p2.x, p2.y, 0, 00217 tEnd , 1); 00218 } 00219 00220 else{ 00221 TexVertex(p1.x, p1.y, 0, 00222 tBeg, 1); 00223 00224 TexCoord(0,-1/REAL(Z_SCALE),0,0); 00225 00226 #ifndef WIN32 00227 Vertex(0,0,1,0); 00228 Vertex(0,0,1,0); 00229 #else 00230 Vertex(0.001f,0.001f,1,0); // Windows OpenGL has problems with 00231 // infitite points perpenticular to the viewing direction 00232 Vertex(0.001f,0.001f,1,0); 00233 #endif 00234 00235 TexVertex(p2.x, p2.y, 0, 00236 tEnd, 1); 00237 }
Definition at line 1128 of file gWall.cpp.
Referenced by gNetPlayerWall::RenderBegin().
static void login_callback | ( | ) | [static] |
Definition at line 1133 of file gWall.cpp.
Referenced by gNetPlayerWall::RenderBegin().
void sg_TopologyPoliceCheck | ( | gCycle * | cycle, | |
eWall * | oldWall, | |||
gPlayerWall * | newWall, | |||
const eCoord & | point, | |||
bool | split | |||
) |
Definition at line 639 of file gWall.cpp.
References clamp01(), eWall::Edge(), filter(), ePlayerNetID::GetUserName(), gPlayerWall::IsDangerous(), gCycle::KillAt(), gCycle::PassEdge(), eNetGameObject::Player(), gCycleDeath::pos_, eHalfEdge::Ratio(), REAL, se_GameTime(), sg_gnuplotDebug, sg_topologyPolice, sg_topologyPoliceParallel, and gPlayerWall::Time().
Referenced by gPlayerWall::RunsParallelActive(), and gPlayerWall::SplitByActive().
00641 { 00642 // test if topology police is enabled 00643 if ( !sg_topologyPolice && !sg_gnuplotDebug ) 00644 return; 00645 00646 // locate point on both edges 00647 REAL oldAlpha = oldWall->Edge()->Ratio( point ); 00648 REAL newAlpha = newWall->Edge()->Ratio( point ); 00649 clamp01( newAlpha ); 00650 clamp01( oldAlpha ); 00651 00652 // calculate time of passage 00653 REAL time = newWall->Time( newAlpha ); 00654 00655 // if the old wall does not lie in a hole of the new wall, don't go on. 00656 // this test overestimates the time ( instead of "se_GameTime()", it should 00657 // read just "time" ) to test wheter the wall is dangerous NOW 00658 // to avoid innocent victims. A wall never gets more dangerous with time. 00659 if ( !newWall->IsDangerous( newAlpha, se_GameTime() ) ) 00660 return; 00661 00662 // the same logic for the old wall 00663 gPlayerWall* oldPlayerWall = dynamic_cast< gPlayerWall* >( oldWall ); 00664 if ( oldPlayerWall && !oldPlayerWall->IsDangerous( oldAlpha, se_GameTime() ) ) 00665 return; 00666 00667 // log collision for gnuplot 00668 #ifdef DEBUG 00669 if ( sg_gnuplotDebug ) 00670 { 00671 std::stringstream filename; 00672 if ( cycle && cycle->Player() ) 00673 { 00674 filename << cycle->Player()->GetUserName() << "_"; 00675 } 00676 filename << "topology"; 00677 std::ofstream f( filename.str().c_str(), std::ios::app ); 00678 f << point.x << " " << point.y << "\n"; 00679 } 00680 #endif 00681 00682 // last chance to exit 00683 if ( !sg_topologyPolice || ( !split && !sg_topologyPoliceParallel ) ) 00684 return; 00685 00686 gTopologyPoliceConsoleFiler filter; 00687 00688 // treat the crossing as if the cycle just went through the old wall. 00689 try 00690 { 00691 cycle->PassEdge( oldWall, time, oldAlpha ); 00692 } 00693 catch ( gCycleDeath const & death ) 00694 { 00695 cycle->KillAt( death.pos_ ); 00696 }
void sg_TopologyPoliceKill | ( | gCycle * | cycle | ) |
Definition at line 598 of file gWall.cpp.
References gCycleMovement::Alive(), ePlayerNetID::GetName(), gCycle::Kill(), nCLIENT, eNetGameObject::Player(), gCycle::PrintName(), tOutput::SetTemplateParameter(), sn_ConsoleOut(), and sn_GetNetState().
Referenced by gPlayerWall::RunsParallelActive(), and gPlayerWall::SplitByActive().
00600 { 00601 if ( sn_GetNetState() != nCLIENT && cycle->Alive() ) 00602 { 00603 tOutput message; 00604 tString name; 00605 if ( cycle->Player() ) 00606 name = cycle->Player()->GetName(); 00607 else 00608 cycle->PrintName( name ); 00609 message.SetTemplateParameter(1, name ); 00610 message << "$player_topologypolice"; 00611 sn_ConsoleOut( message ); 00612 00613 cycle->Kill(); 00614 }
Definition at line 1006 of file gWall.cpp.
References rTextureGroups::TEX_WALL, and rTextureGroups::TextureMode.
Referenced by gNetPlayerWall::RenderBegin(), and gNetPlayerWall::RenderNormal().
01007 { 01008 if (rTextureGroups::TextureMode[rTextureGroups::TEX_WALL]<0) 01009 glColor4f(1,1,1,a); 01010 else{ 01011 /* 01012 REAL upperline_alpha=fabs(se_cameraRise*2); 01013 upperline_alpha-=1; 01014 if (upperline_alpha>.5) 01015 upperline_alpha=1; 01016 if (upperline_alpha<=.5) 01017 return false; 01018 glColor4f(r,g,b,upperline_alpha); 01019 */ 01020 //glDisable(GL_TEXTURE); 01021 glColor4f(r,g,b,a); 01022 } 01023 01024 return true;
nNOInitialisator<gNetPlayerWall> gNetPlayerWall_init(300,"gNetPlayerWall") [static] |
Referenced by gNetPlayerWall::CreatorDescriptor().
rFileTexture gWallRim_a(rTextureGroups::TEX_WALL,"moviepack/rim_wall_a.png", 0, 0) [static] |
rFileTexture gWallRim_b(rTextureGroups::TEX_WALL,"moviepack/rim_wall_b.png", 0, 0) [static] |
rFileTexture gWallRim_c(rTextureGroups::TEX_WALL,"moviepack/rim_wall_c.png", 0, 0) [static] |
rFileTexture gWallRim_d(rTextureGroups::TEX_WALL,"moviepack/rim_wall_d.png", 0, 0) [static] |
rITexture* gWallRim_mp[4] [static] |
Initial value:
{&gWallRim_a,&gWallRim_b, &gWallRim_c,&gWallRim_d}
nCallbackLoginLogout sg_LoginLogout& login_callback [static] |
Definition at line 66 of file eDisplay.cpp.
REAL sg_arenaWallShadowDist = 100.0 [static] |
tSettingItem<REAL> sg_arenaWallShadowDistConf("ARENA_WALL_SHADOW_DIST", sg_arenaWallShadowDist) [static] |
REAL sg_arenaWallShadowNear = 1.0 [static] |
tSettingItem<REAL> sg_arenaWallShadowNearConf("ARENA_WALL_SHADOW_NEAR", sg_arenaWallShadowNear) [static] |
REAL sg_arenaWallShadowSideDist = 10.0 [static] |
tSettingItem<REAL> sg_arenaWallShadowSideDistConf("ARENA_WALL_SHADOW_SIDEDIST", sg_arenaWallShadowSideDist) [static] |
REAL sg_arenaWallShadowSize = 0.1 [static] |
tSettingItem<REAL> sg_arenaWallShadowSizeConf("ARENA_WALL_SHADOW_SIZE", sg_arenaWallShadowSize) [static] |
bool sg_bugTransparency [static] |
bool sg_bugTransparencyDemand [static] |
bool sg_gnuplotDebug |
Definition at line 74 of file gCycle.cpp.
Referenced by gCycle::DoTurn(), gCycle::MyInitAfterCreation(), gCycle::OnNotifyNewDestination(), sg_TopologyPoliceCheck(), and gCycle::Timestep().
REAL sg_MPRimStretchX = 50 [static] |
tSettingItem<REAL> sg_MPRimStretchXConf("MOVIEPACK_RIM_WALL_STRETCH_X", sg_MPRimStretchX) [static] |
REAL sg_MPRimStretchY = 50 [static] |
tSettingItem<REAL> sg_MPRimStretchYConf("MOVIEPACK_RIM_WALL_STRETCH_Y", sg_MPRimStretchY) [static] |
Definition at line 1473 of file gWall.cpp.
Referenced by gNetPlayerWall::Clear(), gCycle::Die(), cWidget::Map::DrawMap(), gNetPlayerWall::s_CopyIntoGrid(), and sg_KillFutureWalls().
Definition at line 1474 of file gWall.cpp.
Referenced by gNetPlayerWall::Clear(), cWidget::Map::DrawMap(), and sg_KillFutureWalls().
REAL sg_RimStretchX = 100 [static] |
tSettingItem<REAL> sg_RimStretchXConf("RIM_WALL_STRETCH_X", sg_RimStretchX) [static] |
REAL sg_RimStretchY = 100 [static] |
tSettingItem<REAL> sg_RimStretchYConf("RIM_WALL_STRETCH_Y", sg_RimStretchY) [static] |
bool sg_ServerSentHoles = false [static] |
short sg_topologyPolice = false [static] |
tSettingItem< short > sg_topologyPoliceCofig("TOPOLOGY_POLICE", sg_topologyPolice) [static] |
short sg_topologyPoliceParallel = true [static] |
tSettingItem< short > sg_topologyPoliceParallelCofig("TOPOLOGY_POLICE_PARALLEL", sg_topologyPoliceParallel) [static] |
tSettingItem< bool > sgc_bugTransparency("BUG_TRANSPARENCY", sg_bugTransparency) [static] |
tSettingItem< bool > sgc_bugTransparencyDemand("BUG_TRANSPARENCY_DEMAND", sg_bugTransparencyDemand) [static] |
Definition at line 65 of file eDisplay.cpp.