
Ok, I would probably be alright releasing the full docs, especially since all my changes are inclosed in //LAC+++ and //LAC---, but just to cut to the chase, here ya go.  Remember, this is just a preliminary release, and I'll provide much more info in the next version (and it'll be HTML-ized, etc).  A lot of the //FIXME's will be fleshed out, and it will be quite a bit more optimized (e.g. no matrix calc's, etc).

Notes:
1) "+" denotes the lines I've added.  I've also listed here a few lines of surrounding code for reference.  Of course, I enclosed my changes in //LAC+++ and //LAC--- anyway, so I guess the +'s are moot. ;)
2) Line numbers assume "vanilla" code.  For multiple changes in the same file, line numbers assume you added these changes in the order that they appear here.

Start your engines....

----------------------------------------
RiotClientShell.h
----------------------------------------
At line 36, at the end of the #include set...

---8<--- begin ------
  ...
  #include "InfoDisplay.h"
  #include "LightScaleMgr.h"

+ //LAC+++ Reticle
+ #include "cReticle.h"
+ //LAC--- Reticle
+
  // These 
  #define CS_MFLG_FORWARD			(1<<0)
  #define CS_MFLG_REVERSE			(1<<1)
  ...
---8<--- end ------

Then at line 665, at the end of class CRiotClientShell...

---8<--- begin ------
    ...
    void	CreateBoundingBox();
    void	UpdateBoundingBox();
+
+ //LAC+++ Reticle
+ private :
+   DFLOAT			m_fRoll;			// Roll of camera
+
+ public :
+   DFLOAT			GetYaw()			const { return m_fYaw; }
+   DFLOAT			GetPitch()			const { return m_fPitch; }
+   DFLOAT			GetCamCant()			const { return m_fCamCant; }
+   DFLOAT			GetRoll()			const { return m_fRoll; }
+
+   cReticle		*m_hReticle;
+ //LAC--- Reticle
  };

  #endif  // __RIOTCLIENTSHELL_H__
---8<--- end ------


----------------------------------------
RiotClientShell.cpp
----------------------------------------
Line 440, at the end of CRiotClientShell::CRiotClientShell()...

---8<--- begin ------
    m_bPlayerPosSet			= DFALSE;
+
+   //LAC+++ Reticle 
+   m_hReticle				= NULL;
+   m_fRoll					= 0.0f;
+   //LAC--- Reticle 
  }


  // ----------------------------------------------------------------------- //
  //
  //	ROUTINE:	CRiotClientShell::~CRiotClientShell()
  ...
---8<--- end ------

Then here's the longest change to an existing file:  At line 1844, in CRiotClientShell::PostUpdate(), just before the call to pClientDE->FlipScreen()...

---8<--- begin ------
  ...
  if (m_bGameOver && m_nGameState == GS_PLAYING)
  {
    UpdateGameOver();
  }

+ //LAC+++ Reticle
+ static float LastKeyPress=0;
+
+ // Time of the current keypress (in Seconds)
+ float CurrentTime;
+
+ // Test for reticle activation
+ if (pClientDE->IsCommandOn(COMMAND_TRACKING_RETICLE_TOGGLE))
+ {
+   CurrentTime = pClientDE->GetTime(); 
+   if ((CurrentTime - LastKeyPress) > KEYPAUSERATE)
+   {
+     if (DNULL == m_hReticle)
+     {
+       m_hReticle = new cReticle();
+
+       Anim_t anims[] = 
+       {
+         {12, 12, 5, {0.3f, 0.5f, 0.2f, 0.7f, 1.2f}},
+         {40, 10, 2, {0.3f, 1.7f}},
+         {50, 50, 3, {0.1f, 0.1f, 0.1f}}
+       };
+
+       m_hReticle->Init("interface//hud//reticle.pcx",
+         pClientDE->GetScreenSurface(),
+         3, anims);
+     }
+     else
+     {
+       delete m_hReticle;
+       m_hReticle = DNULL;
+     }
+
+     LastKeyPress = pClientDE->GetTime();
+   }
+ }
+
+ // Test for reticle mode change (this should actually be done elsewhere)
+ if (DNULL != m_hReticle)
+ {
+   if (pClientDE->IsCommandOn(COMMAND_TRACKING_RETICLE_PREVMODE))
+   {
+     CurrentTime = pClientDE->GetTime(); 
+     if ((CurrentTime - LastKeyPress) > KEYPAUSERATE)
+     {
+       m_hReticle->PrevMode();
+       LastKeyPress = pClientDE->GetTime();
+     }
+   }
+
+   if (pClientDE->IsCommandOn(COMMAND_TRACKING_RETICLE_NEXTMODE))
+   {
+     CurrentTime = pClientDE->GetTime(); 
+     if ((CurrentTime - LastKeyPress) > KEYPAUSERATE)
+     {
+       m_hReticle->NextMode();
+       LastKeyPress = pClientDE->GetTime();
+     }
+   }
+ }
+
+ // FIXME: Uncomment the last part of this to make the crosshair
+ // visible ONLY in 1st person view
+ if (DNULL != m_hReticle) // && m_playerCamera.IsFirstPerson())
+ {
+   m_hReticle->Render();
+ }
+ //LAC--- Reticle
+
  pClientDE->FlipScreen (FLIPSCREEN_CANDRAWCONSOLE);
  ...
