From 697fbdabf10d956e0f13bfbc9414d3db40f0c535 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Sun, 10 Jun 2012 15:28:12 +0200 Subject: BOOL -> bool; additional fixes in constructors/destructors --- src/graphics/common/blitz.cpp | 40 +++--- src/graphics/common/blitz.h | 12 +- src/graphics/common/camera.cpp | 152 ++++++++++---------- src/graphics/common/camera.h | 56 ++++---- src/graphics/common/cloud.cpp | 38 ++--- src/graphics/common/cloud.h | 16 +-- src/graphics/common/light.cpp | 104 +++++++------- src/graphics/common/light.h | 28 ++-- src/graphics/common/mainmovie.cpp | 22 +-- src/graphics/common/mainmovie.h | 8 +- src/graphics/common/model.cpp | 138 +++++++++--------- src/graphics/common/model.h | 40 +++--- src/graphics/common/particule.cpp | 124 ++++++++-------- src/graphics/common/particule.h | 18 +-- src/graphics/common/planet.cpp | 26 ++-- src/graphics/common/planet.h | 12 +- src/graphics/common/pyro.cpp | 122 ++++++++-------- src/graphics/common/pyro.h | 16 +-- src/graphics/common/terrain.cpp | 290 +++++++++++++++++++------------------- src/graphics/common/terrain.h | 56 ++++---- src/graphics/common/water.cpp | 82 +++++------ src/graphics/common/water.h | 24 ++-- 22 files changed, 712 insertions(+), 712 deletions(-) (limited to 'src/graphics/common') diff --git a/src/graphics/common/blitz.cpp b/src/graphics/common/blitz.cpp index 0447f53..43f4fed 100644 --- a/src/graphics/common/blitz.cpp +++ b/src/graphics/common/blitz.cpp @@ -67,7 +67,7 @@ void CBlitz::Flush() { int i; - m_bBlitzExist = FALSE; + m_bBlitzExist = false; m_time = 0.0f; m_phase = BPH_WAIT; m_speed = 0.0f; @@ -83,18 +83,18 @@ void CBlitz::Flush() // Management of an event -BOOL CBlitz::EventProcess(const Event &event) +bool CBlitz::EventProcess(const Event &event) { if ( event.event == EVENT_FRAME ) { return EventFrame(event); } - return TRUE; + return true; } // Evolved lightning. -BOOL CBlitz::EventFrame(const Event &event) +bool CBlitz::EventFrame(const Event &event) { CObject* pObj; CAutoPara* automat; @@ -103,8 +103,8 @@ BOOL CBlitz::EventFrame(const Event &event) float dist, deep, max; int i; - if ( m_engine->RetPause() ) return TRUE; - if ( m_engine->RetMovieLock() ) return TRUE; + if ( m_engine->RetPause() ) return true; + if ( m_engine->RetMovieLock() ) return true; m_time += event.rTime; m_progress += event.rTime*m_speed; @@ -125,12 +125,12 @@ BOOL CBlitz::EventFrame(const Event &event) pObj = SearchObject(m_pos); if ( pObj == 0 ) { - m_terrain->MoveOnFloor(m_pos, TRUE); + m_terrain->MoveOnFloor(m_pos, true); } else { m_pos = pObj->RetPosition(0); - m_terrain->MoveOnFloor(m_pos, TRUE); + m_terrain->MoveOnFloor(m_pos, true); type = pObj->RetType(); if ( type == OBJECT_BASE ) @@ -203,7 +203,7 @@ BOOL CBlitz::EventFrame(const Event &event) } } - return TRUE; + return true; } @@ -223,7 +223,7 @@ void CBlitz::Draw() if ( m_phase != BPH_BLITZ ) return; device = m_engine->RetD3DDevice(); - device->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE); + device->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false); D3DUtil_SetIdentityMatrix(matrix); device->SetTransform(D3DTRANSFORMSTATE_WORLD, &matrix); @@ -288,15 +288,15 @@ void CBlitz::Draw() p1 = p2; } - device->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE); + device->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true); } // Triggers lightning. -BOOL CBlitz::Create(float sleep, float delay, float magnetic) +bool CBlitz::Create(float sleep, float delay, float magnetic) { - m_bBlitzExist = TRUE; + m_bBlitzExist = true; if ( sleep < 1.0f ) sleep = 1.0f; m_sleep = sleep; m_delay = delay; @@ -321,29 +321,29 @@ BOOL CBlitz::Create(float sleep, float delay, float magnetic) m_sound = (CSound*)m_iMan->SearchInstance(CLASS_SOUND); } - return FALSE; + return false; } // Gives the status of lightning. -BOOL CBlitz::GetStatus(float &sleep, float &delay, float &magnetic, float &progress) +bool CBlitz::GetStatus(float &sleep, float &delay, float &magnetic, float &progress) { - if ( !m_bBlitzExist ) return FALSE; + if ( !m_bBlitzExist ) return false; sleep = m_sleep; delay = m_delay; magnetic = m_magnetic; progress = m_progress; - return TRUE; + return true; } // Specifies the status of lightning. -BOOL CBlitz::SetStatus(float sleep, float delay, float magnetic, float progress) +bool CBlitz::SetStatus(float sleep, float delay, float magnetic, float progress) { - m_bBlitzExist = TRUE; + m_bBlitzExist = true; m_sleep = sleep; m_delay = delay; @@ -352,7 +352,7 @@ BOOL CBlitz::SetStatus(float sleep, float delay, float magnetic, float progress) m_phase = BPH_WAIT; m_speed = 1.0f/m_sleep; - return TRUE; + return true; } diff --git a/src/graphics/common/blitz.h b/src/graphics/common/blitz.h index 2f8aee9..59268b5 100644 --- a/src/graphics/common/blitz.h +++ b/src/graphics/common/blitz.h @@ -49,14 +49,14 @@ public: ~CBlitz(); void Flush(); - BOOL EventProcess(const Event &event); - BOOL Create(float sleep, float delay, float magnetic); - BOOL GetStatus(float &sleep, float &delay, float &magnetic, float &progress); - BOOL SetStatus(float sleep, float delay, float magnetic, float progress); + bool EventProcess(const Event &event); + bool Create(float sleep, float delay, float magnetic); + bool GetStatus(float &sleep, float &delay, float &magnetic, float &progress); + bool SetStatus(float sleep, float delay, float magnetic, float progress); void Draw(); protected: - BOOL EventFrame(const Event &event); + bool EventFrame(const Event &event); CObject* SearchObject(D3DVECTOR pos); protected: @@ -66,7 +66,7 @@ protected: CCamera* m_camera; CSound* m_sound; - BOOL m_bBlitzExist; + bool m_bBlitzExist; float m_sleep; float m_delay; float m_magnetic; diff --git a/src/graphics/common/camera.cpp b/src/graphics/common/camera.cpp index e556c20..f3b7d39 100644 --- a/src/graphics/common/camera.cpp +++ b/src/graphics/common/camera.cpp @@ -64,7 +64,7 @@ CCamera::CCamera(CInstanceManager* iMan) m_normLookat = D3DVECTOR(0.0f, 0.0f, 0.0f); m_focus = 1.0f; - m_bRightDown = FALSE; + m_bRightDown = false; m_rightPosInit = FPOINT(0.5f, 0.5f); m_rightPosCenter = FPOINT(0.5f, 0.5f); m_rightPosMove = FPOINT(0.5f, 0.5f); @@ -80,7 +80,7 @@ CCamera::CCamera(CInstanceManager* iMan) m_backMin = 0.0f; m_addDirectionH = 0.0f; m_addDirectionV = 0.0f; - m_bTransparency = FALSE; + m_bTransparency = false; m_fixDist = 0.0f; m_fixDirectionH = 0.0f; @@ -122,10 +122,10 @@ CCamera::CCamera(CInstanceManager* iMan) m_scriptEye = D3DVECTOR(0.0f, 0.0f, 0.0f); m_scriptLookat = D3DVECTOR(0.0f, 0.0f, 0.0f); - m_bEffect = TRUE; - m_bCameraScroll = TRUE; - m_bCameraInvertX = FALSE; - m_bCameraInvertY = FALSE; + m_bEffect = true; + m_bCameraScroll = true; + m_bCameraInvertX = false; + m_bCameraInvertY = false; } // Object's constructor. @@ -135,22 +135,22 @@ CCamera::~CCamera() } -void CCamera::SetEffect(BOOL bEnable) +void CCamera::SetEffect(bool bEnable) { m_bEffect = bEnable; } -void CCamera::SetCameraScroll(BOOL bScroll) +void CCamera::SetCameraScroll(bool bScroll) { m_bCameraScroll = bScroll; } -void CCamera::SetCameraInvertX(BOOL bInvert) +void CCamera::SetCameraInvertX(bool bInvert) { m_bCameraInvertX = bInvert; } -void CCamera::SetCameraInvertY(BOOL bInvert) +void CCamera::SetCameraInvertY(bool bInvert) { m_bCameraInvertY = bInvert; } @@ -174,8 +174,8 @@ void CCamera::Init(D3DVECTOR eye, D3DVECTOR lookat, float delay) m_initDelay = delay; - eye.y += m_terrain->RetFloorLevel(eye, TRUE); - lookat.y += m_terrain->RetFloorLevel(lookat, TRUE); + eye.y += m_terrain->RetFloorLevel(eye, true); + lookat.y += m_terrain->RetFloorLevel(lookat, true); m_type = CAMERA_FREE; m_eyePt = eye; @@ -268,7 +268,7 @@ void CCamera::SetType(CameraType type) SetTransparency(pObj, 0.0f); // opaque object } } - m_bTransparency = FALSE; + m_bTransparency = false; if ( type == CAMERA_INFO || type == CAMERA_VISIT ) // xx -> info ? @@ -513,13 +513,13 @@ void CCamera::RetCamera(D3DVECTOR &eye, D3DVECTOR &lookat) // Specifies a special movement of camera to frame action. -BOOL CCamera::StartCentering(CObject *object, float angleH, float angleV, +bool CCamera::StartCentering(CObject *object, float angleH, float angleV, float dist, float time) { - if ( m_type != CAMERA_BACK ) return FALSE; - if ( object != m_cameraObj ) return FALSE; + if ( m_type != CAMERA_BACK ) return false; + if ( object != m_cameraObj ) return false; - if ( m_centeringPhase != CP_NULL ) return FALSE; + if ( m_centeringPhase != CP_NULL ) return false; if ( m_addDirectionH > PI ) { @@ -535,18 +535,18 @@ BOOL CCamera::StartCentering(CObject *object, float angleH, float angleV, m_centeringTime = time; m_centeringProgress = 0.0f; - return TRUE; + return true; } // Ends a special movement of camera to frame action. -BOOL CCamera::StopCentering(CObject *object, float time) +bool CCamera::StopCentering(CObject *object, float time) { - if ( m_type != CAMERA_BACK ) return FALSE; - if ( object != m_cameraObj ) return FALSE; + if ( m_type != CAMERA_BACK ) return false; + if ( object != m_cameraObj ) return false; if ( m_centeringPhase != CP_START && - m_centeringPhase != CP_WAIT ) return FALSE; + m_centeringPhase != CP_WAIT ) return false; m_centeringPhase = CP_STOP; @@ -562,7 +562,7 @@ BOOL CCamera::StopCentering(CObject *object, float time) m_centeringTime = time; m_centeringProgress = 0.0f; - return TRUE; + return true; } // Stop framing special in the current position. @@ -976,17 +976,17 @@ void CCamera::SetViewTime(const D3DVECTOR &vEyePt, // Avoid the obstacles. -BOOL CCamera::IsCollision(D3DVECTOR &eye, D3DVECTOR lookat) +bool CCamera::IsCollision(D3DVECTOR &eye, D3DVECTOR lookat) { if ( m_type == CAMERA_BACK ) return IsCollisionBack(eye, lookat); if ( m_type == CAMERA_FIX ) return IsCollisionFix(eye, lookat); if ( m_type == CAMERA_PLANE ) return IsCollisionFix(eye, lookat); - return FALSE; + return false; } // Avoid the obstacles. -BOOL CCamera::IsCollisionBack(D3DVECTOR &eye, D3DVECTOR lookat) +bool CCamera::IsCollisionBack(D3DVECTOR &eye, D3DVECTOR lookat) { #if 0 CObject *pObj; @@ -1082,16 +1082,16 @@ BOOL CCamera::IsCollisionBack(D3DVECTOR &eye, D3DVECTOR lookat) { eye = proj; eye.y += len/5.0f; - return FALSE; + return false; } else { eye = (eye-lookat)*prox/del + lookat; eye.y += (del-prox)/5.0f; - return FALSE; + return false; } } - return FALSE; + return false; #else CObject *pObj; D3DVECTOR oPos, min, max, proj; @@ -1116,7 +1116,7 @@ BOOL CCamera::IsCollisionBack(D3DVECTOR &eye, D3DVECTOR lookat) max.y = Max(m_actualEye.y, m_actualLookat.y); max.z = Max(m_actualEye.z, m_actualLookat.z); - m_bTransparency = FALSE; + m_bTransparency = false; for ( i=0 ; i<1000000 ; i++ ) { @@ -1188,15 +1188,15 @@ BOOL CCamera::IsCollisionBack(D3DVECTOR &eye, D3DVECTOR lookat) if ( len > del ) continue; SetTransparency(pObj, 1.0f); // transparent object - m_bTransparency = TRUE; + m_bTransparency = true; } - return FALSE; + return false; #endif } // Avoid the obstacles. -BOOL CCamera::IsCollisionFix(D3DVECTOR &eye, D3DVECTOR lookat) +bool CCamera::IsCollisionFix(D3DVECTOR &eye, D3DVECTOR lookat) { CObject *pObj; D3DVECTOR oPos, proj; @@ -1239,16 +1239,16 @@ BOOL CCamera::IsCollisionFix(D3DVECTOR &eye, D3DVECTOR lookat) dist = Length(eye, lookat); proj = Projection(eye, lookat, oPos); eye = (lookat-eye)*oRadius/dist + proj; - return FALSE; + return false; } } - return FALSE; + return false; } // Management of an event. -BOOL CCamera::EventProcess(const Event &event) +bool CCamera::EventProcess(const Event &event) { switch( event.event ) { @@ -1258,17 +1258,17 @@ BOOL CCamera::EventProcess(const Event &event) #if 0 case EVENT_RBUTTONDOWN: - m_bRightDown = TRUE; + m_bRightDown = true; m_rightPosInit = event.pos; m_rightPosCenter = FPOINT(0.5f, 0.5f); m_engine->MoveMousePos(m_rightPosCenter); -//? m_engine->SetMouseHide(TRUE); // cache la souris +//? m_engine->SetMouseHide(true); // cache la souris break; case EVENT_RBUTTONUP: - m_bRightDown = FALSE; + m_bRightDown = false; m_engine->MoveMousePos(m_rightPosInit); -//? m_engine->SetMouseHide(FALSE); // remontre la souris +//? m_engine->SetMouseHide(false); // remontre la souris m_addDirectionH = 0.0f; m_addDirectionV = -PI*0.05f; break; @@ -1283,15 +1283,15 @@ BOOL CCamera::EventProcess(const Event &event) if ( event.param == VK_WHEELDOWN ) EventMouseWheel(-1); break; } - return TRUE; + return true; } // Changed the camera according to the mouse moved. -BOOL CCamera::EventMouseMove(const Event &event) +bool CCamera::EventMouseMove(const Event &event) { m_mousePos = event.pos; - return TRUE; + return true; } // Mouse wheel operated. @@ -1344,7 +1344,7 @@ void CCamera::EventMouseWheel(int dir) // Changed the camera according to the time elapsed. -BOOL CCamera::EventFrame(const Event &event) +bool CCamera::EventFrame(const Event &event) { EffectFrame(event); OverFrame(event); @@ -1391,7 +1391,7 @@ BOOL CCamera::EventFrame(const Event &event) return EventFrameVisit(event); } - return TRUE; + return true; } @@ -1482,7 +1482,7 @@ D3DMouse CCamera::RetMouseDef(FPOINT pos) // Moves the point of view. -BOOL CCamera::EventFrameFree(const Event &event) +bool CCamera::EventFrameFree(const Event &event) { D3DVECTOR pos, vLookatPt; float factor; @@ -1536,12 +1536,12 @@ BOOL CCamera::EventFrameFree(const Event &event) m_terrain->ValidPosition(m_eyePt, 10.0f); - if ( m_terrain->MoveOnFloor(m_eyePt, TRUE) ) + if ( m_terrain->MoveOnFloor(m_eyePt, true) ) { m_eyePt.y += m_heightEye; pos = m_eyePt; - if ( m_terrain->MoveOnFloor(pos, TRUE) ) + if ( m_terrain->MoveOnFloor(pos, true) ) { pos.y -= 2.0f; if ( m_eyePt.y < pos.y ) @@ -1554,19 +1554,19 @@ BOOL CCamera::EventFrameFree(const Event &event) vLookatPt = LookatPoint( m_eyePt, m_directionH, m_directionV, 50.0f ); - if ( m_terrain->MoveOnFloor(vLookatPt, TRUE) ) + if ( m_terrain->MoveOnFloor(vLookatPt, true) ) { vLookatPt.y += m_heightLookat; } SetViewTime(m_eyePt, vLookatPt, event.rTime); - return TRUE; + return true; } // Moves the point of view. -BOOL CCamera::EventFrameEdit(const Event &event) +bool CCamera::EventFrameEdit(const Event &event) { D3DVECTOR pos, vLookatPt; float factor; @@ -1596,12 +1596,12 @@ BOOL CCamera::EventFrameEdit(const Event &event) m_terrain->ValidPosition(m_eyePt, 10.0f); - if ( m_terrain->MoveOnFloor(m_eyePt, FALSE) ) + if ( m_terrain->MoveOnFloor(m_eyePt, false) ) { m_eyePt.y += m_editHeight; pos = m_eyePt; - if ( m_terrain->MoveOnFloor(pos, FALSE) ) + if ( m_terrain->MoveOnFloor(pos, false) ) { pos.y += 2.0f; if ( m_eyePt.y < pos.y ) @@ -1614,26 +1614,26 @@ BOOL CCamera::EventFrameEdit(const Event &event) vLookatPt = LookatPoint( m_eyePt, m_directionH, m_directionV, 50.0f ); - if ( m_terrain->MoveOnFloor(vLookatPt, TRUE) ) + if ( m_terrain->MoveOnFloor(vLookatPt, true) ) { vLookatPt.y += m_heightLookat; } SetViewTime(m_eyePt, vLookatPt, event.rTime); - return TRUE; + return true; } // Moves the point of view. -BOOL CCamera::EventFrameDialog(const Event &event) +bool CCamera::EventFrameDialog(const Event &event) { - return TRUE; + return true; } // Moves the point of view. -BOOL CCamera::EventFrameBack(const Event &event) +bool CCamera::EventFrameBack(const Event &event) { CPhysics* physics; ObjectType type; @@ -1831,12 +1831,12 @@ BOOL CCamera::EventFrameBack(const Event &event) m_directionV = v; } - return TRUE; + return true; } // Moves the point of view. -BOOL CCamera::EventFrameFix(const Event &event) +bool CCamera::EventFrameFix(const Event &event) { D3DVECTOR pos, vLookatPt; float h, v, d; @@ -1891,12 +1891,12 @@ BOOL CCamera::EventFrameFix(const Event &event) m_directionV = v; } - return TRUE; + return true; } // Moves the point of view. -BOOL CCamera::EventFrameExplo(const Event &event) +bool CCamera::EventFrameExplo(const Event &event) { D3DVECTOR pos, vLookatPt; float factor; @@ -1910,12 +1910,12 @@ BOOL CCamera::EventFrameExplo(const Event &event) m_terrain->ValidPosition(m_eyePt, 10.0f); - if ( m_terrain->MoveOnFloor(m_eyePt, FALSE) ) + if ( m_terrain->MoveOnFloor(m_eyePt, false) ) { m_eyePt.y += m_heightEye; pos = m_eyePt; - if ( m_terrain->MoveOnFloor(pos, FALSE) ) + if ( m_terrain->MoveOnFloor(pos, false) ) { pos.y += 2.0f; if ( m_eyePt.y < pos.y ) @@ -1928,19 +1928,19 @@ BOOL CCamera::EventFrameExplo(const Event &event) vLookatPt = LookatPoint( m_eyePt, m_directionH, m_directionV, 50.0f ); - if ( m_terrain->MoveOnFloor(vLookatPt, TRUE) ) + if ( m_terrain->MoveOnFloor(vLookatPt, true) ) { vLookatPt.y += m_heightLookat; } SetViewTime(m_eyePt, vLookatPt, event.rTime); - return TRUE; + return true; } // Moves the point of view. -BOOL CCamera::EventFrameOnBoard(const Event &event) +bool CCamera::EventFrameOnBoard(const Event &event) { D3DVECTOR vLookatPt, vUpVec, eye, lookat, pos; @@ -1955,22 +1955,22 @@ BOOL CCamera::EventFrameOnBoard(const Event &event) m_actualEye = eye; m_actualLookat = lookat; } - return TRUE; + return true; } // Moves the point of view. -BOOL CCamera::EventFrameInfo(const Event &event) +bool CCamera::EventFrameInfo(const Event &event) { SetViewTime(D3DVECTOR(0.0f, 0.0f, 0.0f), D3DVECTOR(0.0f, 0.0f, 1.0f), event.rTime); - return TRUE; + return true; } // Moves the point of view. -BOOL CCamera::EventFrameVisit(const Event &event) +bool CCamera::EventFrameVisit(const Event &event) { D3DVECTOR eye; float angleH, angleV; @@ -2015,16 +2015,16 @@ BOOL CCamera::EventFrameVisit(const Event &event) eye = ExcludeObject(eye, m_visitGoal, angleH, angleV); SetViewTime(eye, m_visitGoal, event.rTime); - return TRUE; + return true; } // Moves the point of view. -BOOL CCamera::EventFrameScript(const Event &event) +bool CCamera::EventFrameScript(const Event &event) { SetViewTime(m_scriptEye+m_effectOffset, m_scriptLookat+m_effectOffset, event.rTime); - return TRUE; + return true; } void CCamera::SetScriptEye(D3DVECTOR eye) @@ -2043,12 +2043,12 @@ void CCamera::SetScriptLookat(D3DVECTOR lookat) void CCamera::SetViewParams(const D3DVECTOR &eye, const D3DVECTOR &lookat, const D3DVECTOR &up) { - BOOL bUnder; + bool bUnder; m_engine->SetViewParams(eye, lookat, up, m_eyeDistance); bUnder = (eye.y < m_water->RetLevel()); // Is it underwater? - if ( m_type == CAMERA_INFO ) bUnder = FALSE; + if ( m_type == CAMERA_INFO ) bUnder = false; m_engine->SetRankView(bUnder?1:0); } diff --git a/src/graphics/common/camera.h b/src/graphics/common/camera.h index 7723dfc..407d522 100644 --- a/src/graphics/common/camera.h +++ b/src/graphics/common/camera.h @@ -91,7 +91,7 @@ public: CCamera(CInstanceManager* iMan); ~CCamera(); - BOOL EventProcess(const Event &event); + bool EventProcess(const Event &event); void Init(D3DVECTOR eye, D3DVECTOR lookat, float delay); @@ -121,8 +121,8 @@ public: void RetCamera(D3DVECTOR &eye, D3DVECTOR &lookat); - BOOL StartCentering(CObject *object, float angleH, float angleV, float dist, float time); - BOOL StopCentering(CObject *object, float time); + bool StartCentering(CObject *object, float angleH, float angleV, float dist, float time); + bool StopCentering(CObject *object, float time); void AbortCentering(); void FlushEffect(); @@ -136,33 +136,33 @@ public: void SetScriptEye(D3DVECTOR eye); void SetScriptLookat(D3DVECTOR lookat); - void SetEffect(BOOL bEnable); - void SetCameraScroll(BOOL bScroll); - void SetCameraInvertX(BOOL bInvert); - void SetCameraInvertY(BOOL bInvert); + void SetEffect(bool bEnable); + void SetCameraScroll(bool bScroll); + void SetCameraInvertX(bool bInvert); + void SetCameraInvertY(bool bInvert); float RetMotorTurn(); D3DMouse RetMouseDef(FPOINT pos); protected: - BOOL EventMouseMove(const Event &event); + bool EventMouseMove(const Event &event); void EventMouseWheel(int dir); - BOOL EventFrame(const Event &event); - BOOL EventFrameFree(const Event &event); - BOOL EventFrameEdit(const Event &event); - BOOL EventFrameDialog(const Event &event); - BOOL EventFrameBack(const Event &event); - BOOL EventFrameFix(const Event &event); - BOOL EventFrameExplo(const Event &event); - BOOL EventFrameOnBoard(const Event &event); - BOOL EventFrameInfo(const Event &event); - BOOL EventFrameVisit(const Event &event); - BOOL EventFrameScript(const Event &event); + bool EventFrame(const Event &event); + bool EventFrameFree(const Event &event); + bool EventFrameEdit(const Event &event); + bool EventFrameDialog(const Event &event); + bool EventFrameBack(const Event &event); + bool EventFrameFix(const Event &event); + bool EventFrameExplo(const Event &event); + bool EventFrameOnBoard(const Event &event); + bool EventFrameInfo(const Event &event); + bool EventFrameVisit(const Event &event); + bool EventFrameScript(const Event &event); void SetViewTime(const D3DVECTOR &vEyePt, const D3DVECTOR &vLookatPt, float rTime); - BOOL IsCollision(D3DVECTOR &eye, D3DVECTOR lookat); - BOOL IsCollisionBack(D3DVECTOR &eye, D3DVECTOR lookat); - BOOL IsCollisionFix(D3DVECTOR &eye, D3DVECTOR lookat); + bool IsCollision(D3DVECTOR &eye, D3DVECTOR lookat); + bool IsCollisionBack(D3DVECTOR &eye, D3DVECTOR lookat); + bool IsCollisionFix(D3DVECTOR &eye, D3DVECTOR lookat); D3DVECTOR ExcludeTerrain(D3DVECTOR eye, D3DVECTOR lookat, float &angleH, float &angleV); D3DVECTOR ExcludeObject(D3DVECTOR eye, D3DVECTOR lookat, float &angleH, float &angleV); @@ -192,7 +192,7 @@ protected: D3DVECTOR m_normLookat; // aim normal float m_focus; - BOOL m_bRightDown; + bool m_bRightDown; FPOINT m_rightPosInit; FPOINT m_rightPosCenter; FPOINT m_rightPosMove; @@ -208,7 +208,7 @@ protected: float m_backMin; // CAMERA_BACK: distance minimal float m_addDirectionH; // CAMERA_BACK: additional direction float m_addDirectionV; // CAMERA_BACK: additional direction - BOOL m_bTransparency; + bool m_bTransparency; float m_fixDist; // CAMERA_FIX: distance float m_fixDirectionH; // CAMERA_FIX: direction @@ -260,9 +260,9 @@ protected: D3DVECTOR m_scriptEye; D3DVECTOR m_scriptLookat; - BOOL m_bEffect; // shocks if explosion? - BOOL m_bCameraScroll; // scroll in the edges? - BOOL m_bCameraInvertX; // X inversion in the edges? - BOOL m_bCameraInvertY; // Y inversion in the edges? + bool m_bEffect; // shocks if explosion? + bool m_bCameraScroll; // scroll in the edges? + bool m_bCameraInvertX; // X inversion in the edges? + bool m_bCameraInvertY; // Y inversion in the edges? }; diff --git a/src/graphics/common/cloud.cpp b/src/graphics/common/cloud.cpp index 0892962..75e44d6 100644 --- a/src/graphics/common/cloud.cpp +++ b/src/graphics/common/cloud.cpp @@ -53,7 +53,7 @@ CCloud::CCloud(CInstanceManager* iMan, CD3DEngine* engine) m_wind = D3DVECTOR(0.0f, 0.0f, 0.0f); m_subdiv = 8; m_filename[0] = 0; - m_bEnable = TRUE; + m_bEnable = true; } // Destructor of clouds. @@ -63,30 +63,30 @@ CCloud::~CCloud() } -BOOL CCloud::EventProcess(const Event &event) +bool CCloud::EventProcess(const Event &event) { if ( event.event == EVENT_FRAME ) { return EventFrame(event); } - return TRUE; + return true; } // Makes the clouds evolve. -BOOL CCloud::EventFrame(const Event &event) +bool CCloud::EventFrame(const Event &event) { - if ( m_engine->RetPause() ) return TRUE; + if ( m_engine->RetPause() ) return true; m_time += event.rTime; - if ( m_level == 0.0f ) return TRUE; + if ( m_level == 0.0f ) return true; - if ( m_time-m_lastTest < 0.2f ) return TRUE; + if ( m_time-m_lastTest < 0.2f ) return true; m_lastTest = m_time; - return TRUE; + return true; } @@ -149,10 +149,10 @@ void CCloud::Draw() device = m_engine->RetD3DDevice(); device->SetRenderState(D3DRENDERSTATE_AMBIENT, 0x00000000); - device->SetRenderState(D3DRENDERSTATE_LIGHTING, FALSE); - device->SetRenderState(D3DRENDERSTATE_ZENABLE, FALSE); -//? device->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE); - device->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE); + device->SetRenderState(D3DRENDERSTATE_LIGHTING, false); + device->SetRenderState(D3DRENDERSTATE_ZENABLE, false); +//? device->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true); + device->SetRenderState(D3DRENDERSTATE_FOGENABLE, true); device->SetRenderState(D3DRENDERSTATE_FOGSTART, F2DW(fogStart)); device->SetRenderState(D3DRENDERSTATE_FOGEND, F2DW(fogEnd)); @@ -229,7 +229,7 @@ void CCloud::Draw() // Updates the positions, relative to the ground. -BOOL CCloud::CreateLine(int x, int y, int len) +bool CCloud::CreateLine(int x, int y, int len) { float offset; @@ -250,7 +250,7 @@ BOOL CCloud::CreateLine(int x, int y, int len) // Creates all areas of cloud. -BOOL CCloud::Create(const char *filename, +bool CCloud::Create(const char *filename, D3DCOLORVALUE diffuse, D3DCOLORVALUE ambient, float level) { @@ -282,14 +282,14 @@ BOOL CCloud::Create(const char *filename, m_brick /= m_subdiv*DIMEXPAND; m_size *= m_subdiv*DIMEXPAND; - if ( m_level == 0.0f ) return TRUE; + if ( m_level == 0.0f ) return true; m_lineUsed = 0; for ( y=0 ; yLightEnable(i, FALSE); + m_lightTable[i].bUsed = false; + m_pD3DDevice->LightEnable(i, false); } m_lightUsed = 0; } @@ -138,11 +138,11 @@ int CLight::CreateLight() for ( i=0 ; i= D3DMAXLIGHT ) return FALSE; + if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return false; - m_lightTable[lightRank].bUsed = FALSE; - m_pD3DDevice->LightEnable(lightRank, FALSE); + m_lightTable[lightRank].bUsed = false; + m_pD3DDevice->LightEnable(lightRank, false); m_lightUsed = 0; for ( i=0 ; i= D3DMAXLIGHT ) return FALSE; + if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return false; m_lightTable[lightRank].light = light; @@ -209,62 +209,62 @@ BOOL CLight::SetLight(int lightRank, const D3DLIGHT7 &light) ProgInit(m_lightTable[lightRank].colorGreen, m_lightTable[lightRank].light.dcvDiffuse.g); ProgInit(m_lightTable[lightRank].colorBlue, m_lightTable[lightRank].light.dcvDiffuse.b); - return TRUE; + return true; } // Gives the specifications of a light. -BOOL CLight::GetLight(int lightRank, D3DLIGHT7 &light) +bool CLight::GetLight(int lightRank, D3DLIGHT7 &light) { - if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return FALSE; + if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return false; light = m_lightTable[lightRank].light; - return TRUE; + return true; } // Lights up or put out a light. -BOOL CLight::LightEnable(int lightRank, BOOL bEnable) +bool CLight::LightEnable(int lightRank, bool bEnable) { - if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return FALSE; + if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return false; m_lightTable[lightRank].bEnable = bEnable; - return TRUE; + return true; } // Specifies the type (TYPE *) items included in this light. // This light does not light up so that this type of objects. -BOOL CLight::SetLightIncluType(int lightRank, D3DTypeObj type) +bool CLight::SetLightIncluType(int lightRank, D3DTypeObj type) { - if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return FALSE; + if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return false; m_lightTable[lightRank].incluType = type; - return TRUE; + return true; } // Specifies the type (TYPE *) items excluded by this light. // This light does not illuminate then ever these objects. -BOOL CLight::SetLightExcluType(int lightRank, D3DTypeObj type) +bool CLight::SetLightExcluType(int lightRank, D3DTypeObj type) { - if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return FALSE; + if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return false; m_lightTable[lightRank].excluType = type; - return TRUE; + return true; } // Management of the position of the light. -BOOL CLight::SetLightPos(int lightRank, D3DVECTOR pos) +bool CLight::SetLightPos(int lightRank, D3DVECTOR pos) { - if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return FALSE; + if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return false; m_lightTable[lightRank].light.dvPosition = pos; - return TRUE; + return true; } D3DVECTOR CLight::RetLightPos(int lightRank) @@ -277,12 +277,12 @@ D3DVECTOR CLight::RetLightPos(int lightRank) // Management direction of the light. -BOOL CLight::SetLightDir(int lightRank, D3DVECTOR dir) +bool CLight::SetLightDir(int lightRank, D3DVECTOR dir) { - if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return FALSE; + if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return false; m_lightTable[lightRank].light.dvDirection = dir; - return TRUE; + return true; } D3DVECTOR CLight::RetLightDir(int lightRank) @@ -295,22 +295,22 @@ D3DVECTOR CLight::RetLightDir(int lightRank) // Specifies the rate of change. -BOOL CLight::SetLightIntensitySpeed(int lightRank, float speed) +bool CLight::SetLightIntensitySpeed(int lightRank, float speed) { - if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return FALSE; + if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return false; m_lightTable[lightRank].intensity.speed = speed; - return TRUE; + return true; } // Management of the intensity of light. -BOOL CLight::SetLightIntensity(int lightRank, float value) +bool CLight::SetLightIntensity(int lightRank, float value) { - if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return FALSE; + if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return false; ProgSet(m_lightTable[lightRank].intensity, value); - return TRUE; + return true; } float CLight::RetLightIntensity(int lightRank) @@ -323,26 +323,26 @@ float CLight::RetLightIntensity(int lightRank) // Specifies the rate of change. -BOOL CLight::SetLightColorSpeed(int lightRank, float speed) +bool CLight::SetLightColorSpeed(int lightRank, float speed) { - if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return FALSE; + if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return false; m_lightTable[lightRank].colorRed.speed = speed; m_lightTable[lightRank].colorGreen.speed = speed; m_lightTable[lightRank].colorBlue.speed = speed; - return TRUE; + return true; } // Color management for light. -BOOL CLight::SetLightColor(int lightRank, D3DCOLORVALUE color) +bool CLight::SetLightColor(int lightRank, D3DCOLORVALUE color) { - if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return FALSE; + if ( lightRank < 0 || lightRank >= D3DMAXLIGHT ) return false; ProgSet(m_lightTable[lightRank].colorRed, color.r); ProgSet(m_lightTable[lightRank].colorGreen, color.g); ProgSet(m_lightTable[lightRank].colorBlue, color.b); - return TRUE; + return true; } D3DCOLORVALUE CLight::RetLightColor(int lightRank) @@ -374,7 +374,7 @@ void CLight::AdaptLightColor(D3DCOLORVALUE color, float factor) for ( i=0 ; i light exists - char bEnable; // TRUE -> light turned on + char bUsed; // true -> light exists + char bEnable; // true -> light turned on D3DTypeObj incluType; // type of all objects included D3DTypeObj excluType; // type of all objects excluded @@ -69,27 +69,27 @@ public: void FlushLight(); int CreateLight(); - BOOL DeleteLight(int lightRank); - BOOL SetLight(int lightRank, const D3DLIGHT7 &light); - BOOL GetLight(int lightRank, D3DLIGHT7 &light); - BOOL LightEnable(int lightRank, BOOL bEnable); + bool DeleteLight(int lightRank); + bool SetLight(int lightRank, const D3DLIGHT7 &light); + bool GetLight(int lightRank, D3DLIGHT7 &light); + bool LightEnable(int lightRank, bool bEnable); - BOOL SetLightIncluType(int lightRank, D3DTypeObj type); - BOOL SetLightExcluType(int lightRank, D3DTypeObj type); + bool SetLightIncluType(int lightRank, D3DTypeObj type); + bool SetLightExcluType(int lightRank, D3DTypeObj type); - BOOL SetLightPos(int lightRank, D3DVECTOR pos); + bool SetLightPos(int lightRank, D3DVECTOR pos); D3DVECTOR RetLightPos(int lightRank); - BOOL SetLightDir(int lightRank, D3DVECTOR dir); + bool SetLightDir(int lightRank, D3DVECTOR dir); D3DVECTOR RetLightDir(int lightRank); - BOOL SetLightIntensitySpeed(int lightRank, float speed); - BOOL SetLightIntensity(int lightRank, float value); + bool SetLightIntensitySpeed(int lightRank, float speed); + bool SetLightIntensity(int lightRank, float value); float RetLightIntensity(int lightRank); void AdaptLightColor(D3DCOLORVALUE color, float factor); - BOOL SetLightColorSpeed(int lightRank, float speed); - BOOL SetLightColor(int lightRank, D3DCOLORVALUE color); + bool SetLightColorSpeed(int lightRank, float speed); + bool SetLightColor(int lightRank, D3DCOLORVALUE color); D3DCOLORVALUE RetLightColor(int lightRank); void FrameLight(float rTime); diff --git a/src/graphics/common/mainmovie.cpp b/src/graphics/common/mainmovie.cpp index 5618406..23c3652 100644 --- a/src/graphics/common/mainmovie.cpp +++ b/src/graphics/common/mainmovie.cpp @@ -75,7 +75,7 @@ void CMainMovie::Flush() // Start of a film. -BOOL CMainMovie::Start(MainMovieType type, float time) +bool CMainMovie::Start(MainMovieType type, float time) { D3DMATRIX* mat; D3DVECTOR pos; @@ -92,7 +92,7 @@ BOOL CMainMovie::Start(MainMovieType type, float time) if ( pObj == 0 ) { m_type = MM_NONE; // it's over! - return TRUE; + return true; } motion = pObj->RetMotion(); @@ -131,12 +131,12 @@ BOOL CMainMovie::Start(MainMovieType type, float time) m_type = MM_NONE; // it's already over! } - return TRUE; + return true; } // Stop a current movie. -BOOL CMainMovie::Stop() +bool CMainMovie::Stop() { CObject* pObj; CMotion* motion; @@ -155,12 +155,12 @@ BOOL CMainMovie::Stop() } m_type = MM_NONE; - return TRUE; + return true; } // Indicates whether a film is in progress. -BOOL CMainMovie::IsExist() +bool CMainMovie::IsExist() { return (m_type != MM_NONE); } @@ -168,12 +168,12 @@ BOOL CMainMovie::IsExist() // Processing an event. -BOOL CMainMovie::EventProcess(const Event &event) +bool CMainMovie::EventProcess(const Event &event) { D3DVECTOR initialEye, initialLookat, finalEye, finalLookat, eye, lookat; float progress; - if ( m_type == MM_NONE ) return TRUE; + if ( m_type == MM_NONE ) return true; m_progress += event.rTime*m_speed; @@ -211,7 +211,7 @@ BOOL CMainMovie::EventProcess(const Event &event) { m_stopType = m_type; Flush(); - return FALSE; + return false; } } @@ -224,11 +224,11 @@ BOOL CMainMovie::EventProcess(const Event &event) { m_stopType = m_type; Flush(); - return FALSE; + return false; } } - return TRUE; + return true; } diff --git a/src/graphics/common/mainmovie.h b/src/graphics/common/mainmovie.h index fa65730..f02f0f1 100644 --- a/src/graphics/common/mainmovie.h +++ b/src/graphics/common/mainmovie.h @@ -47,10 +47,10 @@ public: ~CMainMovie(); void Flush(); - BOOL Start(MainMovieType type, float time); - BOOL Stop(); - BOOL IsExist(); - BOOL EventProcess(const Event &event); + bool Start(MainMovieType type, float time); + bool Stop(); + bool IsExist(); + bool EventProcess(const Event &event); MainMovieType RetType(); MainMovieType RetStopType(); diff --git a/src/graphics/common/model.cpp b/src/graphics/common/model.cpp index 9fa2b2e..324f219 100644 --- a/src/graphics/common/model.cpp +++ b/src/graphics/common/model.cpp @@ -97,13 +97,13 @@ CModel::CModel(CInstanceManager* iMan) m_state = 0; m_textureMode = 0; m_textureRotate = 0; - m_bTextureMirrorX = FALSE; - m_bTextureMirrorY = FALSE; + m_bTextureMirrorX = false; + m_bTextureMirrorY = false; m_texturePart = 0; TexturePartUpdate(); - m_bDisplayTransparent = FALSE; - m_bDisplayOnlySelection = FALSE; + m_bDisplayTransparent = false; + m_bDisplayOnlySelection = false; InitView(); m_triangleSel1 = 0; @@ -404,47 +404,47 @@ void CModel::GetScriptName(char *buffer) // Indicates whether the edition name has focus. -BOOL CModel::IsEditFocus() +bool CModel::IsEditFocus() { CEdit* pe; pe = (CEdit*)m_interface->SearchControl(EVENT_EDIT1); if ( pe != 0 ) { - if ( pe->RetFocus() ) return TRUE; + if ( pe->RetFocus() ) return true; } pe = (CEdit*)m_interface->SearchControl(EVENT_EDIT2); if ( pe != 0 ) { - if ( pe->RetFocus() ) return TRUE; + if ( pe->RetFocus() ) return true; } pe = (CEdit*)m_interface->SearchControl(EVENT_EDIT3); if ( pe != 0 ) { - if ( pe->RetFocus() ) return TRUE; + if ( pe->RetFocus() ) return true; } pe = (CEdit*)m_interface->SearchControl(EVENT_EDIT4); if ( pe != 0 ) { - if ( pe->RetFocus() ) return TRUE; + if ( pe->RetFocus() ) return true; } pe = (CEdit*)m_interface->SearchControl(EVENT_EDIT5); if ( pe != 0 ) { - if ( pe->RetFocus() ) return TRUE; + if ( pe->RetFocus() ) return true; } - return FALSE; + return false; } // Management of an event. -BOOL CModel::EventProcess(const Event &event) +bool CModel::EventProcess(const Event &event) { char s[100]; int first, last; @@ -476,21 +476,21 @@ BOOL CModel::EventProcess(const Event &event) } if ( event.param == VK_ADD ) // numpad? { - if ( event.keyState & KS_SHIFT ) CurrentSelect(TRUE); + if ( event.keyState & KS_SHIFT ) CurrentSelect(true); CurrentSearchNext(+1, (event.keyState & KS_CONTROL)); } if ( event.param == VK_SUBTRACT ) // least numpad? { - if ( event.keyState & KS_SHIFT ) CurrentSelect(TRUE); + if ( event.keyState & KS_SHIFT ) CurrentSelect(true); CurrentSearchNext(-1, (event.keyState & KS_CONTROL)); } if ( event.param == VK_NUMPAD0 ) { - CurrentSelect(FALSE); + CurrentSelect(false); } if ( event.param == VK_DECIMAL ) { - CurrentSelect(TRUE); + CurrentSelect(true); } if ( event.param == VK_END ) { @@ -507,12 +507,12 @@ BOOL CModel::EventProcess(const Event &event) if ( event.param == VK_SPACE ) { m_bDisplayTransparent = !m_bDisplayTransparent; - m_bDisplayOnlySelection = FALSE; + m_bDisplayOnlySelection = false; } if ( event.param == 'H' ) { m_bDisplayOnlySelection = !m_bDisplayOnlySelection; - m_bDisplayTransparent = FALSE; + m_bDisplayTransparent = false; } if ( m_mode == 1 ) { @@ -719,7 +719,7 @@ BOOL CModel::EventProcess(const Event &event) case EVENT_BUTTON3: // read ? GetModelName(s); - m_modFile->ReadModel(s, TRUE, FALSE); // standard read with borders + m_modFile->ReadModel(s, true, false); // standard read with borders DeselectAll(); CurrentInit(); EventFrame(event); @@ -729,7 +729,7 @@ BOOL CModel::EventProcess(const Event &event) case EVENT_BUTTON4: // add ? GetModelName(s); first = m_modFile->RetTriangleUsed(); - m_modFile->AddModel(s, first, TRUE, FALSE); // standard read with borders + m_modFile->AddModel(s, first, true, false); // standard read with borders last = m_modFile->RetTriangleUsed(); SelectZone(first, last); EventFrame(event); @@ -777,7 +777,7 @@ BOOL CModel::EventProcess(const Event &event) // Drives the model. -BOOL CModel::EventFrame(const Event &event) +bool CModel::EventFrame(const Event &event) { D3DMATERIAL7 matCurrent, matCurrenti, matCurrents, matTrans; D3DMATERIAL7* pMat; @@ -853,7 +853,7 @@ BOOL CModel::EventFrame(const Event &event) m_engine->AddTriangle(objRank, &m_triangleTable[i].p1, 3, *pMat, state, m_triangleTable[i].texName, "", - 0.0f, 1000000.0f, FALSE); + 0.0f, 1000000.0f, false); } else { @@ -861,7 +861,7 @@ BOOL CModel::EventFrame(const Event &event) m_engine->AddTriangle(objRank, &m_triangleTable[i].p1, 3, *pMat, state|D3DSTATEDUALb, m_triangleTable[i].texName, texName2, - 0.0f, 1000000.0f, FALSE); + 0.0f, 1000000.0f, false); } if ( m_bDisplayTransparent && // draws inside? @@ -875,66 +875,66 @@ BOOL CModel::EventFrame(const Event &event) m_engine->AddTriangle(objRank, vertex, 3, matCurrenti, D3DSTATENORMAL, m_triangleTable[i].texName, "", - 0.0f, 1000000.0f, FALSE); + 0.0f, 1000000.0f, false); } } - return TRUE; + return true; } // Gives a vertex. -BOOL CModel::GetVertex(int rank, D3DVERTEX2 &vertex) +bool CModel::GetVertex(int rank, D3DVERTEX2 &vertex) { - if ( rank < 0 || rank/3 >= m_modFile->RetTriangleUsed() ) return FALSE; - if ( !m_triangleTable[rank/3].bUsed ) return FALSE; + if ( rank < 0 || rank/3 >= m_modFile->RetTriangleUsed() ) return false; + if ( !m_triangleTable[rank/3].bUsed ) return false; - if ( !m_triangleTable[rank/3].bSelect ) return FALSE; + if ( !m_triangleTable[rank/3].bSelect ) return false; if ( rank%3 == 0 ) { vertex = m_triangleTable[rank/3].p1; - return TRUE; + return true; } if ( rank%3 == 1 ) { vertex = m_triangleTable[rank/3].p2; - return TRUE; + return true; } if ( rank%3 == 2 ) { vertex = m_triangleTable[rank/3].p3; - return TRUE; + return true; } - return FALSE; + return false; } // Modifies a vertex. -BOOL CModel::SetVertex(int rank, D3DVERTEX2 &vertex) +bool CModel::SetVertex(int rank, D3DVERTEX2 &vertex) { - if ( rank < 0 || rank/3 >= m_modFile->RetTriangleUsed() ) return FALSE; - if ( !m_triangleTable[rank/3].bUsed ) return FALSE; + if ( rank < 0 || rank/3 >= m_modFile->RetTriangleUsed() ) return false; + if ( !m_triangleTable[rank/3].bUsed ) return false; - if ( !m_triangleTable[rank/3].bSelect ) return FALSE; + if ( !m_triangleTable[rank/3].bSelect ) return false; if ( rank%3 == 0 ) { m_triangleTable[rank/3].p1 = vertex; - return TRUE; + return true; } if ( rank%3 == 1 ) { m_triangleTable[rank/3].p2 = vertex; - return TRUE; + return true; } if ( rank%3 == 2 ) { m_triangleTable[rank/3].p3 = vertex; - return TRUE; + return true; } - return FALSE; + return false; } // Smoothed normals selected triangles. @@ -952,12 +952,12 @@ void CModel::SmoothSelect() bDone = (char*)malloc(used*3*sizeof(char)); for ( i=0 ; i= 100 ) break; } @@ -1234,7 +1234,7 @@ void CModel::ReadScript(char *filename) char buffer[200]; int i, first, last; D3DVECTOR move; - BOOL bFirst = TRUE; + bool bFirst = true; file = fopen(filename, "r"); if ( file == NULL ) return; @@ -1258,18 +1258,18 @@ void CModel::ReadScript(char *filename) if ( bFirst ) { - m_modFile->ReadModel(buffer, TRUE, TRUE); + m_modFile->ReadModel(buffer, true, true); last = m_modFile->RetTriangleUsed(); SelectZone(0, last); } else { first = m_modFile->RetTriangleUsed(); - m_modFile->AddModel(buffer, first, TRUE, FALSE); + m_modFile->AddModel(buffer, first, true, false); last = m_modFile->RetTriangleUsed(); SelectZone(first, last); } - bFirst = FALSE; + bFirst = false; move = OpDir(line, "zoom"); OperSelect(move, 'Z'); @@ -1358,7 +1358,7 @@ D3DVECTOR CModel::RetSelectNormal() // Maps a texture onto the selected triangles. -BOOL CModel::IsMappingSelectPlausible(D3DMaping D3Dmode) +bool CModel::IsMappingSelectPlausible(D3DMaping D3Dmode) { D3DVERTEX2 vertex[3]; D3DVECTOR min, max; @@ -1428,18 +1428,18 @@ BOOL CModel::IsMappingSelectPlausible(D3DMaping D3Dmode) } if ( vertex[0].tu == vertex[1].tu && - vertex[0].tu == vertex[2].tu ) return FALSE; + vertex[0].tu == vertex[2].tu ) return false; if ( vertex[0].tv == vertex[1].tv && - vertex[0].tv == vertex[2].tv ) return FALSE; + vertex[0].tv == vertex[2].tv ) return false; } - return TRUE; + return true; } // Maps a texture onto the selected triangles. -void CModel::MappingSelect(int mode, int rotate, BOOL bMirrorX, BOOL bMirrorY, +void CModel::MappingSelect(int mode, int rotate, bool bMirrorX, bool bMirrorY, FPOINT ti, FPOINT ts, char *texName) { D3DVERTEX2 vertex; @@ -1448,7 +1448,7 @@ void CModel::MappingSelect(int mode, int rotate, BOOL bMirrorX, BOOL bMirrorY, D3DMaping D3Dmode; float au, bu, av, bv; int used, i; - BOOL bPlausible[3]; + bool bPlausible[3]; DefaultSelect(); @@ -1558,7 +1558,7 @@ void CModel::MappingSelect(int mode, int rotate, BOOL bMirrorX, BOOL bMirrorY, // Maps a texture onto the selected triangles. -void CModel::MappingSelectSpherical(int mode, int rotate, BOOL bMirrorX, BOOL bMirrorY, +void CModel::MappingSelectSpherical(int mode, int rotate, bool bMirrorX, bool bMirrorY, FPOINT ti, FPOINT ts, char *texName) { D3DVERTEX2 vertex; @@ -1649,7 +1649,7 @@ D3DVECTOR CModel::RetMappingCenter(D3DVECTOR pos, D3DVECTOR min) // Maps a texture onto the selected triangles. -void CModel::MappingSelectCylindrical(int mode, int rotate, BOOL bMirrorX, BOOL bMirrorY, +void CModel::MappingSelectCylindrical(int mode, int rotate, bool bMirrorX, bool bMirrorY, FPOINT ti, FPOINT ts, char *texName) { D3DVERTEX2 vertex; @@ -1751,7 +1751,7 @@ void CModel::MappingSelectCylindrical(int mode, int rotate, BOOL bMirrorX, BOOL // Maps a texture onto the selected triangles. -void CModel::MappingSelectFace(int mode, int rotate, BOOL bMirrorX, BOOL bMirrorY, +void CModel::MappingSelectFace(int mode, int rotate, bool bMirrorX, bool bMirrorY, FPOINT ti, FPOINT ts, char *texName) { D3DVERTEX2 vertex[3]; @@ -1825,7 +1825,7 @@ void CModel::MappingSelectFace(int mode, int rotate, BOOL bMirrorX, BOOL bMirror void CModel::MappingSelect2(int texNum2, int subdiv, int offsetU, int offsetV, - BOOL bMirrorX, BOOL bMirrorY) + bool bMirrorX, bool bMirrorY) { D3DVERTEX2 vertex; D3DVECTOR min, max, center, p; @@ -1901,7 +1901,7 @@ void CModel::MappingSelect2(int texNum2, int subdiv, // Maps a secondary texture on flat. -void CModel::MappingSelectPlane2(int mode, BOOL bMirrorX, BOOL bMirrorY) +void CModel::MappingSelectPlane2(int mode, bool bMirrorX, bool bMirrorY) { D3DVERTEX2 vertex; D3DVECTOR min, max; @@ -1981,7 +1981,7 @@ void CModel::MappingSelectPlane2(int mode, BOOL bMirrorX, BOOL bMirrorY) // Maps a texture onto the selected triangles. -void CModel::MappingSelectSpherical2(BOOL bMirrorX, BOOL bMirrorY) +void CModel::MappingSelectSpherical2(bool bMirrorX, bool bMirrorY) { D3DVERTEX2 vertex; D3DVECTOR min, max, center, dim, p; @@ -2033,7 +2033,7 @@ void CModel::MappingSelectSpherical2(BOOL bMirrorX, BOOL bMirrorY) // Maps a texture onto the selected triangles. -void CModel::MappingSelectMagic2(BOOL bMirrorX, BOOL bMirrorY) +void CModel::MappingSelectMagic2(bool bMirrorX, bool bMirrorY) { D3DVERTEX2 vertex, v[3]; D3DVECTOR min, max, au, bu, av, bv, n; @@ -2180,7 +2180,7 @@ int CModel::SearchSamePlane(int first, int step) // Seeks the next triangle. -void CModel::CurrentSearchNext(int step, BOOL bControl) +void CModel::CurrentSearchNext(int step, bool bControl) { if ( step > 0 ) // forward? { @@ -2247,7 +2247,7 @@ void CModel::CurrentInit() // Selects the current triangles. -void CModel::CurrentSelect(BOOL bSelect) +void CModel::CurrentSelect(bool bSelect) { int i; @@ -2267,7 +2267,7 @@ void CModel::DeselectAll() used = m_modFile->RetTriangleUsed(); for ( i=0 ; iRetTriangleUsed(); for ( i=0 ; i= first && i < last ) { - m_triangleTable[i].bSelect = TRUE; + m_triangleTable[i].bSelect = true; } } m_triangleSel1 = first; @@ -2302,7 +2302,7 @@ void CModel::SelectAll() if ( m_triangleTable[i].min == m_min && m_triangleTable[i].max == m_max ) { - m_triangleTable[i].bSelect = TRUE; + m_triangleTable[i].bSelect = true; } } } @@ -2338,7 +2338,7 @@ void CModel::DefaultSelect() used = m_modFile->RetTriangleUsed(); for ( i=m_triangleSel1 ; i<=m_triangleSel2 ; i++ ) { - m_triangleTable[i].bSelect = TRUE; + m_triangleTable[i].bSelect = true; } } @@ -2357,7 +2357,7 @@ void CModel::SelectDelete() { if ( m_triangleTable[i].bSelect ) { - m_triangleTable[i].bUsed = FALSE; + m_triangleTable[i].bUsed = false; } } diff --git a/src/graphics/common/model.h b/src/graphics/common/model.h index e7b6b10..30daf24 100644 --- a/src/graphics/common/model.h +++ b/src/graphics/common/model.h @@ -38,7 +38,7 @@ public: void StartUserAction(); void StopUserAction(); - BOOL EventProcess(const Event &event); + bool EventProcess(const Event &event); void InitView(); void InitViewFromSelect(); @@ -46,9 +46,9 @@ public: void ViewMove(const Event &event, float speed); protected: - BOOL EventFrame(const Event &event); - BOOL GetVertex(int rank, D3DVERTEX2 &vertex); - BOOL SetVertex(int rank, D3DVERTEX2 &vertex); + bool EventFrame(const Event &event); + bool GetVertex(int rank, D3DVERTEX2 &vertex); + bool SetVertex(int rank, D3DVERTEX2 &vertex); D3DVECTOR RetSelectCDG(); D3DVECTOR RetSelectNormal(); void SmoothSelect(); @@ -59,21 +59,21 @@ protected: void OperSelect(D3DVECTOR move, char oper); void ReadScript(char *filename); void BBoxCompute(D3DVECTOR &min, D3DVECTOR &max); - BOOL IsMappingSelectPlausible(D3DMaping D3Dmode); - void MappingSelect(int mode, int rotate, BOOL bMirrorX, BOOL bMirrorY, FPOINT ti, FPOINT ts, char *texName); - void MappingSelectSpherical(int mode, int rotate, BOOL bMirrorX, BOOL bMirrorY, FPOINT ti, FPOINT ts, char *texName); + bool IsMappingSelectPlausible(D3DMaping D3Dmode); + void MappingSelect(int mode, int rotate, bool bMirrorX, bool bMirrorY, FPOINT ti, FPOINT ts, char *texName); + void MappingSelectSpherical(int mode, int rotate, bool bMirrorX, bool bMirrorY, FPOINT ti, FPOINT ts, char *texName); D3DVECTOR RetMappingCenter(D3DVECTOR pos, D3DVECTOR min); - void MappingSelectCylindrical(int mode, int rotate, BOOL bMirrorX, BOOL bMirrorY, FPOINT ti, FPOINT ts, char *texName); - void MappingSelectFace(int mode, int rotate, BOOL bMirrorX, BOOL bMirrorY, FPOINT ti, FPOINT ts, char *texName); - void MappingSelect2(int texNum2, int subdiv, int offsetU, int offsetV, BOOL bMirrorX, BOOL bMirrorY); - void MappingSelectPlane2(int mode, BOOL bMirrorX, BOOL bMirrorY); - void MappingSelectSpherical2(BOOL bMirrorX, BOOL bMirrorY); - void MappingSelectMagic2(BOOL bMirrorX, BOOL bMirrorY); + void MappingSelectCylindrical(int mode, int rotate, bool bMirrorX, bool bMirrorY, FPOINT ti, FPOINT ts, char *texName); + void MappingSelectFace(int mode, int rotate, bool bMirrorX, bool bMirrorY, FPOINT ti, FPOINT ts, char *texName); + void MappingSelect2(int texNum2, int subdiv, int offsetU, int offsetV, bool bMirrorX, bool bMirrorY); + void MappingSelectPlane2(int mode, bool bMirrorX, bool bMirrorY); + void MappingSelectSpherical2(bool bMirrorX, bool bMirrorY); + void MappingSelectMagic2(bool bMirrorX, bool bMirrorY); int SearchNext(int rank, int step); int SearchSamePlane(int first, int step); - void CurrentSearchNext(int step, BOOL bControl); + void CurrentSearchNext(int step, bool bControl); void CurrentInit(); - void CurrentSelect(BOOL bSelect); + void CurrentSelect(bool bSelect); void DeselectAll(); void SelectAll(); void SelectZone(int first, int last); @@ -93,7 +93,7 @@ protected: void GetModelName(char *buffer); void GetDXFName(char *buffer); void GetScriptName(char *buffer); - BOOL IsEditFocus(); + bool IsEditFocus(); protected: CInstanceManager* m_iMan; @@ -108,15 +108,15 @@ protected: int m_mode; int m_textureMode; int m_textureRotate; - BOOL m_bTextureMirrorX; - BOOL m_bTextureMirrorY; + bool m_bTextureMirrorX; + bool m_bTextureMirrorY; FPOINT m_textureInf; FPOINT m_textureSup; int m_texturePart; int m_textureRank; char m_textureName[20]; - BOOL m_bDisplayTransparent; - BOOL m_bDisplayOnlySelection; + bool m_bDisplayTransparent; + bool m_bDisplayOnlySelection; float m_viewHeight; float m_viewDist; float m_viewAngleH; diff --git a/src/graphics/common/particule.cpp b/src/graphics/common/particule.cpp index e7bdea3..d84ca22 100644 --- a/src/graphics/common/particule.cpp +++ b/src/graphics/common/particule.cpp @@ -51,7 +51,7 @@ // Check if an object can be destroyed, but is not an enemy. -BOOL IsSoft(ObjectType type) +bool IsSoft(ObjectType type) { return ( type == OBJECT_HUMAN || type == OBJECT_MOBILEfa || @@ -101,7 +101,7 @@ BOOL IsSoft(ObjectType type) // Check if an object is a destroyable enemy. -BOOL IsAlien(ObjectType type) +bool IsAlien(ObjectType type) { return ( type == OBJECT_ANT || type == OBJECT_SPIDER || @@ -169,7 +169,7 @@ void CParticule::FlushParticule() for ( i=0 ; i>16)&0xffff; channel &= 0xffff; - if ( channel < 0 ) return FALSE; - if ( channel >= MAXPARTICULE*MAXPARTITYPE ) return FALSE; + if ( channel < 0 ) return false; + if ( channel >= MAXPARTICULE*MAXPARTITYPE ) return false; #if 0 - if ( !m_particule[channel].bUsed ) return FALSE; + if ( !m_particule[channel].bUsed ) return false; - if ( m_particule[channel].uniqueStamp != uniqueStamp ) return FALSE; + if ( m_particule[channel].uniqueStamp != uniqueStamp ) return false; #else if ( !m_particule[channel].bUsed ) { - OutputDebugString("CheckChannel bUsed=FALSE !\n"); - return FALSE; + OutputDebugString("CheckChannel bUsed=false !\n"); + return false; } if ( m_particule[channel].uniqueStamp != uniqueStamp ) { OutputDebugString("CheckChannel uniqueStamp !\n"); - return FALSE; + return false; } #endif - return TRUE; + return true; } // Removes a particle after his rank. @@ -806,10 +806,10 @@ void CParticule::DeleteRank(int rank) i = m_particule[rank].trackRank; if ( i != -1 ) // drag associated? { - m_track[i].bUsed = FALSE; // frees the drag + m_track[i].bUsed = false; // frees the drag } - m_particule[rank].bUsed = FALSE; + m_particule[rank].bUsed = false; } // Removes all particles of a given type. @@ -843,10 +843,10 @@ void CParticule::DeleteParticule(int channel) i = m_particule[channel].trackRank; if ( i != -1 ) // drag associated? { - m_track[i].bUsed = FALSE; // frees the drag + m_track[i].bUsed = false; // frees the drag } - m_particule[channel].bUsed = FALSE; + m_particule[channel].bUsed = false; } @@ -917,17 +917,17 @@ void CParticule::SetPhase(int channel, ParticulePhase phase, float duration) // Returns the position of the particle. -BOOL CParticule::GetPosition(int channel, D3DVECTOR &pos) +bool CParticule::GetPosition(int channel, D3DVECTOR &pos) { - if ( !CheckChannel(channel) ) return FALSE; + if ( !CheckChannel(channel) ) return false; pos = m_particule[channel].pos; - return TRUE; + return true; } // Indicates whether a sheet evolves or not. -void CParticule::SetFrameUpdate(int sheet, BOOL bUpdate) +void CParticule::SetFrameUpdate(int sheet, bool bUpdate) { m_bFrameUpdate[sheet] = bUpdate; } @@ -939,7 +939,7 @@ void CParticule::FrameParticule(float rTime) CObject* object; D3DVECTOR eye, pos, speed, wind; FPOINT ts, ti, dim; - BOOL bPause; + bool bPause; float progress, dp, h, duration, mass, amplitude; int i, j, r, total; @@ -1003,7 +1003,7 @@ void CParticule::FrameParticule(float rTime) } else { - h = m_terrain->RetFloorLevel(m_particule[i].pos, TRUE); + h = m_terrain->RetFloorLevel(m_particule[i].pos, true); } h += m_particule[i].dim.y*0.75f; if ( m_particule[i].pos.y < h ) // impact with the ground? @@ -1305,14 +1305,14 @@ void CParticule::FrameParticule(float rTime) { m_particule[i].testTime = 0.0f; - if ( m_terrain->RetFloorHeight(m_particule[i].pos, TRUE) < -2.0f ) + if ( m_terrain->RetFloorHeight(m_particule[i].pos, true) < -2.0f ) { m_exploGunCounter ++; if ( m_exploGunCounter%2 == 0 ) { pos = m_particule[i].goal; - m_terrain->MoveOnFloor(pos, TRUE); + m_terrain->MoveOnFloor(pos, true); speed.x = 0.0f; speed.z = 0.0f; speed.y = 0.0f; @@ -1499,14 +1499,14 @@ void CParticule::FrameParticule(float rTime) { m_particule[i].testTime = 0.0f; - if ( m_terrain->RetFloorHeight(m_particule[i].pos, TRUE) < -2.0f ) + if ( m_terrain->RetFloorHeight(m_particule[i].pos, true) < -2.0f ) { m_exploGunCounter ++; if ( m_exploGunCounter%2 == 0 ) { pos = m_particule[i].goal; - m_terrain->MoveOnFloor(pos, TRUE); + m_terrain->MoveOnFloor(pos, true); speed.x = 0.0f; speed.z = 0.0f; speed.y = 0.0f; @@ -2748,13 +2748,13 @@ void CParticule::FrameParticule(float rTime) // Moves a drag. // Returns true if the drag is finished. -BOOL CParticule::TrackMove(int i, D3DVECTOR pos, float progress) +bool CParticule::TrackMove(int i, D3DVECTOR pos, float progress) { D3DVECTOR last; int h, hh; - if ( i < 0 || i >= MAXTRACK ) return TRUE; - if ( m_track[i].bUsed == FALSE ) return TRUE; + if ( i < 0 || i >= MAXTRACK ) return true; + if ( m_track[i].bUsed == false ) return true; if ( progress < 1.0f ) // particle exists? { @@ -3286,7 +3286,7 @@ void CParticule::DrawParticuleRay(int i) D3DMATRIX matrix; D3DVECTOR corner[4], eye, pos, goal, n, angle, proj; FPOINT dim, texInf, texSup; - BOOL bLeft; + bool bLeft; float a, len, adv, prop, vario1, vario2; int r, rank, step, first, last; @@ -3810,14 +3810,14 @@ void CParticule::DrawParticule(int sheet) { D3DMATERIAL7 mat; D3DMATRIX matrix; - BOOL bLoadTexture; + bool bLoadTexture; char name[20]; int state, t, i, j, r; m_pD3DDevice->SetRenderState(D3DRENDERSTATE_AMBIENT, 0xffffffff); - m_pD3DDevice->SetRenderState(D3DRENDERSTATE_LIGHTING, TRUE); -//? m_pD3DDevice->SetRenderState(D3DRENDERSTATE_ZENABLE, FALSE); - m_pD3DDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE); + m_pD3DDevice->SetRenderState(D3DRENDERSTATE_LIGHTING, true); +//? m_pD3DDevice->SetRenderState(D3DRENDERSTATE_ZENABLE, false); + m_pD3DDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false); // Draw the basic particles of triangles. if ( m_totalInterface[0][sheet] > 0 ) @@ -3836,7 +3836,7 @@ void CParticule::DrawParticule(int sheet) } // Draw the particles was calculated based on edge. - m_pD3DDevice->SetRenderState(D3DRENDERSTATE_LIGHTING, FALSE); + m_pD3DDevice->SetRenderState(D3DRENDERSTATE_LIGHTING, false); ZeroMemory( &mat, sizeof(D3DMATERIAL7) ); mat.diffuse.r = 1.0f; @@ -3870,7 +3870,7 @@ void CParticule::DrawParticule(int sheet) { if ( m_totalInterface[t][sheet] == 0 ) continue; - bLoadTexture = FALSE; + bLoadTexture = false; if ( t == 4 ) state = D3DSTATETTw; // text.tga else state = D3DSTATETTb; // effect[00..02].tga @@ -3886,7 +3886,7 @@ void CParticule::DrawParticule(int sheet) { NameParticule(name, t); m_engine->SetTexture(name); - bLoadTexture = TRUE; + bLoadTexture = true; } r = m_particule[i].trackRank; @@ -3932,8 +3932,8 @@ void CParticule::DrawParticule(int sheet) } } -//? m_pD3DDevice->SetRenderState(D3DRENDERSTATE_ZENABLE, TRUE); - m_pD3DDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE); +//? m_pD3DDevice->SetRenderState(D3DRENDERSTATE_ZENABLE, true); + m_pD3DDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true); } @@ -3945,10 +3945,10 @@ CObject* CParticule::SearchObjectGun(D3DVECTOR old, D3DVECTOR pos, CObject *pObj, *pBest; D3DVECTOR box1, box2, oPos, p; ObjectType oType; - BOOL bShield; + bool bShield; float min, oRadius, dist, shieldRadius; int i, j; - BOOL bHimself; + bool bHimself; if ( m_main->RetMovieLock() ) return 0; // current movie? @@ -3971,7 +3971,7 @@ CObject* CParticule::SearchObjectGun(D3DVECTOR old, D3DVECTOR pos, box2.z += min; pBest = 0; - bShield = FALSE; + bShield = false; for ( i=0 ; i<1000000 ; i++ ) { pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i); @@ -4048,7 +4048,7 @@ CObject* CParticule::SearchObjectGun(D3DVECTOR old, D3DVECTOR pos, if ( dist <= shieldRadius ) { pBest = pObj; - bShield = TRUE; + bShield = true; } } } @@ -4250,7 +4250,7 @@ D3DCOLORVALUE CParticule::RetFogColor(D3DVECTOR pos) // Writes a file. BMP containing all the tire tracks. -BOOL CParticule::WriteWheelTrace(char *filename, int width, int height, +bool CParticule::WriteWheelTrace(char *filename, int width, int height, D3DVECTOR dl, D3DVECTOR ur) { HDC hDC; @@ -4266,13 +4266,13 @@ BOOL CParticule::WriteWheelTrace(char *filename, int width, int height, POINT list[4]; int i; - if ( !m_engine->GetRenderDC(hDC) ) return FALSE; + if ( !m_engine->GetRenderDC(hDC) ) return false; hDCImage = CreateCompatibleDC(hDC); if ( hDCImage == 0 ) { m_engine->ReleaseRenderDC(hDC); - return FALSE; + return false; } hb = CreateCompatibleBitmap(hDC, width, height); @@ -4280,7 +4280,7 @@ BOOL CParticule::WriteWheelTrace(char *filename, int width, int height, { DeleteDC(hDCImage); m_engine->ReleaseRenderDC(hDC); - return FALSE; + return false; } SelectObject(hDCImage, hb); @@ -4360,7 +4360,7 @@ BOOL CParticule::WriteWheelTrace(char *filename, int width, int height, DeleteObject(hb); DeleteDC(hDCImage); m_engine->ReleaseRenderDC(hDC); - return FALSE; + return false; } m_engine->CreateBMPFile(filename, info, hb, hDCImage); @@ -4368,6 +4368,6 @@ BOOL CParticule::WriteWheelTrace(char *filename, int width, int height, DeleteObject(hb); DeleteDC(hDCImage); m_engine->ReleaseRenderDC(hDC); - return TRUE; + return true; } diff --git a/src/graphics/common/particule.h b/src/graphics/common/particule.h index 54a6428..06fca92 100644 --- a/src/graphics/common/particule.h +++ b/src/graphics/common/particule.h @@ -200,8 +200,8 @@ enum ParticulePhase typedef struct { - char bUsed; // TRUE -> particle used - char bRay; // TRUE -> ray with goal + char bUsed; // true -> particle used + char bRay; // true -> ray with goal unsigned short uniqueStamp; // unique mark short sheet; // sheet (0..n) ParticuleType type; // type PARTI* @@ -232,7 +232,7 @@ Particule; typedef struct { - char bUsed; // TRUE -> drag used + char bUsed; // true -> drag used char bDrawParticule; float step; // duration of not float last; // increase last not memorized @@ -282,19 +282,19 @@ public: void SetIntensity(int channel, float intensity); void SetParam(int channel, D3DVECTOR pos, FPOINT dim, float zoom, float angle, float intensity); void SetPhase(int channel, ParticulePhase phase, float duration); - BOOL GetPosition(int channel, D3DVECTOR &pos); + bool GetPosition(int channel, D3DVECTOR &pos); D3DCOLORVALUE RetFogColor(D3DVECTOR pos); - void SetFrameUpdate(int sheet, BOOL bUpdate); + void SetFrameUpdate(int sheet, bool bUpdate); void FrameParticule(float rTime); void DrawParticule(int sheet); - BOOL WriteWheelTrace(char *filename, int width, int height, D3DVECTOR dl, D3DVECTOR ur); + bool WriteWheelTrace(char *filename, int width, int height, D3DVECTOR dl, D3DVECTOR ur); protected: void DeleteRank(int rank); - BOOL CheckChannel(int &channel); + bool CheckChannel(int &channel); void DrawParticuleTriangle(int i); void DrawParticuleNorm(int i); void DrawParticuleFlat(int i); @@ -306,7 +306,7 @@ protected: CObject* SearchObjectGun(D3DVECTOR old, D3DVECTOR pos, ParticuleType type, CObject *father); CObject* SearchObjectRay(D3DVECTOR pos, D3DVECTOR goal, ParticuleType type, CObject *father); void Play(Sound sound, D3DVECTOR pos, float amplitude); - BOOL TrackMove(int i, D3DVECTOR pos, float progress); + bool TrackMove(int i, D3DVECTOR pos, float progress); void TrackDraw(int i, ParticuleType type); protected: @@ -325,7 +325,7 @@ protected: int m_wheelTraceIndex; WheelTrace m_wheelTrace[MAXWHEELTRACE]; int m_totalInterface[MAXPARTITYPE][SH_MAX]; - BOOL m_bFrameUpdate[SH_MAX]; + bool m_bFrameUpdate[SH_MAX]; int m_fogTotal; int m_fog[MAXPARTIFOG]; int m_uniqueStamp; diff --git a/src/graphics/common/planet.cpp b/src/graphics/common/planet.cpp index fae6d4a..68a5a64 100644 --- a/src/graphics/common/planet.cpp +++ b/src/graphics/common/planet.cpp @@ -64,11 +64,11 @@ void CPlanet::Flush() { for ( i=0 ; iRetPause() ) return TRUE; + if ( m_engine->RetPause() ) return true; m_time += event.rTime; @@ -109,7 +109,7 @@ BOOL CPlanet::EventFrame(const Event &event) m_planet[m_mode][i].angle.y = sinf(a)*sinf(m_planet[m_mode][i].dir)+m_planet[m_mode][i].start.y; } - return TRUE; + return true; } @@ -192,7 +192,7 @@ void CPlanet::Draw() // Creates a new planet. -BOOL CPlanet::Create(int mode, FPOINT start, float dim, float speed, +bool CPlanet::Create(int mode, FPOINT start, float dim, float speed, float dir, char *name, FPOINT uv1, FPOINT uv2) { int i; @@ -204,7 +204,7 @@ BOOL CPlanet::Create(int mode, FPOINT start, float dim, float speed, { if ( m_planet[mode][i].bUsed ) continue; - m_planet[mode][i].bUsed = TRUE; + m_planet[mode][i].bUsed = true; m_planet[mode][i].start = start; m_planet[mode][i].angle = start; m_planet[mode][i].dim = dim; @@ -217,16 +217,16 @@ BOOL CPlanet::Create(int mode, FPOINT start, float dim, float speed, m_planet[mode][i].bTGA = ( strstr(m_planet[mode][i].name, "planet") != 0 ); - m_bPlanetExist = TRUE; - return TRUE; + m_bPlanetExist = true; + return true; } - return FALSE; + return false; } // Indicates if there is at least one planet. -BOOL CPlanet::PlanetExist() +bool CPlanet::PlanetExist() { return m_bPlanetExist; } diff --git a/src/graphics/common/planet.h b/src/graphics/common/planet.h index b931c2b..75af350 100644 --- a/src/graphics/common/planet.h +++ b/src/graphics/common/planet.h @@ -31,7 +31,7 @@ class CD3DEngine; typedef struct { - char bUsed; // TRUE -> planet exists + char bUsed; // true -> planet exists FPOINT start; // initial position in degrees FPOINT angle; // current position in degrees float dim; // dimensions (0..1) @@ -53,16 +53,16 @@ public: ~CPlanet(); void Flush(); - BOOL EventProcess(const Event &event); - BOOL Create(int mode, FPOINT start, float dim, float speed, float dir, char *name, FPOINT uv1, FPOINT uv2); - BOOL PlanetExist(); + bool EventProcess(const Event &event); + bool Create(int mode, FPOINT start, float dim, float speed, float dir, char *name, FPOINT uv1, FPOINT uv2); + bool PlanetExist(); void LoadTexture(); void Draw(); void SetMode(int mode); int RetMode(); protected: - BOOL EventFrame(const Event &event); + bool EventFrame(const Event &event); protected: CInstanceManager* m_iMan; @@ -71,6 +71,6 @@ protected: float m_time; int m_mode; Planet m_planet[2][MAXPLANET]; - BOOL m_bPlanetExist; + bool m_bPlanetExist; }; diff --git a/src/graphics/common/pyro.cpp b/src/graphics/common/pyro.cpp index 7de5405..6ba09c5 100644 --- a/src/graphics/common/pyro.cpp +++ b/src/graphics/common/pyro.cpp @@ -80,7 +80,7 @@ CPyro::~CPyro() // Destroys the object. -void CPyro::DeleteObject(BOOL bAll) +void CPyro::DeleteObject(bool bAll) { if ( m_lightRank != -1 ) { @@ -92,7 +92,7 @@ void CPyro::DeleteObject(BOOL bAll) // Creates pyrotechnic effect. -BOOL CPyro::Create(PyroType type, CObject* pObj, float force) +bool CPyro::Create(PyroType type, CObject* pObj, float force) { D3DMATRIX* mat; CObject* power; @@ -109,7 +109,7 @@ BOOL CPyro::Create(PyroType type, CObject* pObj, float force) oType = pObj->RetType(); objRank = pObj->RetObjectRank(0); - if ( objRank == -1 ) return FALSE; + if ( objRank == -1 ) return false; m_engine->GetBBox(objRank, min, max); pos = pObj->RetPosition(0); @@ -161,11 +161,11 @@ BOOL CPyro::Create(PyroType type, CObject* pObj, float force) power = pObj->RetPower(); if ( power == 0 ) { - m_bPower = FALSE; + m_bPower = false; } else { - m_bPower = TRUE; + m_bPower = true; pos = power->RetPosition(0); pos.y += 1.0f; mat = pObj->RetWorldMatrix(0); @@ -177,39 +177,39 @@ BOOL CPyro::Create(PyroType type, CObject* pObj, float force) oType == OBJECT_TNT || oType == OBJECT_BOMB ) { - m_bPower = TRUE; + m_bPower = true; m_posPower = m_pos; m_posPower.y += 1.0f; m_pos = m_posPower; } if ( oType == OBJECT_STATION ) { - m_bPower = TRUE; + m_bPower = true; mat = pObj->RetWorldMatrix(0); m_posPower = Transform(*mat, D3DVECTOR(-15.0f, 7.0f, 0.0f)); m_pos = m_posPower; } if ( oType == OBJECT_ENERGY ) { - m_bPower = TRUE; + m_bPower = true; mat = pObj->RetWorldMatrix(0); m_posPower = Transform(*mat, D3DVECTOR(-7.0f, 6.0f, 0.0f)); m_pos = m_posPower; } if ( oType == OBJECT_NUCLEAR ) { - m_bPower = TRUE; + m_bPower = true; m_posPower = m_pos; } if ( oType == OBJECT_PARA ) { - m_bPower = TRUE; + m_bPower = true; m_posPower = m_pos; } if ( oType == OBJECT_SCRAP4 || oType == OBJECT_SCRAP5 ) // plastic material? { - m_bPower = TRUE; + m_bPower = true; m_posPower = m_pos; } @@ -258,7 +258,7 @@ BOOL CPyro::Create(PyroType type, CObject* pObj, float force) if ( type == PT_BURNT || type == PT_BURNO ) { - m_soundChannel = m_sound->Play(SOUND_BURN, m_pos, 1.0f, 1.0f, TRUE); + m_soundChannel = m_sound->Play(SOUND_BURN, m_pos, 1.0f, 1.0f, true); m_sound->AddEnvelope(m_soundChannel, 1.0f, 1.0f, 12.0f, SOPER_CONTINUE); m_sound->AddEnvelope(m_soundChannel, 0.0f, 1.0f, 5.0f, SOPER_STOP); } @@ -303,7 +303,7 @@ BOOL CPyro::Create(PyroType type, CObject* pObj, float force) if ( m_type == PT_DEADG ) { - m_object->SetDead(TRUE); + m_object->SetDead(true); motion = m_object->RetMotion(); if ( motion != 0 ) @@ -313,11 +313,11 @@ BOOL CPyro::Create(PyroType type, CObject* pObj, float force) m_camera->StartCentering(m_object, PI*0.5f, 99.9f, 0.0f, 1.5f); m_camera->StartOver(OE_FADEOUTw, m_pos, 1.0f); m_speed = 1.0f/10.0f; - return TRUE; + return true; } if ( m_type == PT_DEADW ) { - m_object->SetDead(TRUE); + m_object->SetDead(true); motion = m_object->RetMotion(); if ( motion != 0 ) @@ -327,7 +327,7 @@ BOOL CPyro::Create(PyroType type, CObject* pObj, float force) m_camera->StartCentering(m_object, PI*0.5f, 99.9f, 0.0f, 3.0f); m_camera->StartOver(OE_FADEOUTb, m_pos, 1.0f); m_speed = 1.0f/10.0f; - return TRUE; + return true; } if ( m_type == PT_SHOTT || @@ -335,7 +335,7 @@ BOOL CPyro::Create(PyroType type, CObject* pObj, float force) { m_camera->StartEffect(CE_SHOT, m_pos, force); m_speed = 1.0f/1.0f; - return TRUE; + return true; } if ( m_type == PT_SHOTH ) { @@ -344,7 +344,7 @@ BOOL CPyro::Create(PyroType type, CObject* pObj, float force) m_camera->StartOver(OE_BLOOD, m_pos, force); } m_speed = 1.0f/0.2f; - return TRUE; + return true; } if ( m_type == PT_SHOTW ) @@ -360,7 +360,7 @@ BOOL CPyro::Create(PyroType type, CObject* pObj, float force) if ( m_type == PT_WPCHECK ) { m_speed = 1.0f/8.0f; - m_object->SetEnable(FALSE); // object more functional + m_object->SetEnable(false); // object more functional } if ( m_type == PT_FLCREATE ) { @@ -369,7 +369,7 @@ BOOL CPyro::Create(PyroType type, CObject* pObj, float force) if ( m_type == PT_FLDELETE ) { m_speed = 1.0f/2.0f; - m_object->SetEnable(FALSE); // object more functional + m_object->SetEnable(false); // object more functional } if ( m_type == PT_RESET ) { @@ -398,7 +398,7 @@ BOOL CPyro::Create(PyroType type, CObject* pObj, float force) if ( m_type == PT_FALL ) { FallStart(); - return TRUE; + return true; } if ( m_type == PT_BURNT || @@ -411,7 +411,7 @@ BOOL CPyro::Create(PyroType type, CObject* pObj, float force) LightOperAdd(0.80f, 1.0f, -0.8f, -0.8f, -0.8f); // dark gray LightOperAdd(1.00f, 0.0f, -0.8f, -0.8f, -0.8f); // dark gray CreateLight(m_pos, 40.0f); - return TRUE; + return true; } if ( m_type == PT_SPIDER ) @@ -488,7 +488,7 @@ BOOL CPyro::Create(PyroType type, CObject* pObj, float force) } } - if ( m_type == PT_SHOTW ) return TRUE; + if ( m_type == PT_SHOTW ) return true; // Generates the triangles of the explosion. if ( m_type == PT_FRAGT || @@ -630,7 +630,7 @@ BOOL CPyro::Create(PyroType type, CObject* pObj, float force) } } - return TRUE; + return true; } // Creates an explosion with triangular form of particles. @@ -850,7 +850,7 @@ void CPyro::DisplayError(PyroType type, CObject* pObj) // Management of an event. -BOOL CPyro::EventProcess(const Event &event) +bool CPyro::EventProcess(const Event &event) { ParticuleType type; D3DVECTOR pos, speed, angle; @@ -858,8 +858,8 @@ BOOL CPyro::EventProcess(const Event &event) float prog, factor, duration; int i, r; - if ( event.event != EVENT_FRAME ) return TRUE; - if ( m_engine->RetPause() ) return TRUE; + if ( event.event != EVENT_FRAME ) return true; + if ( m_engine->RetPause() ) return true; m_time += event.rTime; m_progress += event.rTime*m_speed; @@ -1374,7 +1374,7 @@ BOOL CPyro::EventProcess(const Event &event) LightOperFrame(event.rTime); } - return TRUE; + return true; } // Indicates that the object binds to the effect no longer exists, without deleting it. @@ -1401,7 +1401,7 @@ Error CPyro::IsEnded() m_type == PT_SPIDER || m_type == PT_EGG ) { - DeleteObject(TRUE, TRUE); + DeleteObject(true, true); } if ( m_type == PT_FALL ) // freight which grave? @@ -1434,7 +1434,7 @@ Error CPyro::IsEnded() if ( m_type == PT_WPCHECK || m_type == PT_FLDELETE ) { - DeleteObject(TRUE, TRUE); + DeleteObject(true, true); } if ( m_type == PT_FLCREATE ) @@ -1462,7 +1462,7 @@ Error CPyro::IsEnded() // Removes the binding to a pyrotechnic effect. -void CPyro::DeleteObject(BOOL bPrimary, BOOL bSecondary) +void CPyro::DeleteObject(bool bPrimary, bool bSecondary) { CObject *sub, *truck; D3DVECTOR pos; @@ -1472,7 +1472,7 @@ void CPyro::DeleteObject(BOOL bPrimary, BOOL bSecondary) if ( m_object->RetResetCap() == RESET_MOVE ) // resettable object? { - m_object->SetEnable(FALSE); // object cache and inactive + m_object->SetEnable(false); // object cache and inactive pos = m_object->RetPosition(0); pos.y = -100.0f; m_object->SetPosition(0, pos); @@ -1581,11 +1581,11 @@ void CPyro::LightOperFrame(float rTime) // Creates light to accompany a pyrotechnic effect. -BOOL CPyro::CreateLight(D3DVECTOR pos, float height) +bool CPyro::CreateLight(D3DVECTOR pos, float height) { D3DLIGHT7 light; - if ( !m_engine->RetLightMode() ) return TRUE; + if ( !m_engine->RetLightMode() ) return true; m_lightHeight = height; @@ -1606,7 +1606,7 @@ BOOL CPyro::CreateLight(D3DVECTOR pos, float height) light.dvPhi = PI/4.0f; m_lightRank = m_light->CreateLight(); - if ( m_lightRank == -1 ) return FALSE; + if ( m_lightRank == -1 ) return false; m_light->SetLight(m_lightRank, light); m_light->SetLightIntensity(m_lightRank, 0.0f); @@ -1614,7 +1614,7 @@ BOOL CPyro::CreateLight(D3DVECTOR pos, float height) // Only illuminates the objects on the ground. m_light->SetLightIncluType(m_lightRank, TYPETERRAIN); - return TRUE; + return true; } @@ -1629,16 +1629,16 @@ void CPyro::ExploStart() m_burnType = m_object->RetType(); pos = m_object->RetPosition(0); - m_burnFall = m_terrain->RetFloorHeight(pos, TRUE); + m_burnFall = m_terrain->RetFloorHeight(pos, true); m_object->Simplify(); - m_object->SetLock(TRUE); // ruin not usable yet - m_object->SetExplo(TRUE); // being destroyed + m_object->SetLock(true); // ruin not usable yet + m_object->SetExplo(true); // being destroyed m_object->FlatParent(); if ( m_object->RetSelect() ) { - m_object->SetSelect(FALSE); // deselects the object + m_object->SetSelect(false); // deselects the object m_camera->SetType(CAMERA_EXPLO); m_main->DeselectAll(); } @@ -1678,14 +1678,14 @@ void CPyro::ExploStart() } m_engine->LoadTexture("dirty04.tga", 1); - DeleteObject(FALSE, TRUE); // destroys the object transported + the battery + DeleteObject(false, true); // destroys the object transported + the battery } // Ends the explosion of a vehicle. void CPyro::ExploTerminate() { - DeleteObject(TRUE, FALSE); // removes the main object + DeleteObject(true, false); // removes the main object } @@ -1699,14 +1699,14 @@ void CPyro::BurnStart() m_burnType = m_object->RetType(); pos = m_object->RetPosition(0); - m_burnFall = m_terrain->RetFloorHeight(pos, TRUE); + m_burnFall = m_terrain->RetFloorHeight(pos, true); m_object->Simplify(); - m_object->SetLock(TRUE); // ruin not usable yet + m_object->SetLock(true); // ruin not usable yet if ( m_object->RetSelect() ) { - m_object->SetSelect(FALSE); // deselects the object + m_object->SetSelect(false); // deselects the object m_camera->SetType(CAMERA_EXPLO); m_main->DeselectAll(); } @@ -2216,16 +2216,16 @@ void CPyro::BurnProgress() // Indicates whether a part should be retained. -BOOL CPyro::BurnIsKeepPart(int part) +bool CPyro::BurnIsKeepPart(int part) { int i; i = 0; while ( m_burnKeepPart[i] != -1 ) { - if ( part == m_burnKeepPart[i++] ) return TRUE; // must keep + if ( part == m_burnKeepPart[i++] ) return true; // must keep } - return FALSE; // must destroy + return false; // must destroy } // Ends the fire of an insect or a vehicle. @@ -2236,7 +2236,7 @@ void CPyro::BurnTerminate() if ( m_type == PT_BURNO ) // organic object is burning? { - DeleteObject(TRUE, TRUE); // removes the insect + DeleteObject(true, true); // removes the insect return; } @@ -2249,7 +2249,7 @@ void CPyro::BurnTerminate() m_object->DeletePart(i); } - DeleteObject(FALSE, TRUE); // destroys the object transported + the battery + DeleteObject(false, true); // destroys the object transported + the battery if ( m_burnType == OBJECT_DERRICK || m_burnType == OBJECT_STATION || @@ -2271,15 +2271,15 @@ void CPyro::BurnTerminate() m_burnType == OBJECT_END ) { m_object->SetType(OBJECT_RUINfactory); // others become a ruin - m_object->SetLock(FALSE); + m_object->SetLock(false); } else { m_object->SetType(OBJECT_RUINmobilew1); // others become a ruin - m_object->SetLock(FALSE); + m_object->SetLock(false); } - m_object->SetBurn(FALSE); // ruin usable (c-e-d. recoverable) + m_object->SetBurn(false); // ruin usable (c-e-d. recoverable) } @@ -2289,13 +2289,13 @@ void CPyro::FallStart() { D3DVECTOR pos; - m_object->SetBurn(TRUE); // usable + m_object->SetBurn(true); // usable pos = m_object->RetPosition(0); m_fallFloor = m_terrain->RetFloorLevel(pos); m_fallSpeed = 0.0f; m_fallBulletTime = 0.0f; - m_bFallEnding = FALSE; + m_bFallEnding = false; } // Seeking an object explode by the falling ball of bees. @@ -2407,7 +2407,7 @@ void CPyro::FallProgress(float rTime) { CObject* pObj; D3DVECTOR pos; - BOOL bFloor = FALSE; + bool bFloor = false; if ( m_object == 0 ) return; @@ -2418,7 +2418,7 @@ void CPyro::FallProgress(float rTime) if ( pos.y <= m_fallFloor ) // below the ground level? { pos.y = m_fallFloor; - bFloor = TRUE; + bFloor = true; } m_object->SetPosition(0, pos); @@ -2445,13 +2445,13 @@ void CPyro::FallProgress(float rTime) m_particule->CreateParticule(pos, D3DVECTOR(0.0f, 0.0f, 0.0f), FPOINT(6.0f, 6.0f), PARTIGUNDEL, 2.0f, 0.0f, 0.0f); m_sound->Play(SOUND_GUNDEL); - DeleteObject(TRUE, TRUE); // removes the ball + DeleteObject(true, true); // removes the ball } else { if ( pObj->ExploObject(EXPLO_BOUM, 1.0f) ) // start explosion { - DeleteObject(TRUE, TRUE); // removes the ball + DeleteObject(true, true); // removes the ball } else { @@ -2462,7 +2462,7 @@ void CPyro::FallProgress(float rTime) if ( bFloor || pObj != 0 ) { - m_bFallEnding = TRUE; + m_bFallEnding = true; } } } @@ -2480,7 +2480,7 @@ Error CPyro::FallIsEnded() if ( pos.y > m_fallFloor ) return ERR_CONTINUE; m_sound->Play(SOUND_BOUM, pos); - m_object->SetBurn(FALSE); // usable again + m_object->SetBurn(false); // usable again return ERR_STOP; } diff --git a/src/graphics/common/pyro.h b/src/graphics/common/pyro.h index e33b46a..b34842a 100644 --- a/src/graphics/common/pyro.h +++ b/src/graphics/common/pyro.h @@ -93,16 +93,16 @@ public: CPyro(CInstanceManager* iMan); ~CPyro(); - void DeleteObject(BOOL bAll=FALSE); - BOOL Create(PyroType type, CObject* pObj, float force=1.0f); - BOOL EventProcess(const Event &event); + void DeleteObject(bool bAll=false); + bool Create(PyroType type, CObject* pObj, float force=1.0f); + bool EventProcess(const Event &event); Error IsEnded(); void CutObjectLink(CObject* pObj); protected: void DisplayError(PyroType type, CObject* pObj); - BOOL CreateLight(D3DVECTOR pos, float height); - void DeleteObject(BOOL bPrimary, BOOL bSecondary); + bool CreateLight(D3DVECTOR pos, float height); + void DeleteObject(bool bPrimary, bool bSecondary); void CreateTriangle(CObject* pObj, ObjectType oType, int part); @@ -112,7 +112,7 @@ protected: void BurnStart(); void BurnAddPart(int part, D3DVECTOR pos, D3DVECTOR angle); void BurnProgress(); - BOOL BurnIsKeepPart(int part); + bool BurnIsKeepPart(int part); void BurnTerminate(); void FallStart(); @@ -138,7 +138,7 @@ protected: D3DVECTOR m_pos; // center of the effect D3DVECTOR m_posPower; // center of the battery - BOOL m_bPower; // battery exists? + bool m_bPower; // battery exists? PyroType m_type; float m_force; float m_size; @@ -163,7 +163,7 @@ protected: float m_fallFloor; float m_fallSpeed; float m_fallBulletTime; - BOOL m_bFallEnding; + bool m_bFallEnding; int m_crashSphereUsed; // number of spheres used D3DVECTOR m_crashSpherePos[50]; diff --git a/src/graphics/common/terrain.cpp b/src/graphics/common/terrain.cpp index 91c4c3d..06bf90f 100644 --- a/src/graphics/common/terrain.cpp +++ b/src/graphics/common/terrain.cpp @@ -64,8 +64,8 @@ CTerrain::CTerrain(CInstanceManager* iMan) m_depth = 2; m_texBaseName[0]= 0; m_texBaseExt[0] = 0; - m_bMultiText = TRUE; - m_bLevelText = FALSE; + m_bMultiText = true; + m_bLevelText = false; m_resources = 0; m_levelMatTotal = 0; m_levelMatMax = 0; @@ -114,7 +114,7 @@ CTerrain::~CTerrain() // +---+---+---+---+ // <---------------> mosaic*brick*size -BOOL CTerrain::Generate(int mosaic, int brickP2, float size, float vision, +bool CTerrain::Generate(int mosaic, int brickP2, float size, float vision, int depth, float hardness) { int dim; @@ -128,8 +128,8 @@ BOOL CTerrain::Generate(int mosaic, int brickP2, float size, float vision, m_engine->SetTerrainVision(vision); - m_bMultiText = TRUE; - m_bLevelText = FALSE; + m_bMultiText = true; + m_bLevelText = false; m_scaleMapping = 1.0f/(m_brick*m_size); m_subdivMapping = 1; @@ -145,7 +145,7 @@ BOOL CTerrain::Generate(int mosaic, int brickP2, float size, float vision, m_objRank = (int*)malloc(sizeof(int)*dim); ZeroMemory(m_objRank, sizeof(int)*dim); - return TRUE; + return true; } @@ -172,12 +172,12 @@ float CTerrain::RetScaleRelief() // Initializes the names of textures to use for the land. -BOOL CTerrain::InitTextures(char* baseName, int* table, int dx, int dy) +bool CTerrain::InitTextures(char* baseName, int* table, int dx, int dy) { int x, y; char* p; - m_bLevelText = FALSE; + m_bLevelText = false; strcpy(m_texBaseName, baseName); p = strchr(m_texBaseName, '.'); // p <- ^beginning of the extension @@ -198,7 +198,7 @@ BOOL CTerrain::InitTextures(char* baseName, int* table, int dx, int dy) m_texture[x+y*m_mosaic] = table[(x%dx)+(y%dy)*dx]; } } - return TRUE; + return true; } @@ -214,14 +214,14 @@ void CTerrain::LevelFlush() // Initializes the names of textures to use for the land. -BOOL CTerrain::LevelMaterial(int id, char* baseName, float u, float v, +bool CTerrain::LevelMaterial(int id, char* baseName, float u, float v, int up, int right, int down, int left, float hardness) { int i; i = m_levelMatTotal; - if ( i >= MAXMATTERRAIN-1 ) return FALSE; + if ( i >= MAXMATTERRAIN-1 ) return false; LevelOpenTable(); @@ -245,11 +245,11 @@ BOOL CTerrain::LevelMaterial(int id, char* baseName, float u, float v, if ( m_levelMatMax < down+1 ) m_levelMatMax = down+1; if ( m_levelMatMax < left+1 ) m_levelMatMax = left+1; - m_bLevelText = TRUE; + m_bLevelText = true; m_subdivMapping = 4; m_levelMatTotal ++; - return TRUE; + return true; } @@ -265,13 +265,13 @@ BOOL CTerrain::LevelMaterial(int id, char* baseName, float u, float v, // Ix = (400+Wx)/5 // Iy = (400-Wz)/5 -BOOL CTerrain::ResFromBMP(const char* filename) +bool CTerrain::ResFromBMP(const char* filename) { FILE* file; int size, sizem; file = fopen(filename, "rb"); - if ( file == NULL ) return FALSE; + if ( file == NULL ) return false; size = (m_mosaic*m_brick)+1; sizem = ((size+4-1)/4)*4; // upper size multiple of 4 @@ -290,11 +290,11 @@ BOOL CTerrain::ResFromBMP(const char* filename) free(m_resources); m_resources = 0; fclose(file); - return FALSE; + return false; } fclose(file); - return TRUE; + return true; } // Returns the resource type available underground. @@ -349,8 +349,8 @@ void CTerrain::FlushRelief() // Ix = (400+Wx)/5 // Iy = (400-Wz)/5 -BOOL CTerrain::ReliefFromBMP(const char* filename, float scaleRelief, - BOOL adjustBorder) +bool CTerrain::ReliefFromBMP(const char* filename, float scaleRelief, + bool adjustBorder) { FILE* file; unsigned char* buffer; @@ -360,7 +360,7 @@ BOOL CTerrain::ReliefFromBMP(const char* filename, float scaleRelief, m_scaleRelief = scaleRelief; file = fopen(filename, "rb"); - if ( file == NULL ) return FALSE; + if ( file == NULL ) return false; size = (m_mosaic*m_brick)+1; sizem = ((size+4-1)/4)*4; // upper size multiple of 4 @@ -373,7 +373,7 @@ BOOL CTerrain::ReliefFromBMP(const char* filename, float scaleRelief, { free(buffer); fclose(file); - return FALSE; + return false; } limit = 0.9f; @@ -400,12 +400,12 @@ BOOL CTerrain::ReliefFromBMP(const char* filename, float scaleRelief, free(buffer); fclose(file); - return TRUE; + return true; } // Adds a point of elevation in the buffer of relief. -BOOL CTerrain::ReliefAddDot(D3DVECTOR pos, float scaleRelief) +bool CTerrain::ReliefAddDot(D3DVECTOR pos, float scaleRelief) { float dim; int size, x, y; @@ -420,51 +420,51 @@ BOOL CTerrain::ReliefAddDot(D3DVECTOR pos, float scaleRelief) y = (int)pos.z; if ( x < 0 || x >= size || - y < 0 || y >= size ) return FALSE; + y < 0 || y >= size ) return false; if ( m_relief[x+y*size] < pos.y*scaleRelief ) { m_relief[x+y*size] = pos.y*scaleRelief; } - return TRUE; + return true; } // Load relief from a DXF file. -BOOL CTerrain::ReliefFromDXF(const char* filename, float scaleRelief) +bool CTerrain::ReliefFromDXF(const char* filename, float scaleRelief) { FILE* file = NULL; char line[100]; int command, rankSommet, nbSommet, nbFace, size; D3DVECTOR* table; - BOOL bWaitNbSommet; - BOOL bWaitNbFace; - BOOL bWaitSommetX; - BOOL bWaitSommetY; - BOOL bWaitSommetZ; - BOOL bWaitFaceX; - BOOL bWaitFaceY; - BOOL bWaitFaceZ; + bool bWaitNbSommet; + bool bWaitNbFace; + bool bWaitSommetX; + bool bWaitSommetY; + bool bWaitSommetZ; + bool bWaitFaceX; + bool bWaitFaceY; + bool bWaitFaceZ; float x,y,z; int p1,p2,p3; ZeroMemory(m_relief, sizeof(float)*(m_mosaic*m_brick+1)*(m_mosaic*m_brick+1)); file = fopen(filename, "r"); - if ( file == NULL ) return FALSE; + if ( file == NULL ) return false; size = (m_mosaic*m_brick)+1; table = (D3DVECTOR*)malloc(sizeof(D3DVECTOR)*size*size); rankSommet = 0; - bWaitNbSommet = FALSE; - bWaitNbFace = FALSE; - bWaitSommetX = FALSE; - bWaitSommetY = FALSE; - bWaitSommetZ = FALSE; - bWaitFaceX = FALSE; - bWaitFaceY = FALSE; - bWaitFaceZ = FALSE; + bWaitNbSommet = false; + bWaitNbFace = false; + bWaitSommetX = false; + bWaitSommetY = false; + bWaitSommetZ = false; + bWaitFaceX = false; + bWaitFaceY = false; + bWaitFaceZ = false; while ( fgets(line, 100, file) != NULL ) { @@ -473,42 +473,42 @@ BOOL CTerrain::ReliefFromDXF(const char* filename, float scaleRelief) if ( command == 66 ) { - bWaitNbSommet = TRUE; + bWaitNbSommet = true; } if ( command == 71 && bWaitNbSommet ) { - bWaitNbSommet = FALSE; + bWaitNbSommet = false; sscanf(line, "%d", &nbSommet); if ( nbSommet > size*size ) nbSommet = size*size; rankSommet = 0; - bWaitNbFace = TRUE; + bWaitNbFace = true; } if ( command == 72 && bWaitNbFace ) { - bWaitNbFace = FALSE; + bWaitNbFace = false; sscanf(line, "%d", &nbFace); - bWaitSommetX = TRUE; + bWaitSommetX = true; } if ( command == 10 && bWaitSommetX ) { - bWaitSommetX = FALSE; + bWaitSommetX = false; sscanf(line, "%f", &x); - bWaitSommetY = TRUE; + bWaitSommetY = true; } if ( command == 20 && bWaitSommetY ) { - bWaitSommetY = FALSE; + bWaitSommetY = false; sscanf(line, "%f", &y); - bWaitSommetZ = TRUE; + bWaitSommetZ = true; } if ( command == 30 && bWaitSommetZ ) { - bWaitSommetZ = FALSE; + bWaitSommetZ = false; sscanf(line, "%f", &z); nbSommet --; @@ -516,33 +516,33 @@ BOOL CTerrain::ReliefFromDXF(const char* filename, float scaleRelief) { D3DVECTOR p(x,z,y); // permutation of Y and Z! table[rankSommet++] = p; - bWaitSommetX = TRUE; + bWaitSommetX = true; } else { - bWaitFaceX = TRUE; + bWaitFaceX = true; } } if ( command == 71 && bWaitFaceX ) { - bWaitFaceX = FALSE; + bWaitFaceX = false; sscanf(line, "%d", &p1); if ( p1 < 0 ) p1 = -p1; - bWaitFaceY = TRUE; + bWaitFaceY = true; } if ( command == 72 && bWaitFaceY ) { - bWaitFaceY = FALSE; + bWaitFaceY = false; sscanf(line, "%d", &p2); if ( p2 < 0 ) p2 = -p2; - bWaitFaceZ = TRUE; + bWaitFaceZ = true; } if ( command == 73 && bWaitFaceZ ) { - bWaitFaceZ = FALSE; + bWaitFaceZ = false; sscanf(line, "%d", &p3); if ( p3 < 0 ) p3 = -p3; @@ -552,7 +552,7 @@ BOOL CTerrain::ReliefFromDXF(const char* filename, float scaleRelief) ReliefAddDot(table[p3-1], scaleRelief); ReliefAddDot(table[p2-1], scaleRelief); ReliefAddDot(table[p1-1], scaleRelief); - bWaitFaceX = TRUE; + bWaitFaceX = true; } } @@ -560,7 +560,7 @@ BOOL CTerrain::ReliefFromDXF(const char* filename, float scaleRelief) free(table); fclose(file); - return TRUE; + return true; } @@ -759,7 +759,7 @@ D3DVERTEX2 CTerrain::RetVertex(int x, int y, int step) // | // +-------------------> x -BOOL CTerrain::CreateMosaic(int ox, int oy, int step, int objRank, +bool CTerrain::CreateMosaic(int ox, int oy, int step, int objRank, const D3DMATERIAL7 &mat, float min, float max) { @@ -910,7 +910,7 @@ BOOL CTerrain::CreateMosaic(int ox, int oy, int step, int objRank, buffer->vertex[i++] = p1; buffer->vertex[i++] = p2; } - m_engine->AddQuick(objRank, buffer, texName1, texName2, min, max, TRUE); + m_engine->AddQuick(objRank, buffer, texName1, texName2, min, max, true); } } } @@ -920,7 +920,7 @@ BOOL CTerrain::CreateMosaic(int ox, int oy, int step, int objRank, transform._43 = o.z; m_engine->SetObjectTransform(objRank, transform); - return TRUE; + return true; } // (*) There is 1 pixel cover around each of the 16 surfaces: @@ -996,7 +996,7 @@ float CTerrain::LevelRetHeight(int x, int y) // Decide whether a point is using the materials. -BOOL CTerrain::LevelGetDot(int x, int y, float min, float max, float slope) +bool CTerrain::LevelGetDot(int x, int y, float min, float max, float slope) { float hc, h[4]; int i; @@ -1008,11 +1008,11 @@ BOOL CTerrain::LevelGetDot(int x, int y, float min, float max, float slope) h[3] = LevelRetHeight(x-1, y+0); if ( hc < min || - hc > max ) return FALSE; + hc > max ) return false; if ( slope == 0.0f ) { - return TRUE; + return true; } if ( slope > 0.0f ) @@ -1021,10 +1021,10 @@ BOOL CTerrain::LevelGetDot(int x, int y, float min, float max, float slope) { if ( Abs(hc-h[i]) >= slope ) { - return FALSE; + return false; } } - return TRUE; + return true; } if ( slope < 0.0f ) @@ -1033,13 +1033,13 @@ BOOL CTerrain::LevelGetDot(int x, int y, float min, float max, float slope) { if ( Abs(hc-h[i]) < -slope ) { - return FALSE; + return false; } } - return TRUE; + return true; } - return FALSE; + return false; } // Seeks if material exists. @@ -1156,7 +1156,7 @@ void CTerrain::LevelSetDot(int x, int y, int id, char *mat) // Tests if a material can give a place, according to its four neighbors. // If yes, puts the point. -BOOL CTerrain::LevelIfDot(int x, int y, int id, char *mat) +bool CTerrain::LevelIfDot(int x, int y, int id, char *mat) { char test[4]; @@ -1169,7 +1169,7 @@ BOOL CTerrain::LevelIfDot(int x, int y, int id, char *mat) test[2] = m_levelDot[(x+0)+(y-1)*m_levelDotSize].mat[2]; test[3] = m_levelDot[(x+0)+(y-1)*m_levelDotSize].mat[3]; - if ( LevelTestMat(test) == -1 ) return FALSE; + if ( LevelTestMat(test) == -1 ) return false; } // Compatible with left neighbor? @@ -1181,7 +1181,7 @@ BOOL CTerrain::LevelIfDot(int x, int y, int id, char *mat) test[2] = m_levelDot[(x-1)+(y+0)*m_levelDotSize].mat[2]; test[3] = m_levelDot[(x-1)+(y+0)*m_levelDotSize].mat[3]; - if ( LevelTestMat(test) == -1 ) return FALSE; + if ( LevelTestMat(test) == -1 ) return false; } // Compatible with upper neighbor? @@ -1193,7 +1193,7 @@ BOOL CTerrain::LevelIfDot(int x, int y, int id, char *mat) test[2] = mat[0]; test[3] = m_levelDot[(x+0)+(y+1)*m_levelDotSize].mat[3]; - if ( LevelTestMat(test) == -1 ) return FALSE; + if ( LevelTestMat(test) == -1 ) return false; } // Compatible with right neighbor? @@ -1205,16 +1205,16 @@ BOOL CTerrain::LevelIfDot(int x, int y, int id, char *mat) test[2] = m_levelDot[(x+1)+(y+0)*m_levelDotSize].mat[2]; test[3] = mat[1]; - if ( LevelTestMat(test) == -1 ) return FALSE; + if ( LevelTestMat(test) == -1 ) return false; } LevelSetDot(x, y, id, mat); // puts the point - return TRUE; + return true; } // Modifies the state of a point. -BOOL CTerrain::LevelPutDot(int x, int y, int id) +bool CTerrain::LevelPutDot(int x, int y, int id) { TerrainMaterial *tm; char mat[4]; @@ -1224,13 +1224,13 @@ BOOL CTerrain::LevelPutDot(int x, int y, int id) y /= m_brick/m_subdivMapping; if ( x < 0 || x >= m_levelDotSize || - y < 0 || y >= m_levelDotSize ) return FALSE; + y < 0 || y >= m_levelDotSize ) return false; tm = LevelSearchMat(id); - if ( tm == 0 ) return FALSE; + if ( tm == 0 ) return false; // Tries without changing neighbors. - if ( LevelIfDot(x, y, id, tm->mat) ) return TRUE; + if ( LevelIfDot(x, y, id, tm->mat) ) return true; // Tries changing a single neighbor (4x). for ( up=0 ; upmat[2]; mat[3] = tm->mat[3]; - if ( LevelIfDot(x, y, id, mat) ) return TRUE; + if ( LevelIfDot(x, y, id, mat) ) return true; } for ( right=0 ; rightmat[2]; mat[3] = tm->mat[3]; - if ( LevelIfDot(x, y, id, mat) ) return TRUE; + if ( LevelIfDot(x, y, id, mat) ) return true; } for ( down=0 ; downmat[3]; - if ( LevelIfDot(x, y, id, mat) ) return TRUE; + if ( LevelIfDot(x, y, id, mat) ) return true; } for ( left=0 ; leftmat[2]; mat[3] = left; - if ( LevelIfDot(x, y, id, mat) ) return TRUE; + if ( LevelIfDot(x, y, id, mat) ) return true; } // Tries changing two neighbors (6x). @@ -1283,7 +1283,7 @@ BOOL CTerrain::LevelPutDot(int x, int y, int id) mat[2] = down; mat[3] = tm->mat[3]; - if ( LevelIfDot(x, y, id, mat) ) return TRUE; + if ( LevelIfDot(x, y, id, mat) ) return true; } } @@ -1296,7 +1296,7 @@ BOOL CTerrain::LevelPutDot(int x, int y, int id) mat[2] = tm->mat[2]; mat[3] = left; - if ( LevelIfDot(x, y, id, mat) ) return TRUE; + if ( LevelIfDot(x, y, id, mat) ) return true; } } @@ -1309,7 +1309,7 @@ BOOL CTerrain::LevelPutDot(int x, int y, int id) mat[2] = tm->mat[2]; mat[3] = tm->mat[3]; - if ( LevelIfDot(x, y, id, mat) ) return TRUE; + if ( LevelIfDot(x, y, id, mat) ) return true; } } @@ -1322,7 +1322,7 @@ BOOL CTerrain::LevelPutDot(int x, int y, int id) mat[2] = down; mat[3] = tm->mat[3]; - if ( LevelIfDot(x, y, id, mat) ) return TRUE; + if ( LevelIfDot(x, y, id, mat) ) return true; } } @@ -1335,7 +1335,7 @@ BOOL CTerrain::LevelPutDot(int x, int y, int id) mat[2] = down; mat[3] = left; - if ( LevelIfDot(x, y, id, mat) ) return TRUE; + if ( LevelIfDot(x, y, id, mat) ) return true; } } @@ -1348,7 +1348,7 @@ BOOL CTerrain::LevelPutDot(int x, int y, int id) mat[2] = tm->mat[2]; mat[3] = left; - if ( LevelIfDot(x, y, id, mat) ) return TRUE; + if ( LevelIfDot(x, y, id, mat) ) return true; } } @@ -1366,25 +1366,25 @@ BOOL CTerrain::LevelPutDot(int x, int y, int id) mat[2] = down; mat[3] = left; - if ( LevelIfDot(x, y, id, mat) ) return TRUE; + if ( LevelIfDot(x, y, id, mat) ) return true; } } } } OutputDebugString("LevelPutDot error\n"); - return FALSE; + return false; } // Initializes all the ground with a material. -BOOL CTerrain::LevelInit(int id) +bool CTerrain::LevelInit(int id) { TerrainMaterial* tm; int i, j; tm = LevelSearchMat(id); - if ( tm == 0 ) return FALSE; + if ( tm == 0 ) return false; for ( i=0 ; iUpdate(); - return TRUE; + return true; } @@ -1722,7 +1722,7 @@ float CTerrain::RetCoarseSlope(const D3DVECTOR &pos) // Gives the normal vector at the position p (x,-,z) of the ground. -BOOL CTerrain::GetNormal(D3DVECTOR &n, const D3DVECTOR &p) +bool CTerrain::GetNormal(D3DVECTOR &n, const D3DVECTOR &p) { D3DVECTOR p1, p2, p3, p4; float dim; @@ -1734,7 +1734,7 @@ BOOL CTerrain::GetNormal(D3DVECTOR &n, const D3DVECTOR &p) y = (int)((p.z+dim)/m_size); if ( x < 0 || x > m_mosaic*m_brick || - y < 0 || y > m_mosaic*m_brick ) return FALSE; + y < 0 || y > m_mosaic*m_brick ) return false; p1 = RetVector(x+0, y+0); p2 = RetVector(x+1, y+0); @@ -1749,12 +1749,12 @@ BOOL CTerrain::GetNormal(D3DVECTOR &n, const D3DVECTOR &p) { n = ComputeNormal(p2,p4,p3); } - return TRUE; + return true; } // Returns the height of the ground. -float CTerrain::RetFloorLevel(const D3DVECTOR &p, BOOL bBrut, BOOL bWater) +float CTerrain::RetFloorLevel(const D3DVECTOR &p, bool bBrut, bool bWater) { D3DVECTOR p1, p2, p3, p4, ps; float dim, level; @@ -1766,7 +1766,7 @@ float CTerrain::RetFloorLevel(const D3DVECTOR &p, BOOL bBrut, BOOL bWater) y = (int)((p.z+dim)/m_size); if ( x < 0 || x > m_mosaic*m_brick || - y < 0 || y > m_mosaic*m_brick ) return FALSE; + y < 0 || y > m_mosaic*m_brick ) return false; p1 = RetVector(x+0, y+0); p2 = RetVector(x+1, y+0); @@ -1797,7 +1797,7 @@ float CTerrain::RetFloorLevel(const D3DVECTOR &p, BOOL bBrut, BOOL bWater) // Returns the height to the ground. // This height is positive when you are above the ground. -float CTerrain::RetFloorHeight(const D3DVECTOR &p, BOOL bBrut, BOOL bWater) +float CTerrain::RetFloorHeight(const D3DVECTOR &p, bool bBrut, bool bWater) { D3DVECTOR p1, p2, p3, p4, ps; float dim, level; @@ -1809,7 +1809,7 @@ float CTerrain::RetFloorHeight(const D3DVECTOR &p, BOOL bBrut, BOOL bWater) y = (int)((p.z+dim)/m_size); if ( x < 0 || x > m_mosaic*m_brick || - y < 0 || y > m_mosaic*m_brick ) return FALSE; + y < 0 || y > m_mosaic*m_brick ) return false; p1 = RetVector(x+0, y+0); p2 = RetVector(x+1, y+0); @@ -1839,7 +1839,7 @@ float CTerrain::RetFloorHeight(const D3DVECTOR &p, BOOL bBrut, BOOL bWater) // Modifies the coordinate "y" of point "p" to rest on the ground floor. -BOOL CTerrain::MoveOnFloor(D3DVECTOR &p, BOOL bBrut, BOOL bWater) +bool CTerrain::MoveOnFloor(D3DVECTOR &p, bool bBrut, bool bWater) { D3DVECTOR p1, p2, p3, p4; float dim, level; @@ -1851,7 +1851,7 @@ BOOL CTerrain::MoveOnFloor(D3DVECTOR &p, BOOL bBrut, BOOL bWater) y = (int)((p.z+dim)/m_size); if ( x < 0 || x > m_mosaic*m_brick || - y < 0 || y > m_mosaic*m_brick ) return FALSE; + y < 0 || y > m_mosaic*m_brick ) return false; p1 = RetVector(x+0, y+0); p2 = RetVector(x+1, y+0); @@ -1860,11 +1860,11 @@ BOOL CTerrain::MoveOnFloor(D3DVECTOR &p, BOOL bBrut, BOOL bWater) if ( Abs(p.z-p2.z) < Abs(p.x-p2.x) ) { - if ( !IntersectY(p1, p2, p3, p) ) return FALSE; + if ( !IntersectY(p1, p2, p3, p) ) return false; } else { - if ( !IntersectY(p2, p4, p3, p) ) return FALSE; + if ( !IntersectY(p2, p4, p3, p) ) return false; } if ( !bBrut ) AdjustBuildingLevel(p); @@ -1875,15 +1875,15 @@ BOOL CTerrain::MoveOnFloor(D3DVECTOR &p, BOOL bBrut, BOOL bWater) if ( p.y < level ) p.y = level; // not under water } - return TRUE; + return true; } // Modifies a coordinate so that it is on the ground. -// Returns FALSE if the initial coordinate was too far. +// Returns false if the initial coordinate was too far. -BOOL CTerrain::ValidPosition(D3DVECTOR &p, float marging) +bool CTerrain::ValidPosition(D3DVECTOR &p, float marging) { - BOOL bOK = TRUE; + bool bOK = true; float limit; limit = m_mosaic*m_brick*m_size/2.0f - marging; @@ -1891,25 +1891,25 @@ BOOL CTerrain::ValidPosition(D3DVECTOR &p, float marging) if ( p.x < -limit ) { p.x = -limit; - bOK = FALSE; + bOK = false; } if ( p.z < -limit ) { p.z = -limit; - bOK = FALSE; + bOK = false; } if ( p.x > limit ) { p.x = limit; - bOK = FALSE; + bOK = false; } if ( p.z > limit ) { p.z = limit; - bOK = FALSE; + bOK = false; } return bOK; @@ -1926,7 +1926,7 @@ void CTerrain::FlushBuildingLevel() // Adds a new elevation for a building. -BOOL CTerrain::AddBuildingLevel(D3DVECTOR center, float min, float max, +bool CTerrain::AddBuildingLevel(D3DVECTOR center, float min, float max, float height, float factor) { int i; @@ -1940,14 +1940,14 @@ BOOL CTerrain::AddBuildingLevel(D3DVECTOR center, float min, float max, } } - if ( m_buildingUsed >= MAXBUILDINGLEVEL ) return FALSE; + if ( m_buildingUsed >= MAXBUILDINGLEVEL ) return false; i = m_buildingUsed++; update: m_buildingTable[i].center = center; m_buildingTable[i].min = min; m_buildingTable[i].max = max; - m_buildingTable[i].level = RetFloorLevel(center, TRUE); + m_buildingTable[i].level = RetFloorLevel(center, true); m_buildingTable[i].height = height; m_buildingTable[i].factor = factor; m_buildingTable[i].bboxMinX = center.x-max; @@ -1955,12 +1955,12 @@ BOOL CTerrain::AddBuildingLevel(D3DVECTOR center, float min, float max, m_buildingTable[i].bboxMinZ = center.z-max; m_buildingTable[i].bboxMaxZ = center.z+max; - return TRUE; + return true; } // Updates the elevation for a building when it was moved up (after a terraforming). -BOOL CTerrain::UpdateBuildingLevel(D3DVECTOR center) +bool CTerrain::UpdateBuildingLevel(D3DVECTOR center) { int i; @@ -1970,16 +1970,16 @@ BOOL CTerrain::UpdateBuildingLevel(D3DVECTOR center) center.z == m_buildingTable[i].center.z ) { m_buildingTable[i].center = center; - m_buildingTable[i].level = RetFloorLevel(center, TRUE); - return TRUE; + m_buildingTable[i].level = RetFloorLevel(center, true); + return true; } } - return FALSE; + return false; } // Removes the elevation for a building when it was destroyed. -BOOL CTerrain::DeleteBuildingLevel(D3DVECTOR center) +bool CTerrain::DeleteBuildingLevel(D3DVECTOR center) { int i, j; @@ -1993,10 +1993,10 @@ BOOL CTerrain::DeleteBuildingLevel(D3DVECTOR center) m_buildingTable[j-1] = m_buildingTable[j]; } m_buildingUsed --; - return TRUE; + return true; } } - return FALSE; + return false; } // Returns the influence factor whether a position is on a possible rise. @@ -2054,7 +2054,7 @@ void CTerrain::AdjustBuildingLevel(D3DVECTOR &p) (m_buildingTable[i].max-m_buildingTable[i].min)* m_buildingTable[i].height; - base = RetFloorLevel(p, TRUE); + base = RetFloorLevel(p, true); if ( p.y < base ) p.y = base; #else border.x = ((p.x-m_buildingTable[i].center.x)*m_buildingTable[i].max)/ @@ -2062,7 +2062,7 @@ void CTerrain::AdjustBuildingLevel(D3DVECTOR &p) border.z = ((p.z-m_buildingTable[i].center.z)*m_buildingTable[i].max)/ dist+m_buildingTable[i].center.z; - base = RetFloorLevel(border, TRUE); + base = RetFloorLevel(border, true); p.y = (m_buildingTable[i].max-dist)/ (m_buildingTable[i].max-m_buildingTable[i].min)* @@ -2164,7 +2164,7 @@ float CTerrain::RetFlatZoneRadius(D3DVECTOR center, float max) angle = RetFineSlope(center); if ( angle >= FLATLIMIT ) return 0.0f; - ref = RetFloorLevel(center, TRUE); + ref = RetFloorLevel(center, true); radius = 1.0f; while ( radius <= max ) @@ -2181,7 +2181,7 @@ float CTerrain::RetFlatZoneRadius(D3DVECTOR center, float max) p = RotatePoint(c, angle, p); pos.x = p.x; pos.z = p.y; - h = RetFloorLevel(pos, TRUE); + h = RetFloorLevel(pos, true); if ( Abs(h-ref) > 1.0f ) return radius; angle += PI*2.0f/8.0f; @@ -2218,13 +2218,13 @@ void CTerrain::FlushFlyingLimit() // Empty the limits table of flight. -BOOL CTerrain::AddFlyingLimit(D3DVECTOR center, +bool CTerrain::AddFlyingLimit(D3DVECTOR center, float extRadius, float intRadius, float maxHeight) { int i; - if ( m_flyingLimitTotal >= MAXFLYINGLIMIT ) return FALSE; + if ( m_flyingLimitTotal >= MAXFLYINGLIMIT ) return false; i = m_flyingLimitTotal; m_flyingLimit[i].center = center; @@ -2233,12 +2233,12 @@ BOOL CTerrain::AddFlyingLimit(D3DVECTOR center, m_flyingLimit[i].maxHeight = maxHeight; m_flyingLimitTotal = i+1; - return TRUE; + return true; } // Returns the maximum height of flight. -float CTerrain::RetFlyingLimit(D3DVECTOR pos, BOOL bNoLimit) +float CTerrain::RetFlyingLimit(D3DVECTOR pos, bool bNoLimit) { float dist, h; int i; diff --git a/src/graphics/common/terrain.h b/src/graphics/common/terrain.h index fcc10e8..50f5612 100644 --- a/src/graphics/common/terrain.h +++ b/src/graphics/common/terrain.h @@ -101,36 +101,36 @@ public: CTerrain(CInstanceManager* iMan); ~CTerrain(); - BOOL Generate(int mosaic, int brickP2, float size, float vision, int depth, float hardness); - BOOL InitTextures(char* baseName, int* table, int dx, int dy); + bool Generate(int mosaic, int brickP2, float size, float vision, int depth, float hardness); + bool InitTextures(char* baseName, int* table, int dx, int dy); void LevelFlush(); - BOOL LevelMaterial(int id, char* baseName, float u, float v, int up, int right, int down, int left, float hardness); - BOOL LevelInit(int id); - BOOL LevelGenerate(int *id, float min, float max, float slope, float freq, D3DVECTOR center, float radius); + bool LevelMaterial(int id, char* baseName, float u, float v, int up, int right, int down, int left, float hardness); + bool LevelInit(int id); + bool LevelGenerate(int *id, float min, float max, float slope, float freq, D3DVECTOR center, float radius); void FlushRelief(); - BOOL ReliefFromBMP(const char* filename, float scaleRelief, BOOL adjustBorder); - BOOL ReliefFromDXF(const char* filename, float scaleRelief); - BOOL ResFromBMP(const char* filename); - BOOL CreateObjects(BOOL bMultiRes); - BOOL Terraform(const D3DVECTOR &p1, const D3DVECTOR &p2, float height); + bool ReliefFromBMP(const char* filename, float scaleRelief, bool adjustBorder); + bool ReliefFromDXF(const char* filename, float scaleRelief); + bool ResFromBMP(const char* filename); + bool CreateObjects(bool bMultiRes); + bool Terraform(const D3DVECTOR &p1, const D3DVECTOR &p2, float height); void SetWind(D3DVECTOR speed); D3DVECTOR RetWind(); float RetFineSlope(const D3DVECTOR &pos); float RetCoarseSlope(const D3DVECTOR &pos); - BOOL GetNormal(D3DVECTOR &n, const D3DVECTOR &p); - float RetFloorLevel(const D3DVECTOR &p, BOOL bBrut=FALSE, BOOL bWater=FALSE); - float RetFloorHeight(const D3DVECTOR &p, BOOL bBrut=FALSE, BOOL bWater=FALSE); - BOOL MoveOnFloor(D3DVECTOR &p, BOOL bBrut=FALSE, BOOL bWater=FALSE); - BOOL ValidPosition(D3DVECTOR &p, float marging); + bool GetNormal(D3DVECTOR &n, const D3DVECTOR &p); + float RetFloorLevel(const D3DVECTOR &p, bool bBrut=false, bool bWater=false); + float RetFloorHeight(const D3DVECTOR &p, bool bBrut=false, bool bWater=false); + bool MoveOnFloor(D3DVECTOR &p, bool bBrut=false, bool bWater=false); + bool ValidPosition(D3DVECTOR &p, float marging); TerrainRes RetResource(const D3DVECTOR &p); void LimitPos(D3DVECTOR &pos); void FlushBuildingLevel(); - BOOL AddBuildingLevel(D3DVECTOR center, float min, float max, float height, float factor); - BOOL UpdateBuildingLevel(D3DVECTOR center); - BOOL DeleteBuildingLevel(D3DVECTOR center); + bool AddBuildingLevel(D3DVECTOR center, float min, float max, float height, float factor); + bool UpdateBuildingLevel(D3DVECTOR center); + bool DeleteBuildingLevel(D3DVECTOR center); float RetBuildingFactor(const D3DVECTOR &p); float RetHardness(const D3DVECTOR &p); @@ -145,25 +145,25 @@ public: void SetFlyingMaxHeight(float height); float RetFlyingMaxHeight(); void FlushFlyingLimit(); - BOOL AddFlyingLimit(D3DVECTOR center, float extRadius, float intRadius, float maxHeight); - float RetFlyingLimit(D3DVECTOR pos, BOOL bNoLimit); + bool AddFlyingLimit(D3DVECTOR center, float extRadius, float intRadius, float maxHeight); + float RetFlyingLimit(D3DVECTOR pos, bool bNoLimit); protected: - BOOL ReliefAddDot(D3DVECTOR pos, float scaleRelief); + bool ReliefAddDot(D3DVECTOR pos, float scaleRelief); void AdjustRelief(); D3DVECTOR RetVector(int x, int y); D3DVERTEX2 RetVertex(int x, int y, int step); - BOOL CreateMosaic(int ox, int oy, int step, int objRank, const D3DMATERIAL7 &mat, float min, float max); - BOOL CreateSquare(BOOL bMultiRes, int x, int y); + bool CreateMosaic(int ox, int oy, int step, int objRank, const D3DMATERIAL7 &mat, float min, float max); + bool CreateSquare(bool bMultiRes, int x, int y); TerrainMaterial* LevelSearchMat(int id); void LevelTextureName(int x, int y, char *name, FPOINT &uv); float LevelRetHeight(int x, int y); - BOOL LevelGetDot(int x, int y, float min, float max, float slope); + bool LevelGetDot(int x, int y, float min, float max, float slope); int LevelTestMat(char *mat); void LevelSetDot(int x, int y, int id, char *mat); - BOOL LevelIfDot(int x, int y, int id, char *mat); - BOOL LevelPutDot(int x, int y, int id); + bool LevelIfDot(int x, int y, int id, char *mat); + bool LevelPutDot(int x, int y, int id); void LevelOpenTable(); void LevelCloseTable(); @@ -181,8 +181,8 @@ protected: float* m_relief; // table of the relief int* m_texture; // table of textures int* m_objRank; // table of rows of objects - BOOL m_bMultiText; - BOOL m_bLevelText; + bool m_bMultiText; + bool m_bLevelText; float m_scaleMapping; // scale of the mapping float m_scaleRelief; int m_subdivMapping; diff --git a/src/graphics/common/water.cpp b/src/graphics/common/water.cpp index 5e7e21f..9ea01df 100644 --- a/src/graphics/common/water.cpp +++ b/src/graphics/common/water.cpp @@ -55,8 +55,8 @@ CWater::CWater(CInstanceManager* iMan, CD3DEngine* engine) m_type[0] = WATER_NULL; m_type[1] = WATER_NULL; m_level = 0.0f; - m_bDraw = TRUE; - m_bLava = FALSE; + m_bDraw = true; + m_bLava = false; m_color = 0xffffffff; m_subdiv = 4; m_filename[0] = 0; @@ -69,7 +69,7 @@ CWater::~CWater() } -BOOL CWater::EventProcess(const Event &event) +bool CWater::EventProcess(const Event &event) { if ( event.event == EVENT_FRAME ) { @@ -148,24 +148,24 @@ BOOL CWater::EventProcess(const Event &event) } #endif } - return TRUE; + return true; } // Makes water evolve. -BOOL CWater::EventFrame(const Event &event) +bool CWater::EventFrame(const Event &event) { - if ( m_engine->RetPause() ) return TRUE; + if ( m_engine->RetPause() ) return true; m_time += event.rTime; - if ( m_type[0] == WATER_NULL ) return TRUE; + if ( m_type[0] == WATER_NULL ) return true; if ( m_bLava ) { LavaFrame(event.rTime); } - return TRUE; + return true; } // Makes evolve the steam jets on the lava. @@ -202,7 +202,7 @@ void CWater::LavaFrame(float rTime) perp.z = dir.x; pos = pos + perp*shift; - level = m_terrain->RetFloorLevel(pos, TRUE); + level = m_terrain->RetFloorLevel(pos, true); if ( level < m_level ) { pos.y = m_level; @@ -241,13 +241,13 @@ void CWater::VaporFlush() for ( i=0 ; iPlay(SOUND_PSHHH, pos, 0.3f, 2.0f); } - return TRUE; + return true; } } - return FALSE; + return false; } // Makes evolve a steam jet, @@ -348,7 +348,7 @@ void CWater::VaporFrame(int i, float rTime) } else { - m_vapor[i].bUsed = FALSE; + m_vapor[i].bUsed = false; } } @@ -426,9 +426,9 @@ void CWater::DrawBack() m_engine->SetTexture("", 0); device = m_engine->RetD3DDevice(); - device->SetRenderState(D3DRENDERSTATE_LIGHTING, FALSE); - device->SetRenderState(D3DRENDERSTATE_ZENABLE, FALSE); - device->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE); + device->SetRenderState(D3DRENDERSTATE_LIGHTING, false); + device->SetRenderState(D3DRENDERSTATE_ZENABLE, false); + device->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false); m_engine->SetState(D3DSTATENORMAL); deep = m_engine->RetDeepView(0); @@ -472,9 +472,9 @@ void CWater::DrawBack() m_engine->SetFocus(m_engine->RetFocus()); m_engine->UpdateMatProj(); // gives the initial depth of view - device->SetRenderState(D3DRENDERSTATE_LIGHTING, TRUE); - device->SetRenderState(D3DRENDERSTATE_ZENABLE, TRUE); - device->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE); + device->SetRenderState(D3DRENDERSTATE_LIGHTING, true); + device->SetRenderState(D3DRENDERSTATE_ZENABLE, true); + device->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false); } // Draws the flat surface of the water. @@ -487,7 +487,7 @@ void CWater::DrawSurf() D3DMATRIX matrix; D3DVECTOR eye, lookat, n, pos, p; FPOINT uv1, uv2; - BOOL bUnder; + bool bUnder; DWORD flags; float deep, size, sizez, radius; int rankview, i, j, u; @@ -506,9 +506,9 @@ void CWater::DrawSurf() device = m_engine->RetD3DDevice(); //? device->SetRenderState(D3DRENDERSTATE_AMBIENT, 0xffffffff); -//? device->SetRenderState(D3DRENDERSTATE_LIGHTING, TRUE); -//? device->SetRenderState(D3DRENDERSTATE_ZENABLE, FALSE); - device->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE); +//? device->SetRenderState(D3DRENDERSTATE_LIGHTING, true); +//? device->SetRenderState(D3DRENDERSTATE_ZENABLE, false); + device->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false); D3DUtil_SetIdentityMatrix(matrix); device->SetTransform(D3DTRANSFORMSTATE_WORLD, &matrix); @@ -537,7 +537,7 @@ void CWater::DrawSurf() { m_engine->SetState(D3DSTATENORMAL); } - device->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE); + device->SetRenderState(D3DRENDERSTATE_FOGENABLE, true); size = m_size/2.0f; if ( bUnder ) sizez = -size; @@ -604,7 +604,7 @@ void CWater::DrawSurf() // Indicates if there is water in a given position. -BOOL CWater::RetWater(int x, int y) +bool CWater::RetWater(int x, int y) { D3DVECTOR pos; float size, offset, level; @@ -623,16 +623,16 @@ BOOL CWater::RetWater(int x, int y) pos.x = (x+dx)*size - offset; pos.z = (y+dy)*size - offset; pos.y = 0.0f; - level = m_terrain->RetFloorLevel(pos, TRUE); - if ( level < m_level+m_eddy.y ) return TRUE; + level = m_terrain->RetFloorLevel(pos, true); + if ( level < m_level+m_eddy.y ) return true; } } - return FALSE; + return false; } // Updates the positions, relative to the ground. -BOOL CWater::CreateLine(int x, int y, int len) +bool CWater::CreateLine(int x, int y, int len) { float offset; @@ -653,7 +653,7 @@ BOOL CWater::CreateLine(int x, int y, int len) // Creates all expanses of water. -BOOL CWater::Create(WaterType type1, WaterType type2, const char *filename, +bool CWater::Create(WaterType type1, WaterType type2, const char *filename, D3DCOLORVALUE diffuse, D3DCOLORVALUE ambient, float level, float glint, D3DVECTOR eddy) { @@ -688,7 +688,7 @@ BOOL CWater::Create(WaterType type1, WaterType type2, const char *filename, m_brick /= m_subdiv; m_size *= m_subdiv; - if ( m_type[0] == WATER_NULL ) return TRUE; + if ( m_type[0] == WATER_NULL ) return true; m_lineUsed = 0; for ( y=0 ; y= 5 ) { - if ( !CreateLine(x-len+1, y, len) ) return FALSE; + if ( !CreateLine(x-len+1, y, len) ) return false; len = 0; } } @@ -709,17 +709,17 @@ BOOL CWater::Create(WaterType type1, WaterType type2, const char *filename, { if ( len != 0 ) { - if ( !CreateLine(x-len, y, len) ) return FALSE; + if ( !CreateLine(x-len, y, len) ) return false; len = 0; } } } if ( len != 0 ) { - if ( !CreateLine(x-len, y, len) ) return FALSE; + if ( !CreateLine(x-len, y, len) ) return false; } } - return TRUE; + return true; } // Removes all the water. @@ -729,13 +729,13 @@ void CWater::Flush() m_type[0] = WATER_NULL; m_type[1] = WATER_NULL; m_level = 0.0f; - m_bLava = FALSE; + m_bLava = false; } // Changes the level of the water. -BOOL CWater::SetLevel(float level) +bool CWater::SetLevel(float level) { m_level = level; @@ -801,12 +801,12 @@ float CWater::RetLevel(CObject* object) // Management of the mode of lava/water. -void CWater::SetLava(BOOL bLava) +void CWater::SetLava(bool bLava) { m_bLava = bLava; } -BOOL CWater::RetLava() +bool CWater::RetLava() { return m_bLava; } diff --git a/src/graphics/common/water.h b/src/graphics/common/water.h index 959b12f..c0593a0 100644 --- a/src/graphics/common/water.h +++ b/src/graphics/common/water.h @@ -44,7 +44,7 @@ WaterLine; typedef struct { - BOOL bUsed; + bool bUsed; ParticuleType type; D3DVECTOR pos; float delay; @@ -71,30 +71,30 @@ public: ~CWater(); void SetD3DDevice(LPDIRECT3DDEVICE7 device); - BOOL EventProcess(const Event &event); + bool EventProcess(const Event &event); void Flush(); - BOOL Create(WaterType type1, WaterType type2, const char *filename, D3DCOLORVALUE diffuse, D3DCOLORVALUE ambient, float level, float glint, D3DVECTOR eddy); + bool Create(WaterType type1, WaterType type2, const char *filename, D3DCOLORVALUE diffuse, D3DCOLORVALUE ambient, float level, float glint, D3DVECTOR eddy); void DrawBack(); void DrawSurf(); - BOOL SetLevel(float level); + bool SetLevel(float level); float RetLevel(); float RetLevel(CObject* object); - void SetLava(BOOL bLava); - BOOL RetLava(); + void SetLava(bool bLava); + bool RetLava(); void AdjustEye(D3DVECTOR &eye); protected: - BOOL EventFrame(const Event &event); + bool EventFrame(const Event &event); void LavaFrame(float rTime); void AdjustLevel(D3DVECTOR &pos, D3DVECTOR &norm, FPOINT &uv1, FPOINT &uv2); - BOOL RetWater(int x, int y); - BOOL CreateLine(int x, int y, int len); + bool RetWater(int x, int y); + bool CreateLine(int x, int y, int len); void VaporFlush(); - BOOL VaporCreate(ParticuleType type, D3DVECTOR pos, float delay); + bool VaporCreate(ParticuleType type, D3DVECTOR pos, float delay); void VaporFrame(int i, float rTime); protected: @@ -124,8 +124,8 @@ protected: WaterVapor m_vapor[MAXWATVAPOR]; - BOOL m_bDraw; - BOOL m_bLava; + bool m_bDraw; + bool m_bLava; D3DCOLOR m_color; }; -- cgit v1.2.3-1-g7c22