---8<--- end ------

And now, just to add some camera Z rotation, put this at line 2841, in CRiotClientShell::UpdateCameraRotation() -- (** Be careful to notie that one line from the original code has been commented out)...

---8<--- begin ------
  ...
  else if (m_playerCamera.IsFirstPerson())
  {
+   //LAC+++ Reticle
+   if (pClientDE->IsCommandOn(COMMAND_ROLL_LEFT))
+   {
+     m_fRoll += MATH_PI / 10;
+   }
+   else if (pClientDE->IsCommandOn(COMMAND_ROLL_RIGHT))
+   {
+     m_fRoll -= MATH_PI / 10;
+   }
+
+   //Old line:
+   //pClientDE->SetupEuler(&m_rRotation, m_fPitch, m_fYaw, m_fCamCant);
+   pClientDE->SetupEuler(&m_rRotation, m_fPitch, m_fYaw, m_fCamCant + m_fRoll);
+   //LAC--- Reticle
+
    pClientDE->SetObjectRotation(m_hCamera, &m_rRotation);
  }
  else
  ...
---8<--- end ------


----------------------------------------
WeaponFX.cpp
----------------------------------------
Just to give a position to track (still working on tracking objects from the server), put this at line 2996, at the end of CWeaponFX::CreateSniperRifleFX()...

---8<--- begin ------
    ...
    CSpecialFX* pFX = psfxMgr->CreateSFX(SFX_DEBRIS_ID, &debris);
    if (pFX) pFX->Update();
+
+   //LAC+++ Reticle
+   if (DNULL != g_pRiotClientShell->m_hReticle)
+   {
+     g_pRiotClientShell->m_hReticle->SetTargetPos(&m_vPos);
+   }
+   //LAC--- Reticle
  }

  // ----------------------------------------------------------------------- //
  //
  //	ROUTINE:	CWeaponFX::CreateTOWFX
  ...
---8<--- end ------


----------------------------------------
..\Shared\RiotCommandIDs.h
----------------------------------------
Ok, and now we need to #define our new commands.  Put this at line 76, at the end of the file...

---8<--- begin ------
   ...
  #define CHEAT_ID_FLASHLIGHT			48
+
+ //LAC+++ Reticle
+ #define COMMAND_TRACKING_RETICLE_TOGGLE      64
+ #define COMMAND_ROLL_LEFT                    65
+ #define COMMAND_ROLL_RIGHT                   66
+ #define COMMAND_TRACKING_RETICLE_PREVMODE    22
+ #define COMMAND_TRACKING_RETICLE_NEXTMODE    23
+ //LAC--- Reticle

  #endif // __RIOT_COMMAND_IDS_H__
  ...
---8<--- end ------


Now just add cReticle.cpp to your project and be sure that cReticle.h is in your INCLUDE path, compile, and read the readme.txt for autoexec.cfg settings, etc.

Enjoy!  And email me with any questions/improvements.  I hope to have some time during the holidays to work a bit on making this more informative.
--------------------------------------------------------------------------------
Allan "Geist" Campbell
<geist@mindspring.com>
GreyShades
Coder/Modeler for the (Shogo) Macross TC
(http://www.planetshogo.com/macross)
