Files
firestorm/Gameleap/code/mw4/Code/MW4/huddamage.cpp
T
dicion af416960fa Translate Korean comments/strings to English; fix UTF-8 encoding across source tree
Korean translation (84 source files, 876 lines):
- Translated all EUC-KR/CP949 Korean developer comments to English across
  84 source files in Gameleap/code/. Zero Korean bytes remain outside the
  intentional font-table headers (D3FFontEdit2/fontedit all.h etc.).
- Comment markers: //상훈 앞/뒤 -> //sanghoon begin/end (Sang-hun's code
  region markers); //상훈짱 begin/end, //상훈.. variants; // 鉉 -> // hyun
  (second developer's markers); // 鉉 - start/end patterns.
- Functional string translations in recscore.cpp (mw4 + mw4print copies):
  body-part return values (왼발/오른발/etc. -> Left Leg/Right Leg/etc.),
  kill-announcer format strings (~30 entries), and the nonmfc.h assert dialog.
- GosView profiler: 킪 -> us (microseconds) in timing display strings.
- Network/socket code (ctcl.cpp, mugsocs.h, ctime.cpp across Launcher/
  MW4Application/MW4GameEd2/AnimScript): state-machine comments, socket
  ID comments, login/session management comments.
- render.hpp CHSH_Device member comments; GUIRadarManager.cpp drawing
  routine comments; hudchat/hudcomp2/huddamage/hudmap/hudweapon/hudtarg
  HUD component comments.
- DXRasterizer.cpp: cleaned residual U+FFFD replacement characters left
  from a prior partial encoding conversion.

UTF-8 encoding cleanup (76+ files):
- Latin-1 single bytes converted to proper UTF-8 multi-byte sequences:
  © (0xA9) in 3dsmax4/Maxscrpt Autodesk/Wainwright copyright headers,
  ® (0xAE) in gosHelp/Remote.cpp, · (0xB7) bullet points in ai command.hpp,
  Û (0xDB) in SafeChain_Test.cpp tool header,
  ß (0xDF) in AnimationSuite version strings (8 files).
- Font lookup tables (D3FFontEdit2/, fontedit/ *.h) intentionally left
  as-is: raw byte values are C array data, not text.

Language DLL:
- Replaced Gameleap/mw4/Language.dll (original Korean binary) and
  MW4/Language.dll with freshly built English version from
  Language - Win32 English config (Language.dsp). Fixes Korean button
  labels in the GameOS exception/crash dialog (??? ??... / ?? / ???
  were showing instead of More Details.../Continue/Exit).
2026-07-18 13:10:31 -05:00

2263 lines
78 KiB
C++

#include "MW4Headers.hpp"
#include "hudcomp.hpp"
#include "hudcomp2.hpp"
#include "huddamage.hpp"
#include "vehicle.hpp"
#include "mech.hpp"
#include "mechlabheaders.h"
#include "weapon.hpp"
#include "mwapplication.hpp"
#include "..\missionlang\resource.h"
//sanghoon begin
#include <windows.h>
#include <ddraw.h>
#include <d3d.h>
#include <GameOS\render.hpp>
extern bool g_bCOOP;
// MSL 5.02
extern float texuv2[LastMechID+1][11][4];
extern int offset2[LastMechID+1][11][2];
extern float texuv3[LastMechID+1][11][4];
extern int offset3[LastMechID+1][11][2];
bool g_bMuteMode = false;
bool g_bJumpZoom = true;
bool g_bZoomMode = true;
bool g_bJumpMode = false;
bool g_bFlushMode = false;
bool g_bLightAmpMode = false;
bool g_bNextTargetMode = false;
bool g_bCrossTargetMode = false;
// MSL 5.03 Secondary Damage Display
int g_nAuxilMode = 0;
//sanghoon end
using namespace MechWarrior4;
namespace HUDDAMAGE
{
const int YOUR_BARHEIGHT = 90;
const int YOUR_BARWIDTH = 10;
const int TARGET_BARHEIGHT = 90;
const int TARGET_BARWIDTH = 10;
const int MAX_FLASH = 10;
// MSL 5.05 Fix the S1 and S2 swap issue
const int trans_array[12] = {
8,5,6,4,2,3,1,0,9,10,7,11
};
// MSL ADD MECH
const char *texturename[LastMechID+1] = {
"hud\\annihilator",
"hud\\archer",
"hud\\arcticwolf",
"hud\\ares",
"hud\\argus",
"hud\\assassin2",
"hud\\atlas",
"hud\\avatar",
"hud\\awesome",
"hud\\battlemaster",
"hud\\battlemasteriic",
"hud\\behemoth",
"hud\\behemothii",
"hud\\blackhawk",
"hud\\blackknight",
"hud\\blacklanner",
"hud\\brigand",
"hud\\bushwacker",
"hud\\catapult",
"hud\\cauldronborn",
"hud\\chimera",
"hud\\commando",
"hud\\cougar",
"hud\\cyclops",
"hud\\daishi",
// "hud\\dasher",
"hud\\deimos",
"hud\\dragon",
"hud\\fafnir",
"hud\\flea",
"hud\\gladiator",
"hud\\grizzly",
"hud\\hauptmann",
"hud\\hellhound",
"hud\\hellspawn",
"hud\\highlander",
"hud\\hollanderii",
"hud\\hunchback",
"hud\\kodiak",
"hud\\loki",
"hud\\longbow",
"hud\\madcat",
"hud\\madcat2",
"hud\\masakari",
"hud\\mauler",
"hud\\novacat",
"hud\\osiris",
"hud\\owens",
"hud\\puma",
"hud\\raven",
"hud\\rifleman",
"hud\\ryoken",
"hud\\shadowcat",
"hud\\solitaire",
"hud\\sunder",
"hud\\templar",
"hud\\thanatos",
"hud\\thor",
"hud\\uller",
"hud\\urbanmech",
"hud\\uziel",
"hud\\victor",
"hud\\vulture",
"hud\\warhammer",
"hud\\wolfhound",
"hud\\zeus"
};
// left leg 0
// right leg 1
// left arm 2
// right arm 3
// right torso 4
// left torso 5
// center torso 6
// center torso reat 7
// head 8
// special 1 9
// special 2 10
// MSL ADD MECH
const Scalar texuv[LastMechID+1][11][4] = {
{ {62,52, 79,112},{32,52,49,112},{ 79, 8, 98,56},{19, 8,31,54},{33,13, 50,43},{62,13,78,43},{104,16,125,69},{0,0,0,0},{53,8,59,13},{0,0,0,0},{0,0,0,0}}, // M_Annihilator
{ {65,57, 86,117},{23,57,44,117},{ 88,56,103,80},{ 5,56,20,80},{18,13, 47,54},{61,13,90,54},{47,17,61,69},{0,0,0,0},{51,5,57,13},{0,0,0,0},{0,0,0,0}}, // M_Archer
{ {70,60, 95,114},{19,60,44,114},{ 84,44,107,61},{ 6,44,29,61},{22,26, 42,49},{70,26,90,49},{45,23,69,72},{0,0,0,0},{52,18,56,20},{71,7,96,22},{17,7,42,22}}, // M_Arctic Wolf
{ {59,63, 89,126},{23,63,53,126},{ 80,26, 96,57},{16,26,32,57},{34,13, 55,47},{57,13,78,47},{103,20,125,59},{0,0,0,0},{52,8,60,11},{81,6,100,24},{12,6,31,24}}, // M_Ares
{ {60,49, 96,113},{17,49,53,113},{ 74, 8,105,42},{18,10,38,36},{40,10, 50,39},{61,10,72,39},{96,49,113,108},{0,0,0,0},{54,1.001f,59,5},{0,0,0,0},{0,0,0,0}}, // M_Argus
{ {59,63, 89,126},{23,63,53,126},{ 80,26, 96,57},{16,26,32,57},{34,13, 55,47},{57,13,78,47},{103,20,125,59},{0,0,0,0},{52,8,60,11},{81,6,100,24},{0,0,0,0}}, // M_Assassin2
{ {58,51, 75,115},{37,51,54,115},{ 73,11, 92,51},{20,11,39,51},{42,15, 50,48},{62,15,70,48},{2,8,18,66},{0,0,0,0},{48,3,54,6},{97,37,103,43},{84,65,91,84}}, // M_Atlas
{ {60,45, 95,114},{20,45,55,114},{ 78,28, 97,44},{18,28,37,44},{38, 9, 50,42},{65,9,77,42},{52,7,63,45},{0,0,0,0},{55,1.001f,60,6},{99,43,126,56},{0,0,0,0}}, // M_Avatar
{ {62,52, 79,112},{32,52,49,112},{ 79, 8, 98,56},{19, 8,31,54},{33,13, 50,43},{62,13,78,43},{104,16,125,69},{0,0,0,0},{53,8,59,13},{0,0,0,0},{0,0,0,0}}, // M_Awesome
{ {58,51, 75,115},{37,51,54,115},{ 73,11, 92,51},{20,11,39,51},{42,15, 50,48},{62,15,70,48},{2,8,18,66},{0,0,0,0},{48,3,54,6},{97,37,103,43},{84,65,91,84}}, // M_Battlemaster
{ {58,51, 75,115},{37,51,54,115},{ 73,11, 92,51},{20,11,39,51},{42,15, 50,48},{62,15,70,48},{2,8,18,66},{0,0,0,0},{48,3,54,6},{97,37,103,43},{0,0,0,0}}, // M_Battlemasteriic
{ {62,59, 81,125},{34,59,53,125},{ 83, 9,108,54},{ 6, 6,34,54},{37,17, 49,47},{67,17,79,47},{51,6,64,58},{0,0,0,0},{70,10,77,13},{7,71,25,110},{0,0,0,0}}, // M_Behemoth
{ {62,59, 81,125},{34,59,53,125},{ 83, 9,108,54},{ 6, 6,34,54},{37,17, 49,47},{67,17,79,47},{51,6,64,58},{0,0,0,0},{70,10,77,13},{7,71,25,110},{0,0,0,0}}, // M_BehemothII
{ {59,63, 89,126},{23,63,53,126},{ 80,26, 96,57},{16,26,32,57},{34,13, 55,47},{57,13,78,47},{103,20,125,59},{0,0,0,0},{52,8,60,11},{81,6,100,24},{12,6,31,24}}, // M_Blackhawk
{ {62,59, 81,125},{34,59,53,125},{ 83, 9,108,54},{ 6, 6,34,54},{37,17, 49,47},{67,17,79,47},{51,6,64,58},{0,0,0,0},{70,10,77,13},{7,71,25,110},{0,0,0,0}}, // M_blackknight
{ {59,63, 89,126},{23,63,53,126},{ 80,26, 96,57},{16,26,32,57},{34,13, 55,47},{57,13,78,47},{103,20,125,59},{0,0,0,0},{52,8,60,11},{81,6,100,24},{12,6,31,24}}, // M_blacklanner
{ {59,63, 89,126},{23,63,53,126},{ 80,26, 96,57},{16,26,32,57},{34,13, 55,47},{57,13,78,47},{103,20,125,59},{0,0,0,0},{52,8,60,11},{81,6,100,24},{12,6,31,24}}, // M_Brigand
{ {59,61, 89,127},{21,61,52,127},{ 77,30,102,57},{ 8,27,34,58},{36,14, 55,39},{56,11,75,39},{106,21,126,54},{0,0,0,0},{52,5,59,9},{79,2,95,15},{0,0,0,0}}, // M_Bushwacker
{ {62,66, 95,124},{17,66,51,124},{ 77,10,108,41},{ 6,10,35,41},{38,32, 50,64},{64,32,74,64},{51,28,62,71},{0,0,0,0},{53,21,60,26},{0,0,0,0},{0,0,0,0}}, // M_Catapult
{ {78,59,108,123},{18,59,49,123},{ 94,25,126,47},{ 4,31,36,53},{36, 9, 57,34},{79,15,91,40},{54,29,78,66},{0,0,0,0},{64,4,71,7},{95,4,113,21},{10,3,30,23}}, // M_CauldronBorn
{ {58,56, 89,127},{22,56,53,127},{ 89,26,107,45},{ 8,28,23,46},{92,57,120,86},{67,12,86,35},{46,7,67,55},{0,0,0,0},{60,3,66,6},{0,0,0,0},{0,0,0,0}}, // M_Chimera
{ {57,45, 91,110},{21,45,50,110},{ 90,23,105,57},{ 9,23,22,57},{24,11, 45,42},{67,11,88,42},{108,6,126,57},{0,0,0,0},{52,0,60,4},{0,0,0,0},{0,0,0,0}}, // M_Commando
{ {57,45, 91,110},{21,45,50,110},{ 90,23,105,57},{ 9,23,22,57},{24,11, 45,42},{67,11,88,42},{108,6,126,57},{0,0,0,0},{52,0,60,4},{0,0,0,0},{0,0,0,0}}, // M_Cougar
{ {79,58,104,116},{20,58,45,116},{ 98,19,114,55},{ 8,19,24,55},{27,25, 41,55},{80,23,95,55},{51,16,74,74},{0,0,0,0},{58,9,67,11},{34,8,47,20},{0,0,0,0}}, // M_Cyclops
{ {61,53,100,111},{10,53,49,111},{ 79,17, 94,50},{16,17,31,50},{34,12, 54,51},{56,12,76,51},{103,21,125,65},{0,0,0,0},{52,5,59,11},{103,5,124,14},{0,0,0,0}}, // M_Daishi
// { {57,45, 91,110},{21,45,50,110},{ 90,23,105,57},{ 9,23,22,57},{24,11, 45,42},{67,11,88,42},{108,6,126,57},{0,0,0,0},{52,0,60,4},{0,0,0,0},{0,0,0,0}}, // M_Dasher
{ {59,63, 89,126},{23,63,53,126},{ 80,26, 96,57},{16,26,32,57},{34,13, 55,47},{57,13,78,47},{103,20,125,59},{0,0,0,0},{52,8,60,11},{81,6,100,24},{12,6,31,24}}, // M_Deimos
{ {79,49,100,115},{28,49,49,115},{108,26,124,49},{ 4,24,22,45},{27,11, 49,37},{79,11,100,37},{54,14,74,62},{0,0,0,0},{59,5,69,10},{0,0,0,0},{0,0,0,0}}, // M_Dragon
{ {77,64,102,123},{34,64,59,123},{109,12,123,45},{10,12,24,45},{28,13, 55,53},{79,13,106,53},{57,13,78,74},{0,0,0,0},{54,5,61,8},{0,0,0,0},{0,0,0,0}}, // M_Fafnir
{ {93,54,119,119},{ 6,54,32,119},{110,29,115,36},{ 6,29,11,36},{33,16, 50,38},{59,16,76,38},{45,54,64,100},{0,0,0,0},{51,5,58,8},{0,0,0,0},{0,0,0,0}}, // M_Flea
{ {62,65, 79,117},{27,65,44,117},{ 85,29,101,59},{ 6,28,20,60},{29,26, 39,61},{67,26,77,61},{42,11,64,76},{0,0,0,0},{68,14,77,19},{0,0,0,0},{0,0,0,0}}, // M_Gladiator
{ {79,58,104,116},{20,58,45,116},{ 98,19,114,55},{ 8,19,24,55},{27,25, 41,55},{80,23,95,55},{51,16,74,74},{0,0,0,0},{58,9,67,11},{34,8,47,20},{0,0,0,0}}, // M_Grizzly
{ {79,58,104,116},{20,58,45,116},{ 98,19,114,55},{ 8,19,24,55},{27,25, 41,55},{80,23,95,55},{51,16,74,74},{0,0,0,0},{58,9,67,11},{34,8,47,20},{0,0,0,0}}, // M_Hauptmann
{ {55,48, 84,106},{23,48,52,106},{ 97,30,114,47},{ 8,30,25,47},{31,13, 47,46},{77,14,93,47},{94,58,109,97},{0,0,0,0},{50,6,57,9},{0,0,0,0},{0,0,0,0}}, // M_Hellhound
{ {66,62, 84,126},{30,62,48,126},{ 79,25, 97,54},{18,25,35,54},{37,19, 56,44},{58,23,77,43},{47,47,67,61},{0,0,0,0},{60,18,66,23},{43,1.001f,57,16},{20,8,37,23}}, // M_Hellspawn
{ {85,60,105,124},{24,61,44,125},{104,23,123,48},{ 3,21,23,49},{25, 9, 52,46},{75,8,100,45},{55,5,72,66},{0,0,0,0},{79,3,90,6},{0,0,0,0},{0,0,0,0}}, // M_Highlander
{ {59,63, 89,126},{23,63,53,126},{ 80,26, 96,57},{16,26,32,57},{34,13, 55,47},{57,13,78,47},{103,20,125,59},{0,0,0,0},{52,8,60,11},{81,6,100,24},{12,6,31,24}}, // M_HollanderII
{ {70,55, 92,112},{23,55,45,112},{109,16,124,47},{ 2,16,17,47},{ 6,55, 18,76},{92,5,104,49},{45,9,68,66},{0,0,0,0},{55,3,61,5},{22,9,38,30},{0,0,0,0}}, // M_Hunchback
{ {82,66,108,119},{ 8,66,34,119},{ 95,11,117,38},{ 4,26,26,53},{32,16, 51,51},{67,16,86,51},{41,58,74,119},{0,0,0,0},{54,6,61,9},{0,0,0,0},{0,0,0,0}}, // M_Kodiak
{ {64,52, 81,114},{32,52,49,114},{ 77,23, 95,52},{20,23,36,52},{38,18, 48,47},{65,13,75,47},{50,16,64,64},{0,0,0,0},{54,10,59,14},{36,7,48,16},{0,0,0,0}}, // M_Loki
{ {76,55, 96,119},{31,55,51,119},{102,18,126,42},{ 2,18,26,42},{28,15, 48,46},{78,15,98,46},{52,11,73,65},{0,0,0,0},{76,5,85,8},{0,0,0,0},{0,0,0,0}}, // M_Longbow
{ {59,63, 89,126},{23,63,53,126},{ 80,26, 96,57},{16,26,32,57},{34,13, 55,47},{57,13,78,47},{103,20,125,59},{0,0,0,0},{52,8,60,11},{81,6,100,24},{12,6,31,24}}, // M_Madcat
{ {67,53, 98,111},{16,53,47,111},{ 75,34, 95,51},{19,34,39,51},{40,15, 56,50},{58,15,74,50},{47,66,67,109},{0,0,0,0},{53,9,61,13},{19,4,36,25},{78,4,95,25}}, // M_Madcat_MKII
{ {75,51,120,114},{ 8,51,53,114},{ 99,10,126,43},{ 2,10,29,43},{41,15, 55,49},{73,15,87,49},{56,15,72,66},{0,0,0,0},{58,6,70,10},{0,0,0,0},{0,0,0,0}}, // M_Masakari
{ {67,56, 87,112},{24,56,44,112},{ 84, 7,100,54},{11, 7,27,54},{31, 5, 51,52},{60,5,80,52},{47,58,64,101},{0,0,0,0},{52,11,59,15},{0,0,0,0},{0,0,0,0}}, // M_Mauler
{ {62,63, 84,128},{29,63,51,128},{ 79,11,101,49},{12,11,34,49},{35,16, 47,44},{66,16,78,44},{48,11,65,62},{0,0,0,0},{52,4,61,7},{0,0,0,0},{0,0,0,0}}, // M_Novacat
{ {66,63, 85,124},{27,63,46,124},{ 84,17, 98,40},{15,23,28,38},{30,17, 43,46},{69,17,82,46},{45,14,67,57},{0,0,0,0},{53,8,59,12},{8,4,24,11},{48,59,64,66}}, // M_Osiris
{ {75,54,104,112},{21,54,50,112},{ 97,17,120,45},{ 5,17,28,45},{30,29, 47,50},{78,29,95,50},{50,12,75,62},{0,0,0,0},{33,17,45,19},{0,0,0,0},{0,0,0,0}}, // M_Owens
{ {74,54,110,119},{14,54,50,119},{103, 5,123,45},{ 2, 5,22,45},{26, 5, 45,35},{79,5,98,35},{49,5,74,50},{0,0,0,0},{56,59,68,65},{0,0,0,0},{0,0,0,0}}, // M_Puma
{ {67,45, 90,114},{23,45,46,114},{ 79, 7, 99,31},{13, 7,33,22},{36,11, 56,42},{57,11,77,42},{46,66,67,111},{0,0,0,0},{54,4,59,9},{0,0,0,0},{0,0,0,0}}, // M_Raven
{ {59,63, 89,126},{23,63,53,126},{ 80,26, 96,57},{16,26,32,57},{34,13, 55,47},{57,13,78,47},{103,20,125,59},{0,0,0,0},{52,8,60,11},{81,6,100,24},{12,6,31,24}}, // M_Rifleman
{ {54,57, 83,125},{21,57,50,125},{ 77,14, 97,52},{17,14,37,52},{39,15, 56,41},{58,15,75,41},{87,60,123,103},{0,0,0,0},{53,7,61,11},{0,0,0,0},{0,0,0,0}}, // M_Ryoken
{ {67,42,103,114},{11,42,47,114},{ 79,21,104,40},{ 9,21,35,40},{37, 7, 49,39},{65,10,77,39},{47,52,67,106},{0,0,0,0},{54,2,60,5},{0,0,0,0},{0,0,0,0}}, // M_Shadowcat
{ {79,58,104,116},{20,58,45,116},{ 98,19,114,55},{ 8,19,24,55},{27,25, 41,55},{80,23,95,55},{51,16,74,74},{0,0,0,0},{58,9,67,11},{34,8,47,20},{0,0,0,0}}, // M_Solitaire
{ {70,50, 90,117},{23,50,43,117},{102,22,122,43},{ 5,22,25,43},{28, 8, 43,42},{70,8,85,42},{46,5,67,62},{0,0,0,0},{90,8,97,11},{0,0,0,0},{0,0,0,0}}, // M_Sunder
{ {65,57, 86,117},{23,57,44,117},{ 88,56,103,80},{ 5,56,20,80},{18,13, 47,54},{61,13,90,54},{47,17,61,69},{0,0,0,0},{51,5,57,13},{0,0,0,0},{0,0,0,0}}, // M_Templar
{ {64,48, 84,115},{31,48,51,115},{ 84,12,104,44},{11,12,31,44},{33, 8, 51,43},{65,8,82,43},{52,7,64,65},{0,0,0,0},{56,1.001f,60,6},{0,0,0,0},{0,0,0,0}}, // M_Thanatos
{ {64,51, 81,113},{32,51,49,113},{ 78,22, 96,51},{19,22,35,51},{37,17, 50,44},{64,22,76,44},{99,20,114,64},{0,0,0,0},{41,11,48,16},{62,6,77,20},{0,0,0,0}}, // M_Thor
{ {60,54, 96,126},{18,54,54,126},{101,21,126,54},{ 3,22,34,58},{37,10, 56,34},{80,9,99,33},{58,17,78,52},{0,0,0,0},{64,10,72,13},{0,0,0,0},{0,0,0,0}}, // M_Uller
{ {60,54, 96,126},{18,54,54,126},{101,21,126,54},{ 3,22,34,58},{37,10, 56,34},{80,9,99,33},{58,17,78,52},{0,0,0,0},{64,10,72,13},{0,0,0,0},{0,0,0,0}}, // M_Urbanmech
{ {69,52, 96,114},{17,52,44,114},{ 88,10,109,41},{ 6,10,25,49},{30, 9, 46,49},{69,9,83,49},{46,11,69,47},{0,0,0,0},{53,2,61,6},{46,48,67,72},{0,0,0,0}}, // M_Uziel
{ {75,54, 95,118},{31,54,51,118},{ 99,58,116,91},{11,59,28,82},{18,16, 44,48},{81,16,107,48},{49,6,77,67},{0,0,0,0},{34,7,42,12},{0,0,0,0},{0,0,0,0}}, // M_Victor
{ {60,45, 95,114},{20,45,55,114},{ 78,28, 97,44},{18,28,37,44},{38, 9, 50,42},{65,9,77,42},{52,7,63,45},{0,0,0,0},{55,1.001f,60,6},{99,43,126,56},{0,0,0,0}}, // M_Vulture
{ {59,63, 89,126},{23,63,53,126},{ 80,26, 96,57},{16,26,32,57},{34,13, 55,47},{57,13,78,47},{103,20,125,59},{0,0,0,0},{52,8,60,11},{81,6,100,24},{12,6,31,24}}, // M_Warhammer
{ {66,55, 79,116},{34,55,47,116},{ 90,14,103,50},{ 8,15,25,53},{31,21, 41,47},{72,21,82,47},{46,8,66,71},{0,0,0,0},{72,14,80,16},{0,0,0,0},{0,0,0,0}}, // M_Wolfhound
{ {78,53,101,114},{20,53,43,114},{106,47,121,70},{ 2,48,17,66},{ 7, 9, 33,43},{84,9,110,43},{42,4,71,63},{0,0,0,0},{75,13,82,17},{0,0,0,0},{0,0,0,0}} // M_Zeus
};
// MSL ADD MECH
const int offset[LastMechID+1][11][2] = {
{ {62,52},{32,52},{78, 8},{20, 8},{33,13},{62,13},{46,16},{0,0},{53,20},{ 0, 0},{ 0, 0}}, // M_Annihilator
{ {62,53},{33,53},{84,36},{17,36},{22, 9},{65, 9},{51,13},{0,0},{55,19},{ 0, 0},{ 0, 0}}, // M_Archer
{ {70,56},{19,56},{75,33},{15,33},{28,22},{65,22},{45,19},{0,0},{52,21},{67,11},{21,11}}, // M_Arctic Wolf
{ {58,49},{24,49},{80,26},{16,26},{34,13},{57,13},{45,20},{0,0},{52,23},{72, 6},{21, 6}}, // M_Ares
{ {60,49},{17,49},{74, 8},{18,10},{40,10},{61,10},{48, 6},{0,0},{54,13},{ 0, 0},{ 0, 0}}, // M_Argus
{ {58,49},{24,49},{80,26},{16,26},{34,13},{57,13},{45,20},{0,0},{52,23},{72, 6},{ 0, 0}}, // M_Assassin2
{ {58,51},{37,51},{72,11},{21,11},{42,15},{62,15},{49, 8},{0,0},{48,13},{39,37},{69,50}}, // M_Atlas
{ {60,45},{20,45},{78,28},{18,28},{38, 9},{65, 9},{52, 7},{0,0},{55, 4},{44,43},{ 0, 0}}, // M_Avatar
{ {62,52},{32,52},{78, 8},{20, 8},{33,13},{62,13},{46,16},{0,0},{53,20},{ 0, 0},{ 0, 0}}, // M_Awesome
{ {58,51},{37,51},{72,11},{21,11},{42,15},{62,15},{49, 8},{0,0},{48,13},{39,37},{69,50}}, // M_Battlemaster
{ {58,51},{37,51},{72,11},{21,11},{42,15},{62,15},{49, 8},{0,0},{48,13},{39,37},{ 0, 0}}, // M_BattlemasterIIc
{ {62,49},{34,49},{78, 9},{ 9, 6},{39,17},{64,17},{51, 6},{0,0},{54,10},{ 8, 6},{ 0, 0}}, // M_Behemoth
{ {62,49},{34,49},{78, 9},{ 9, 6},{39,17},{64,17},{51, 6},{0,0},{54,10},{ 8, 6},{ 0, 0}}, // M_BehemothII
{ {58,49},{24,49},{80,26},{16,26},{34,13},{57,13},{45,20},{0,0},{52,23},{72, 6},{21, 6}}, // M_Blackhawk
{ {62,49},{34,49},{78, 9},{ 9, 6},{39,17},{64,17},{51, 6},{0,0},{54,10},{ 8, 6},{ 0, 0}}, // M_Blackknight
{ {58,49},{24,49},{80,26},{16,26},{34,13},{57,13},{45,20},{0,0},{52,23},{72, 6},{21, 6}}, // M_Blacklanner
{ {58,49},{24,49},{80,26},{16,26},{34,13},{57,13},{45,20},{0,0},{52,23},{72, 6},{21, 6}}, // M_Brigand
{ {59,44},{21,44},{77,30},{ 8,27},{36,14},{56,11},{46,21},{0,0},{52,27},{69, 2},{ 0, 0}}, // M_Bushwacker
{ {61,57},{17,57},{67,10},{16,10},{38,32},{64,32},{51,28},{0,0},{53,33},{ 0, 0},{ 0, 0}}, // M_Catapult
{ {60,52},{24,52},{80,33},{ 3,34},{35,26},{69,26},{47,29},{0,0},{59,39},{73,15},{22,13}}, // M_CauldronBorn
{ {58,43},{22,43},{79,25},{19,27},{27, 7},{67,12},{46,10},{0,0},{60,10},{ 0, 0},{ 0, 0}}, // M_Chimera
{ {57,45},{21,45},{90,23},{ 9,23},{24,11},{67,11},{48, 6},{0,0},{52,16},{ 0, 0},{ 0, 0}}, // M_Commando
{ {57,45},{21,45},{90,23},{ 9,23},{24,11},{67,11},{48, 6},{0,0},{52,16},{ 0, 0},{ 0, 0}}, // M_Cougar
{ {64,55},{23,55},{80,22},{17,22},{34,23},{64,21},{45,13},{0,0},{52,21},{34,10},{ 0, 0}}, // M_Cyclops
{ {61,53},{10,53},{78,17},{17,17},{34,12},{56,12},{45,21},{0,0},{52,29},{58, 5},{ 0, 0}}, // M_Daishi
// { {57,45},{21,45},{90,23},{ 9,23},{24,11},{67,11},{48, 6},{0,0},{52,16},{ 0, 0},{ 0, 0}}, // M_Dasher
{ {58,51},{24,51},{80,28},{16,28},{34,15},{57,15},{45,22},{0,0},{52,25},{72, 8},{21, 8}}, // M_Deimos
{ {66,49},{33,49},{78,26},{21,24},{29,11},{69,11},{50,14},{0,0},{55,19},{ 0, 0},{ 0, 0}}, // M_Dragon
{ {60,55},{30,55},{91,12},{10,12},{23,13},{65,13},{47,13},{0,0},{54,39},{ 0, 0},{ 0, 0}}, // M_Fafnir
{ {62,43},{21,43},{69,29},{35,29},{33,16},{59,16},{45,13},{0,0},{51,27},{ 0, 0},{ 0, 0}}, // M_Flea
{ {62,61},{35,61},{73,27},{26,27},{40,24},{64,24},{46, 9},{0,0},{53,25},{ 0, 0},{ 0, 0}}, // M_Gladiator
{ {64,55},{23,55},{80,22},{17,22},{34,23},{64,21},{45,13},{0,0},{52,21},{34,10},{ 0, 0}}, // M_Grizzly
{ {64,55},{23,55},{80,22},{17,22},{34,23},{64,21},{45,13},{0,0},{52,21},{34,10},{ 0, 0}}, // M_Hauptmann
{ {55,48},{23,48},{76,30},{14,30},{31,14},{60,14},{46,22},{0,0},{50,38},{ 0, 0},{ 0, 0}}, // M_Hellhound
{ {66,50},{30,50},{79,25},{18,25},{37,19},{58,23},{47,46},{0,0},{44,18},{43, 7},{25, 8}}, // M_Hellspawn
{ {61,52},{32,52},{79,27},{13,26},{22,13},{64,13},{48, 6},{0,0},{51,11},{ 0, 0},{ 0, 0}}, // M_Highlander
{ {58,49},{24,49},{80,26},{16,26},{34,13},{57,13},{45,20},{0,0},{52,23},{72, 6},{21, 6}}, // M_HollanderII
{ {60,55},{31,55},{77,20},{21,20},{36,32},{65, 9},{45, 9},{0,0},{55,13},{35, 9},{ 0, 0}}, // M_Hunchback
{ {60,60},{29,60},{79,26},{14,26},{31,16},{65,16},{41, 9},{0,0},{54,12},{ 0, 0},{ 0, 0}}, // M_Kodiak
{ {64,52},{32,52},{77,23},{20,23},{38,18},{65,13},{50,16},{0,0},{54,20},{36, 7},{ 0, 0}}, // M_Loki
{ {60,49},{31,49},{84,16},{ 3,16},{26,13},{65,13},{45, 9},{0,0},{51,21},{ 0, 0},{ 0, 0}}, // M_Longbow
{ {58,49},{24,49},{80,26},{16,26},{34,13},{57,13},{45,20},{0,0},{52,23},{72, 6},{21, 6}}, // M_Madcat
{ {67,53},{16,53},{75,34},{19,34},{40,15},{58,15},{47,26},{0,0},{53,31},{24, 4},{73, 4}}, // M_Madcat_MKII
{ {62,51},{ 7,51},{78,29},{ 9,29},{34,15},{66,15},{49,15},{0,0},{51,32},{ 0, 0},{ 0, 0}}, // M_Masakari
{ {59,56},{32,56},{76, 7},{19, 7},{31, 5},{60, 5},{47,18},{0,0},{52,25},{ 0, 0},{ 0, 0}}, // M_Mauler
{ {62,46},{29,46},{79,11},{12,11},{35,16},{66,16},{48,11},{0,0},{52,14},{ 0, 0},{ 0, 0}}, // M_Novacat
{ {66,53},{27,53},{84,17},{15,23},{30,17},{69,17},{45,14},{0,0},{53,20},{48, 4},{48,59}}, // M_Osiris
{ {62,52},{21,52},{82,17},{ 7,17},{30,29},{65,29},{44,12},{0,0},{50,36},{ 0, 0},{ 0, 0}}, // M_Owens
{ {57,45},{19,45},{83,23},{ 9,23},{25,13},{68,13},{43,13},{0,0},{50,36},{ 0, 0},{ 0, 0}}, // M_Puma
{ {67,45},{23,45},{69, 7},{20, 7},{36,11},{57,11},{46,16},{0,0},{54,22},{ 0, 0},{ 0, 0}}, // M_Raven
{ {58,49},{24,49},{80,26},{16,26},{34,13},{57,13},{45,20},{0,0},{52,23},{72, 6},{21, 6}}, // M_Rifleman
{ {64,53},{21,53},{77,10},{17,10},{39,11},{58,11},{39,24},{0,0},{53,31},{ 0, 0},{ 0, 0}}, // M_Ryoken
{ {67,42},{11,42},{79,21},{ 9,21},{37, 7},{65,10},{47, 7},{0,0},{54,16},{ 0, 0},{ 0, 0}}, // M_Shadowcat
{ {64,55},{23,55},{80,22},{17,22},{34,23},{64,21},{45,13},{0,0},{52,21},{34,10},{ 0, 0}}, // M_Solitaire
{ {64,50},{29,50},{81,22},{12,22},{31, 8},{67, 8},{46, 5},{0,0},{53,21},{ 0, 0},{ 0, 0}}, // M_Sunder
{ {62,53},{33,53},{84,36},{17,36},{22, 9},{65, 9},{51,13},{0,0},{55,19},{ 0, 0},{ 0, 0}}, // M_Templar
{ {64,48},{31,48},{84,12},{11,12},{33, 8},{65, 8},{52, 7},{0,0},{56,15},{ 0, 0},{ 0, 0}}, // M_Thanatos
{ {65,51},{31,51},{78,22},{19,22},{37,17},{64,22},{49,20},{0,0},{41,21},{62, 6},{ 0, 0}}, // M_Thor
{ {60,40},{18,40},{79,21},{ 4,22},{37,11},{58,11},{47,19},{0,0},{53,23},{ 0, 0},{ 0, 0}}, // M_Uller
{ {60,40},{18,40},{79,21},{ 4,22},{37,11},{58,11},{47,19},{0,0},{53,23},{ 0, 0},{ 0, 0}}, // M_Urbanmech
{ {69,52},{17,52},{81,23},{13,23},{30, 9},{69, 9},{46,11},{0,0},{53,35},{46,48},{ 0, 0}}, // M_Uziel
{ {60,51},{32,51},{78,24},{19,25},{22,16},{64,16},{42, 6},{0,0},{52,15},{ 0, 0},{ 0, 0}}, // M_Victor
{ {60,45},{20,45},{78,28},{18,28},{38, 9},{65, 9},{52, 7},{0,0},{55, 4},{44,43},{ 0, 0}}, // M_Vulture
{ {58,49},{24,49},{80,26},{16,26},{34,13},{57,13},{45,20},{0,0},{52,23},{72, 6},{21, 6}}, // M_Warhammer
{ {66,55},{34,55},{73,14},{23,15},{41,21},{62,21},{46, 8},{0,0},{52,14},{ 0, 0},{ 0, 0}}, // M_Wolfhound
{ {60,53},{30,53},{77,32},{20,32},{21, 9},{66, 9},{42, 4},{0,0},{53,20},{ 0, 0},{ 0, 0}} // M_Zeus
};
}
using namespace HUDDAMAGE;
HUDDamage::HUDDamage()
{
int i;
//labels - black background HD LT CT RT LA RA RL LL S1 S2 CTR
AddTexture ("hud\\hud4",20,115,119,127,127);
AddTexture ("hud\\hud4",21,129,119,141,127);
AddTexture ("hud\\hud4",22,143,119,155,127);
AddTexture ("hud\\hud4",23,157,119,169,127);
AddTexture ("hud\\hud4",24,171,119,183,127);
AddTexture ("hud\\hud4",25,185,119,197,127);
AddTexture ("hud\\hud4",26,199,119,211,127);
AddTexture ("hud\\hud4",27,213,119,225,127);
AddTexture ("hud\\hud4",28,229,119,241,127);
AddTexture ("hud\\hud4",29,243,119,255,127);
AddTexture ("hud\\hud4",30,229,50,254,58);
for (i=20;i<=30;i++)
{
m_Textures[i]->BlendMode (gos_BlendDecal);
}
//labels - white background HD LT CT RT LA RA RL LL S1 S2 CTR
AddTexture ("hud\\hud4",40,115,110,127,118);
AddTexture ("hud\\hud4",41,129,110,141,118);
AddTexture ("hud\\hud4",42,143,110,155,118);
AddTexture ("hud\\hud4",43,157,110,169,118);
AddTexture ("hud\\hud4",44,171,110,183,118);
AddTexture ("hud\\hud4",45,185,110,197,118);
AddTexture ("hud\\hud4",46,199,110,211,118);
AddTexture ("hud\\hud4",47,213,110,225,118);
AddTexture ("hud\\hud4",48,229,110,241,118);
AddTexture ("hud\\hud4",49,243,110,255,118);
AddTexture ("hud\\hud4",50,229,41,254,49);
// AddTexture ("hud\\hud3",50,232,0,256,57);
// AddTexture ("hud\\hud3",51,232,67,241,117);
// AddTexture ("hud\\hud3",52,232,67,241,117);
Size (Point3D (152,133,0));
Location (Point3D (657,466,0));
m_DamageColors[0] = MakeColor(100, 225, 100, 225);
m_DamageColors[1] = MakeColor(225, 225, 0, 200);
m_DamageColors[2] = MakeColor(255, 150, 0, 175);
m_DamageColors[3] = MakeColor(255, 50, 0, 150);
m_DamageColors[4] = MakeColor(255, 50, 0, 125);
m_DamageColors[5] = MakeColor(0, 0, 0, 100);
Color (MakeColor (0,175,0,150));
m_DamageFlashTime = 0;
m_HitFlashTime = 0;
//sanghoon begin
VehicleInterface::GetInstance()->hudDamageMode=false;
//sanghoon end
m_ArmorMode = VehicleInterface::GetInstance()->hudDamageMode;
for (i=0;i<MAX_HUD_DAMAGE_ZONE+1;i++)
{
m_HitFlashCount[i] = 0;
m_DamageValues[i] = 0;
m_ArmorValues[i] = 0;
}
m_MechID = 0;
m_RearText = new HUDText ();
MWApplication *app;
app = MWApplication::GetInstance ();
m_RearText->UpdateText (app->GetLocString (IDS_HUDREAR));
m_RearText->SetSize (HUDText::SMALL_SIZE);
m_RearText->Color (MakeColor (73,231,73,255));
}
HUDDamage::~HUDDamage()
{
delete m_RearText;
}
void HUDDamage::SetVehicle(Vehicle *vehicle)
{
inherited::SetVehicle (vehicle);
if (m_Vehicle.GetCurrent ())
{
Mech *mech;
mech = Cast_Object (Mech *,m_Vehicle.GetCurrent ());
const Mech__GameModel *model = static_cast<const Mech__GameModel *> (mech->GetGameModel ());
#if 0
static int s_nMechID = 0;
m_MechID = s_nMechID;
s_nMechID++;
if (LastMechID < s_nMechID)
s_nMechID = 0;
#else
m_MechID = model->mechID;
#endif
}
else
m_MechID = 0;
}
void HUDDamage::Reset (void)
{
m_DamageFlashTime = 0;
m_HitFlashTime = 0;
int i;
for (i=0;i<MAX_HUD_DAMAGE_ZONE+1;i++)
{
m_HitFlashCount[i] = 0;
m_DamageValues[i] = 0;
m_ArmorValues[i] = 0;
}
Verify (m_MechID >=0);
Verify (m_MechID <= LastMechID);
AddTexture (texturename[m_MechID],0,texuv[m_MechID][0][0],texuv[m_MechID][0][1],texuv[m_MechID][0][2],texuv[m_MechID][0][3],128,128); // left leg
AddTexture (texturename[m_MechID],1,texuv[m_MechID][1][0],texuv[m_MechID][1][1],texuv[m_MechID][1][2],texuv[m_MechID][1][3],128,128); // right leg
AddTexture (texturename[m_MechID],2,texuv[m_MechID][2][0],texuv[m_MechID][2][1],texuv[m_MechID][2][2],texuv[m_MechID][2][3],128,128); // left arm
AddTexture (texturename[m_MechID],3,texuv[m_MechID][3][0],texuv[m_MechID][3][1],texuv[m_MechID][3][2],texuv[m_MechID][3][3],128,128); // right arm
AddTexture (texturename[m_MechID],4,texuv[m_MechID][4][0],texuv[m_MechID][4][1],texuv[m_MechID][4][2],texuv[m_MechID][4][3],128,128); // right torso
AddTexture (texturename[m_MechID],5,texuv[m_MechID][5][0],texuv[m_MechID][5][1],texuv[m_MechID][5][2],texuv[m_MechID][5][3],128,128); // left torso
AddTexture (texturename[m_MechID],6,texuv[m_MechID][6][0],texuv[m_MechID][6][1],texuv[m_MechID][6][2],texuv[m_MechID][6][3],128,128); // center torso
AddTexture ("hud\\hud5",7,220,0,252,50); // center torso rear
AddTexture (texturename[m_MechID],8,texuv[m_MechID][8][0],texuv[m_MechID][8][1],texuv[m_MechID][8][2],texuv[m_MechID][8][3],128,128); // head
AddTexture (texturename[m_MechID],9,texuv[m_MechID][9][0],texuv[m_MechID][9][1],texuv[m_MechID][9][2],texuv[m_MechID][9][3],128,128); // special 1
AddTexture (texturename[m_MechID],10,texuv[m_MechID][10][0],texuv[m_MechID][10][1],texuv[m_MechID][10][2],texuv[m_MechID][10][3],128,128); // special 2
AddTexture ("hud\\hud5",11,229,68,238,118); // special 1 rear
AddTexture ("hud\\hud5",12,243,68,254,118); // special 2 rear
if(!hsh_initialized)
{
;
}
else
{
//sanghoon
mfd_device.LoadDamageTexture(texturename[m_MechID]);
radar_device.LoadRadarDamageTexture(texturename[m_MechID]);
}
}
void HUDDamage::Update (Stuff::Time till)
{
if (m_DamageFlashTime == 0)
m_DamageFlashTime = till;
if (m_HitFlashTime == 0)
m_HitFlashTime = till;
while (m_DamageFlashTime <= till)
{
m_DamageFlash = !m_DamageFlash;
m_DamageFlashTime += 1.0/6.0;
}
while (m_HitFlashTime <= till)
{
int i;
for (i=0;i<MAX_HUD_DAMAGE_ZONE+1;i++)
{
if (m_HitFlashCount[i])
m_HitFlashCount[i]++;
if (m_HitFlashCount[i] == MAX_FLASH)
m_HitFlashCount[i] = 0;
}
m_HitFlashTime += 1.0/6.0;
}
inherited::Update (till);
}
void HUDDamage::DamageValue (int values[MAX_HUD_DAMAGE_ZONE+1])
{
int i;
for (i=0;i<MAX_HUD_DAMAGE_ZONE+1;i++)
{
m_DamageValues[i] = values[i];
}
}
void HUDDamage::ArmorValue (Scalar values[MAX_HUD_DAMAGE_ZONE+1],bool firstpass)
{
int i;
for (i=0;i<MAX_HUD_DAMAGE_ZONE+1;i++)
{
if ((m_ArmorValues[i] != values[i]) && (!firstpass))
m_HitFlashCount[i] = 1;
m_ArmorValues[i] = values[i];
}
}
//sanghoon begin
//nst DWORD SH_DamageColor[6]={0xFFFFFFFF,0xFFCCCCCC,0xFF999999,0xFF666666,0xFF333333,0xFF000000};
const DWORD SH_DamageColor[6]={0xFFFFFFFF,0xFFDDDDDD,0xFFBBBBBB,0xFF999999,0xFF777777,0xFF333333};
static const float sm2_texture[][4]=
{
{172, 0,231,140},//left leg
{109, 0,168,140},//right leg
{ 30,144, 67,246},//left arm
{ 0, 36, 36,128},//right arm
{ 37, 24, 66,101},//right torso
{ 0,132, 28,209},//left torso
{ 67, 33, 99,125},//center torso
{0,0,0,0}, //blank rear?
{ 67, 0, 99, 31},//head
{0,0,0,0}, //special1
{0,0,0,0}, //special2
};
static const float sm2_offset[][2]={
{29*3, 35*3}, //leftleg
{ 6*3, 35*3}, //rightleg
{43*3, 11*3}, //leftarm
{ 0*3, 11*3}, //rightarm
{12*3, 7*3}, //righttorso
{33*3, 7*3}, //lefttorso
{22*3, 10*3}, //centertorso
{ 0, 0}, //blank rear?
{22*3, 0*3}, //head
{ 0, 0}, //special1
{ 0, 0}, //special2
};
void RenderAux4SmallMech(int part,DWORD color)
{
if(sm2_texture[part][2]!=0){
mfd_device.DrawTexture(
sm2_offset[part][0]+320+80,
sm2_offset[part][1]+150,
color,
sm2_texture[part][0],
sm2_texture[part][1],
sm2_texture[part][2],
sm2_texture[part][3]);
}
}
static const float back_texture[][4]=
{
{ 72, 151, 140, 252},//back
{147, 151, 173, 252},//back right
{186, 151, 215, 252},//back left
};
static const float back_offset[][2]={
{534, 66}, //back
{520,262}, //back right
{588,262}, //back left
};
void RenderAux5MechBack(int part,DWORD color)
{
mfd_device.DrawTexture(
back_offset[part][0],
back_offset[part][1],
color,
back_texture[part][0],
back_texture[part][1],
back_texture[part][2],
back_texture[part][3]);
}
static char mfd_text_damage_COOP[8][32]={
"",
"VIEW MODE",
"",
"ARMOR MODE",
"",
"",
"",
"",
};
static char mfd_text_damage[8][32]={
"MUTE",
"NEAREST\nENEMY",
"CROSSHAIR\nTARGET",
"ARMOR MODE",
"ZOOM MODE",
"JUMP MODE",
"FLUSH MODE",
"LIGHT AMP MODE",
};
static RECT damage_back_frames[4]={
{9,49,497,381},
{504,49,634,183},
{504,245,566,382},
{573,245,634,382},
};
//sanghoon end
void HUDDamage::DrawImplementation(void)
{
if(!hsh_initialized)
{
Point3D loc,size;
int i;
const bartable[10] = {658,671,685,699,713,727,741,755,771,785};
loc = Location ();
DWORD color = MakeColor (0,32,0,150); // <- (32,32,32,150)
{
my_DrawRect (771,466,799,520,color); // rear
my_DrawRect (771,523,799,531,color); // rear text
my_DrawRect (771,534,783,585,color); // left s1
my_DrawRect (786,534,799,585,color); // right s2
// my_DrawRect (657,587,799,599,color); // bottom area
color = MakeColor (0,126,0,255); // <- (126,126,126,255)
DrawSpecFrame (771,466,799,520,color); // rear
DrawSpecFrame (771,523,799,531,color); // rear text
DrawSpecFrame (771,534,783,585,color); // left s1
DrawSpecFrame (786,534,799,585,color); // right s2
// DrawSpecFrame (657,587,799,599,color);
}
color = MakeColor (0,32,0,150); // <- (32,32,32,150)
if (m_ArmorMode)
{
my_DrawRect (658,488,768,586,color); // mech
my_DrawRect (658,466,768,485,color); // name
color = MakeColor (0,126,0,255);
DrawSpecFrame (658,488,768,485,color); // name
DrawSpecFrame (658,466,768,586,color); // mech
}
else
{
my_DrawRect (658,466,768,586,color); // mech
color = MakeColor (0,126,0,255); // <- (126,126,126,255)
DrawSpecFrame (658,466,768,586,color); // mech
}
int x,y;
size = m_Textures[20]->Size ();
x = 658;
y = 590;
color = MakeColor (0,126,0,255); // <- (126,126,0,255)
DrawLine (658,589,769,589,color);
DrawLine (658,598,769,598,color);
for (x=0;x<10;x++)
{
DrawLine (bartable[x],589,bartable[x],598,color);
}
DrawLine (769,589,769,598,color);
DrawLine (771,589,799,589,color);
DrawLine (771,598,799,598,color);
DrawLine (799,589,799,598,color);
color = Color ();
for (i=0;i<10;i++)
{
//Is this where text is drawn??
m_Textures[20+i]->Draw (Point3D ((Scalar) bartable[i]+1.0f,(Scalar) y,0.9f),size,MakeColor (255,255,255,255),HUDTexture::NO_FLIP,true);
if (!(m_HitFlashCount[trans_array[i]] & 0x01))
{
m_Textures[40+i]->Draw (Point3D ((Scalar) bartable[i]+1.0f,(Scalar) y-1.0f,0.9f),size,MakeColor (255,255,255,255));
}
}
if (!(m_HitFlashCount[trans_array[10]] & 0x01))
m_RearText->Color (MakeColor (73,231,73,255));
else
m_RearText->Color (MakeColor (255,255,255,255));
DWORD tx,ty;
m_RearText->DrawSize (tx,ty);
tx >>= 1;
ty >>= 1;
m_RearText->Draw (Point3D (785.0f-tx,529.0f-ty,0.9f));
/*
size = m_Textures[30]->Size ();
m_Textures[30]->Draw (Point3D (773.0f,524.0f,0.9f),size,MakeColor (255,255,255,255),HUDTexture::NO_FLIP,true);
if (!(m_HitFlashCount[trans_array[10]] & 0x01))
m_Textures[50]->Draw (Point3D (773.0f,523.0f,0.9f),size,MakeColor (255,255,255,255));
*/
size = Size ();
if (m_ArmorMode)
{
Scalar height;
int x,y;
size = m_Textures[20]->Size ();
for (i=0;i<MAX_HUD_DAMAGE_ZONE+1;i++)
{
x = 659;
y = 582;
if (m_ArmorValues[trans_array[i]] != -1)
{
switch (trans_array[i])
{
case 7: // rear
x = 778;
y = 518;
height = (m_ArmorValues[trans_array[i]]) * 50.0f;
if (height > 2.0f)
{
if (m_HitFlashCount[trans_array[i]] & 0x01)
{
my_DrawRect (x,y,(int) (x+13),(int) (y-height),MakeColor (255,255,255,255));
}
else
{
my_DrawRect (x,y,(int) (x+13),(int) (y-height),m_DamageColors[m_DamageValues[trans_array[i]]]);
}
}
DrawFrame (x,y,x+13,y-50,Color ());
break;
case 9: // s1
x = bartable[i]+2;
height = (m_ArmorValues[trans_array[i]]) * 45.0f;
if (height > 2.0f)
{
if (m_HitFlashCount[trans_array[i]] & 0x01)
{
my_DrawRect (x+3,y,(int) (x+YOUR_BARWIDTH-3),(int) (y-height),MakeColor (255,255,255,255));
}
else
{
my_DrawRect (x+3,y,(int) (x+YOUR_BARWIDTH-3),(int) (y-height),m_DamageColors[m_DamageValues[trans_array[i]]]);
}
}
DrawFrame (x+3,y,x+YOUR_BARWIDTH-3,y-45,Color ());
break;
case 10: //s2
x = bartable[i]+2;
height = (m_ArmorValues[trans_array[i]]) * 45.0f;
if (height > 2.0f)
{
if (m_HitFlashCount[trans_array[i]] & 0x01)
{
my_DrawRect (x+3,y,(int) (x+YOUR_BARWIDTH-3),(int) (y-height),MakeColor (255,255,255,255));
}
else
{
my_DrawRect (x+3,y,(int) (x+YOUR_BARWIDTH-3),(int) (y-height),m_DamageColors[m_DamageValues[trans_array[i]]]);
}
}
DrawFrame (x+3,y,x+YOUR_BARWIDTH-3,y-45,Color ());
break;
default:
x = bartable[i];
height = (m_ArmorValues[trans_array[i]]) * YOUR_BARHEIGHT;
if (height > 2.0f)
{
if (m_HitFlashCount[trans_array[i]] & 0x01)
{
my_DrawRect (x+3,y,(int) (x+YOUR_BARWIDTH-1),(int) (y-height),MakeColor (255,255,255,255));
}
else
{
my_DrawRect (x+3,y,(int) (x+YOUR_BARWIDTH-1),(int) (y-height),m_DamageColors[m_DamageValues[trans_array[i]]]);
}
}
DrawFrame (x+3,y,x+YOUR_BARWIDTH-1,y-YOUR_BARHEIGHT,Color ());
break;
}
}
}
}
else
{
Point3D boxloc;
boxloc = Location ();
loc.x = boxloc.x;
loc.y = boxloc.y;
int fred;
fred = 0;
for (i=0;i<11;i++)
{//What does the number 13 mean here?
#if 0
if (i != fred)
{
continue;
}
#endif
Verify (m_Textures[i]);
switch (i)
{
case 7: // rear
if ((m_DamageValues[i] <= 5) && (m_DamageValues[i]>=0))
{
if ((m_DamageValues[i] != 4) || (m_DamageFlash))
{
loc.x = 765;
loc.y = 469;
size = m_Textures[i]->Size ();
m_Textures[i]->Draw (loc,size,m_DamageColors[m_DamageValues[i]]);
}
}
break;
case 11: // s1
if ((m_DamageValues[9] <= 5) && (m_DamageValues[9]>=0))
{
if ((m_DamageValues[9] != 4) || (m_DamageFlash))
{
loc.x = 773;
loc.y = 535;
size = m_Textures[i]->Size ();
m_Textures[i]->Draw (loc,size,m_DamageColors[m_DamageValues[9]]);
}
}
break;
case 12: // s2
if ((m_DamageValues[10] <= 5) && (m_DamageValues[10]>=0))
{
if ((m_DamageValues[10] != 4) || (m_DamageFlash))
{
loc.x = 788;
loc.y = 535;
size = m_Textures[i]->Size ();
m_Textures[i]->Draw (loc,size,m_DamageColors[m_DamageValues[10]]);
}
}
break;
default:
if ((m_DamageValues[i] <= 5) && (m_DamageValues[i]>=0))
{
if ((m_DamageValues[i] != 4) || (m_DamageFlash))
{
loc.x = boxloc.x + (offset[m_MechID][i][0]);
loc.y = boxloc.y + (offset[m_MechID][i][1]);
size = m_Textures[i]->Size ();
m_Textures[i]->Draw (loc,size,m_DamageColors[m_DamageValues[i]]);
}
}
break;
}
}
}
}
else
{
if(mfd_device.BeginChannel(2))
{
mfd_device.pD3DDevice->SetTexture(0,0);
mfd_device.DrawThickFrameList(4,damage_back_frames,1,0xFFFFFFFF);
static int s_naStates[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
if (g_bCOOP) {
mfd_device.DrawMFDBackText(mfd_text_damage_COOP, s_naStates);
} else {
if (g_bMuteMode)
s_naStates[0] = 2;
else
s_naStates[0] = 1;
// MSL 5.02 Pinky Button
if (g_bZoomMode)
s_naStates[4] = 2;
else
s_naStates[4] = 1;
if (g_bJumpMode)
s_naStates[5] = 2;
else
s_naStates[5] = 1;
if (g_bFlushMode)
s_naStates[6] = 2;
else
s_naStates[6] = 1;
if (g_bLightAmpMode)
s_naStates[7] = 2;
else
s_naStates[7] = 1;
if (g_bNextTargetMode)
s_naStates[1] = 2;
else
s_naStates[1] = 1;
if (g_bCrossTargetMode)
s_naStates[2] = 2;
else
s_naStates[2] = 1;
mfd_device.DrawMFDBackText(mfd_text_damage, s_naStates);
}
int i;
mfd_device.pD3DDevice->SetTexture(0,mfd_device.pDDSTexture);
//enable Alpha
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, TRUE );
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA );
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA );
//The original spacing is 13,14,14,14,14,14,14,14,16,14.
const hsh_bartable[11] = {26+61*0,26+61*1,26+61*2,26+61*3,26+61*4,26+61*5,26+61*6,26+61*7,522,591,540};
DWORD color=0xFFFFFFFF;
const DWORD color_nohit=0xFF808080;
const DWORD color_hit=0xFFFFFFFF;
for(i=0;i<8;i++)
{
color=(m_HitFlashCount[trans_array[i]] & 0x01)? color_hit:color_nohit;
mfd_device.DrawTexture(10+58*i,392,color,0+58*i,403,0+58*(i+1),447);
}
color=(m_HitFlashCount[trans_array[8]] & 0x01)? color_hit:color_nohit;
mfd_device.DrawTexture(506,392,color,0,452,60,496);
color=(m_HitFlashCount[trans_array[9]] & 0x01)? color_hit:color_nohit;
mfd_device.DrawTexture(571,392,color,60,452,118,496);
color=(m_HitFlashCount[trans_array[10]] & 0x01)? color_hit:color_nohit;
mfd_device.DrawTexture(506,194,color,178,452,308,496);
// MSL 5.03 Damage on Secondary
if (g_nAuxilMode == 1)
{
// if(radar_device.pDDSRadarDamageTexture==0)
radar_device.LoadRadarDamageTexture(texturename[m_MechID]);
// clear back ground texture
RECT rc={140,407,340,607};
DDBLTFX fx={0,};
fx.dwSize=sizeof(fx);
fx.dwFillColor=0;
radar_device.pDDSTarget->Blt(&rc,NULL,NULL,DDBLT_COLORFILL ,&fx);
for (i=0;i<11;i++)
{//What does the number 13 mean here?
int dv=m_DamageValues[i];
DWORD color=0xFF000000;
if(0<=dv && dv<=5)
color=SH_DamageColor[dv];
if ((m_DamageValues[i] <= 5) && (m_DamageValues[i]>=0))
{
if ((m_DamageValues[i] != 4) || (m_DamageFlash))
{
color = m_DamageColors[m_DamageValues[i]];
radar_device.pD3DDevice->SetTexture(0,radar_device.pDDSRadarDamageTexture);
radar_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, TRUE );
radar_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA );
radar_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA );
radar_device.tw=256,radar_device.th=256;
radar_device.DrawTexture(
(offset3[m_MechID][i][0]/2)+138,
(offset3[m_MechID][i][1]/2)+406,
color,
texuv3[m_MechID][i][0]/2,
texuv3[m_MechID][i][1]/2,
texuv3[m_MechID][i][2]/2,
texuv3[m_MechID][i][3]/2
);
radar_device.tw=512,radar_device.th=512;
}
}
}
}
if (m_ArmorMode)
{
mfd_device.pD3DDevice->SetTexture(0,0);
int hsh_x;
Scalar hsh_height;
for (int i=0;i<MAX_HUD_DAMAGE_ZONE+1;i++)
{
if (m_ArmorValues[trans_array[i]] != -1)
{
hsh_x=hsh_bartable[i];//Exception at index 7.
int tr=trans_array[i];
DWORD color=(m_HitFlashCount[tr] & 0x01)? 0xFFFFFFFF : SH_DamageColor[m_DamageValues[tr]];
switch (tr)
{
case 7: // rear
hsh_x=hsh_bartable[10];
hsh_height=m_ArmorValues[tr]*126;
if (hsh_height > 2.0f)
{
mfd_device.DrawQuad(hsh_x,(int)(179-hsh_height),598,179,color);
}
mfd_device.DrawFrame(hsh_x,179-126,598,179,0xFFFFFFFF);
break;
case 9: // s1
hsh_height=m_ArmorValues[tr]*110;
if (hsh_height > 2.0f)
{
mfd_device.DrawQuad(hsh_x,(int)(375-hsh_height),hsh_x+26,375,color);
}
mfd_device.DrawFrame(hsh_x,375-110,hsh_x+26,375,0xFFFFFFFF);
break;
case 10: // s2
hsh_height=m_ArmorValues[tr]*110;
if (hsh_height > 2.0f)
{
mfd_device.DrawQuad(hsh_x,(int)(375-hsh_height),hsh_x+26,375,color);
}
mfd_device.DrawFrame(hsh_x,375-110,hsh_x+26,375,0xFFFFFFFF);
break;
default:
hsh_height=m_ArmorValues[tr]*300;
hsh_x=26+58*i;
if (hsh_height > 2.0f)
{
mfd_device.DrawQuad(hsh_x,(int)(375-hsh_height),hsh_x+26,375,color);
}
mfd_device.DrawFrame(hsh_x,375-300,hsh_x+26,375,0xFFFFFFFF);
break;
}
}
}
}
else
{//!ArmorMode
if(mfd_device.pDDSDamageTexture==0)
mfd_device.LoadDamageTexture(texturename[m_MechID]);
for (i=0;i<13;i++)
{//What does the number 13 mean here?
int dv=m_DamageValues[i];
DWORD color=0xFF000000;
if(0<=dv && dv<=5)color=SH_DamageColor[dv];
switch (i)
{
case 7: // rear
if ((m_DamageValues[i] <= 5) && (m_DamageValues[i]>=0))
if ((m_DamageValues[i] != 4) || (m_DamageFlash))
{
mfd_device.pD3DDevice->SetTexture(0,mfd_device.pDDSTexture);
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, TRUE );
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA );
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA );
RenderAux5MechBack(0,color);
}
break;
case 11: // rear s1
{
int dv=m_DamageValues[9];
DWORD color=0xFF000000;
if(0<=dv && dv<=5)color=SH_DamageColor[dv];
if ((m_DamageValues[9] <= 5) && (m_DamageValues[9]>=0))
if ((m_DamageValues[9] != 4) || (m_DamageFlash))
{
mfd_device.pD3DDevice->SetTexture(0,mfd_device.pDDSTexture);
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, TRUE );
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA );
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA );
RenderAux5MechBack(1,color);
}
}
break;
case 12: // rear s2
{
int dv=m_DamageValues[10];
DWORD color=0xFF000000;
if(0<=dv && dv<=5)color=SH_DamageColor[dv];
if ((m_DamageValues[10] <= 5) && (m_DamageValues[10]>=0))
if ((m_DamageValues[10] != 4) || (m_DamageFlash))
{
mfd_device.pD3DDevice->SetTexture(0,mfd_device.pDDSTexture);
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, TRUE );
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA );
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA );
RenderAux5MechBack(2,color);
}
}
break;
default:
if ((m_DamageValues[i] <= 5) && (m_DamageValues[i]>=0))
{
if ((m_DamageValues[i] != 4) || (m_DamageFlash))
{
mfd_device.pD3DDevice->SetTexture(0,mfd_device.pDDSDamageTexture);
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, TRUE );
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA );
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA );
mfd_device.DrawTexture(
offset2[m_MechID][i][0]+100,
offset2[m_MechID][i][1]+40,
color,
texuv2[m_MechID][i][0],
texuv2[m_MechID][i][1],
texuv2[m_MechID][i][2],
texuv2[m_MechID][i][3]
);
}
}
break;
}
}
}
}
mfd_device.EndChannel();
}
}
namespace NHUDTARGETDAMAGE
{
const int WeaponTransTable[85][2] = {
{W_SmallLaser ,27},
{W_MediumLaser ,18},
{W_LargeLaser ,11},
{W_SmallPulse ,28},
{W_MediumPulse ,19},
{W_LargePulse ,12},
{W_ERSmallLaser ,27},
{W_ERMediumLaser ,18},
{W_ERLargeLaser ,11},
{W_SmallXPulse, 28},
{W_MedXPulse ,28},
{W_LargeXPulse ,28},
{W_ClanSmallPulse ,52},
{W_ClanMediumPulse,49},
{W_ClanLargePulse ,44},
{W_ClanERSmallLaser ,38},
{W_ClanERMediumLaser ,36},
{W_ClanERLargeLaser ,35},
{W_PPC ,26},
{W_ERPPC, 26},
{W_ClanERPPC ,37},
{W_Flamer,4},
{W_ERFlamer,4},
{W_Bombast ,3},
{W_SRM2 ,29},
{W_SRM4 ,30},
{W_SRM6 ,31},
{W_ClanSRM2 ,29},
{W_ClanSRM4 ,30},
{W_ClanSRM6 ,31},
{W_SSRM2 ,53},
{W_SSRM4 ,54},
{W_SSRM6 ,55},
{W_ClanSSRM2 ,53},
{W_ClanSSRM4 ,54},
{W_ClanSSRM6 ,55},
{W_MRM10 ,21},
{W_MRM20 ,22},
{W_MRM30 ,23},
{W_MRM40 ,24},
{W_SMRM10 ,21},
{W_SMRM20 ,22},
{W_SMRM30 ,23},
{W_SMRM40 ,24},
{W_ClanSMRM10 ,21},
{W_ClanSMRM20 ,22},
{W_ClanSMRM30 ,23},
{W_ClanSMRM40 ,24},
{W_LRM5 ,17},
{W_LRM10 ,14},
{W_LRM15 ,15},
{W_LRM20 ,16},
{W_ClanLRM5 ,48},
{W_ClanLRM10 ,45},
{W_ClanLRM15 ,46},
{W_ClanLRM20 ,47},
{W_Thunderbolt ,32},
{W_NarcBeacon ,25},
{W_ClanNarcBeacon ,51},
{W_Flare ,51},
{W_HighExplosive ,51},
{W_ArtilleryStrike ,51},
{W_AC2 ,1},
{W_AC5 ,1},
{W_AC10 ,0},
{W_AC20 ,0},
{W_LBXAC10 ,9},
{W_LBXAC20 ,10},
{W_ClanLBXAC10 ,42},
{W_ClanLBXAC20 ,43},
{W_UltraAC2 ,33},
{W_UltraAC5 ,34},
{W_UltraAC10 ,34},
{W_UltraAC20 ,34},
{W_ClanUltraAC2 ,56},
{W_ClanUltraAC5 ,57},
{W_ClanUltraAC10 ,57},
{W_ClanUltraAC20 ,51},
{W_LightGauss ,8},
{W_Gauss ,6},
{W_HeavyGauss ,51},
{W_ClanGauss ,40},
{W_MachineGun ,20},
{W_ClanMachineGun ,50},
{W_LongTom ,13},
// {W_RTXAC2, 77},
// {W_RTXAC5, 78},
};
int LookupWeapon (int id)
{
int i;
for (i=0;i<85;i++)
{
if (WeaponTransTable[i][0] == id)
{
return WeaponTransTable[i][1];
}
}
return -1;
}
};
using namespace NHUDTARGETDAMAGE;
HUDTargetDamage::HUDTargetDamage() :
m_TargetVehicle(NULL)
{
int i;
AddTexture ("hud\\hud4",0,29,43,49,91); //leftleg
AddTexture ("hud\\hud4",1,6,43,26,92); //rightleg
AddTexture ("hud\\hud4",2,43,11,56,42); //leftarm
AddTexture ("hud\\hud4",3,0,11,12,42); //rightarm
AddTexture ("hud\\hud4",4,12,7,22,33); //righttorso
AddTexture ("hud\\hud4",5,33,7,43,33); //lefttorso
AddTexture ("hud\\hud4",6,22,10,33,41); //centertorso
AddTexture ("hud\\hud4",7,0,0,0,0); //blank rear?
AddTexture ("hud\\hud4",8,22,0,33,10); //head
AddTexture ("hud\\hud4",9,0,0,0,0); //special1
AddTexture ("hud\\hud4",10,0,0,0,0); //special2
AddTexture ("hud\\hud4",20,115,119,127,127);
AddTexture ("hud\\hud4",21,129,119,141,127);
AddTexture ("hud\\hud4",22,143,119,155,127);
AddTexture ("hud\\hud4",23,157,119,169,127);
AddTexture ("hud\\hud4",24,171,119,183,127);
AddTexture ("hud\\hud4",25,185,119,197,127);
AddTexture ("hud\\hud4",26,199,119,211,127);
AddTexture ("hud\\hud4",27,213,119,225,127);
AddTexture ("hud\\hud4",28,229,119,241,127);
AddTexture ("hud\\hud4",29,243,119,255,127);
AddTexture ("hud\\hud4",30,157,119,169,127);
for (i=20;i<=30;i++)
{
m_Textures[i]->BlendMode (gos_BlendDecal);
}
AddTexture ("hud\\hud4",40,115,110,127,118);
AddTexture ("hud\\hud4",41,129,110,141,118);
AddTexture ("hud\\hud4",42,143,110,155,118);
AddTexture ("hud\\hud4",43,157,110,169,118);
AddTexture ("hud\\hud4",44,171,110,183,118);
AddTexture ("hud\\hud4",45,185,110,197,118);
AddTexture ("hud\\hud4",46,199,110,211,118);
AddTexture ("hud\\hud4",47,213,110,225,118);
AddTexture ("hud\\hud4",48,229,110,241,118);
AddTexture ("hud\\hud4",49,243,110,255,118);
AddTexture ("hud\\hud4",50,157,110,169,118);
for (i=0;i<58;i++)
{
AddTexture ("hud\\hud4",100+i,60,24+(i*4.0f),87,28+(i*4.0f));
}
m_DamageColors[0] = MakeColor(100, 225, 100, 225);
m_DamageColors[1] = MakeColor(225, 225, 0, 200);
m_DamageColors[2] = MakeColor(255, 150, 0, 175);
m_DamageColors[3] = MakeColor(255, 50, 0, 150);
m_DamageColors[4] = MakeColor(255, 50, 0, 125);
m_DamageColors[5] = MakeColor(0, 0, 0, 100);
m_TargetName = new HUDText ();
m_TargetName->Justification (HUDText::LEFT_ALIGN);
m_TargetRangeText = new HUDNumberText ();
m_TargetRangeText->Justification (HUDText::LEFT_ALIGN);
//sanghoon
// m_TargetRangeText->SetSize(HUDText::LARGE_SIZE);
m_TargetRangeText->SetSize(HUDText::MEDIUM_SIZE);
m_TargetAlignment = 0;
m_TargetTonnage = -1;
m_TargetName->UpdateText ("");
m_TargetRangeText->UpdateText ("");
Color (MakeColor (0,175,0,150));
m_DamageFlashTime = 0;
m_HitFlashTime = 0;
for (i=0;i<MAX_HUD_DAMAGE_ZONE+1;i++)
{
m_HitFlashCount[i] = 0;
m_DamageValues[i] = 0;
m_ArmorValues[i] = 0;
}
// MSL 5.03 Target Damage Display
m_TargetMechID = 0;
m_Weapons.clear ();
//sanghoon begin
VehicleInterface::GetInstance()->hudTargetDamageMode=false;
//sanghoon end
m_ArmorMode = VehicleInterface::GetInstance()->hudTargetDamageMode;
m_LastMechMode = false;
}
HUDTargetDamage::~HUDTargetDamage()
{
delete m_TargetName;
delete m_TargetRangeText;
}
void HUDTargetDamage::Reset (void)
{
m_DamageFlashTime = 0;
m_HitFlashTime = 0;
int i;
m_Weapons.clear ();
for (i=0;i<MAX_HUD_DAMAGE_ZONE+1;i++)
{
m_HitFlashCount[i] = 0;
m_DamageValues[i] = 0;
m_ArmorValues[i] = 0;
}
// MSL 5.03 Target Damage Display
Verify (m_TargetMechID >=0);
Verify (m_TargetMechID <= LastMechID);
AddTexture (texturename[m_TargetMechID],0,texuv[m_TargetMechID][0][0],texuv[m_TargetMechID][0][1],texuv[m_TargetMechID][0][2],texuv[m_TargetMechID][0][3],128,128); // left leg
AddTexture (texturename[m_TargetMechID],1,texuv[m_TargetMechID][1][0],texuv[m_TargetMechID][1][1],texuv[m_TargetMechID][1][2],texuv[m_TargetMechID][1][3],128,128); // right leg
AddTexture (texturename[m_TargetMechID],2,texuv[m_TargetMechID][2][0],texuv[m_TargetMechID][2][1],texuv[m_TargetMechID][2][2],texuv[m_TargetMechID][2][3],128,128); // left arm
AddTexture (texturename[m_TargetMechID],3,texuv[m_TargetMechID][3][0],texuv[m_TargetMechID][3][1],texuv[m_TargetMechID][3][2],texuv[m_TargetMechID][3][3],128,128); // right arm
AddTexture (texturename[m_TargetMechID],4,texuv[m_TargetMechID][4][0],texuv[m_TargetMechID][4][1],texuv[m_TargetMechID][4][2],texuv[m_TargetMechID][4][3],128,128); // right torso
AddTexture (texturename[m_TargetMechID],5,texuv[m_TargetMechID][5][0],texuv[m_TargetMechID][5][1],texuv[m_TargetMechID][5][2],texuv[m_TargetMechID][5][3],128,128); // left torso
AddTexture (texturename[m_TargetMechID],6,texuv[m_TargetMechID][6][0],texuv[m_TargetMechID][6][1],texuv[m_TargetMechID][6][2],texuv[m_TargetMechID][6][3],128,128); // center torso
AddTexture ("hud\\hud5",7,220,0,252,50); // center torso rear
AddTexture (texturename[m_TargetMechID],8,texuv[m_TargetMechID][8][0],texuv[m_TargetMechID][8][1],texuv[m_TargetMechID][8][2],texuv[m_TargetMechID][8][3],128,128); // head
AddTexture (texturename[m_TargetMechID],9,texuv[m_TargetMechID][9][0],texuv[m_TargetMechID][9][1],texuv[m_TargetMechID][9][2],texuv[m_TargetMechID][9][3],128,128); // special 1
AddTexture (texturename[m_TargetMechID],10,texuv[m_TargetMechID][10][0],texuv[m_TargetMechID][10][1],texuv[m_TargetMechID][10][2],texuv[m_TargetMechID][10][3],128,128); // special 2
AddTexture ("hud\\hud5",11,229,68,238,118); // special 1 rear
AddTexture ("hud\\hud5",12,243,68,254,118); // special 2 rear
if(!hsh_initialized)
{
;
}
else
{
//sanghoon
mfd_device.LoadTargetTexture(texturename[m_TargetMechID]);
}
}
void HUDTargetDamage::Update (Stuff::Time till)
{
if (m_DamageFlashTime == 0)
m_DamageFlashTime = till;
if (m_HitFlashTime == 0)
m_HitFlashTime = till;
while (m_DamageFlashTime <= till)
{
m_DamageFlash = !m_DamageFlash;
m_DamageFlashTime += 1.0/6.0;
}
while (m_HitFlashTime <= till)
{
int i;
for (i=0;i<MAX_HUD_DAMAGE_ZONE+1;i++)
{
if (m_HitFlashCount[i])
m_HitFlashCount[i]++;
if (m_HitFlashCount[i] == MAX_FLASH)
m_HitFlashCount[i] = 0;
}
m_HitFlashTime += 1.0/6.0;
}
inherited::Update (till);
}
void HUDTargetDamage::TargetTonnage (Stuff::Scalar value)
{
m_TargetTonnage = value;
if (m_TargetVehicle.GetCurrent ())
{
if (m_TargetVehicle.GetCurrent ()->IsDerivedFrom (Vehicle::DefaultData))
{
Vehicle *veh;
veh = Cast_Object (Vehicle *,m_TargetVehicle.GetCurrent ());
int i;
for (i=0;i<MAX_HUD_DAMAGE_ZONE+1;i++)
{
m_ArmorValues[i] = veh->armorArray[i];
}
}
if (value> 0)
{
Verify (m_TargetVehicle.GetCurrent ()->IsDerivedFrom (Mech::DefaultData));
Mech *mech = Cast_Object(Mech *, m_TargetVehicle.GetCurrent());
Check_Object (mech);
int i;
for (i=0;i<MAX_HUD_DAMAGE_ZONE+1;i++)
{
m_DamageValues[i] = mech->damageArray[i];
}
}
}
}
bool HUDTargetDamage::ToggleMode (void)
{
if (m_TargetVehicle.GetCurrent ())
{
if (!m_TargetVehicle.GetCurrent ()->IsDerivedFrom (Mech::DefaultData))
m_ArmorMode = false;
else
{
m_ArmorMode = !m_ArmorMode;
m_LastMechMode = m_ArmorMode;
}
}
else
m_ArmorMode = false;
VehicleInterface::GetInstance()->hudTargetDamageMode = m_ArmorMode;
return m_ArmorMode;
}
void HUDTargetDamage::Target (Entity *veh)
{
int i;
Vehicle *vehicle = m_Vehicle.GetCurrent();
if (!vehicle)
return;
if (veh && (vehicle->GetRelativeAlignment(veh->GetAlignment()) == Entity::Player))
m_ShowData = true;
else
m_ShowData = false;
m_Weapons.clear ();
m_TargetVehicle.Remove ();
for (i=0;i<MAX_HUD_DAMAGE_ZONE+1;i++)
{
m_ArmorValues[i] = -1;
m_DamageValues[i] = -1;
}
if (veh)
{
Check_Object (veh);
m_TargetVehicle.Add (veh);
// MSL 5.04 Target MFD Weapon Listing
// Works for Bots
// What about Players?
// To Much info for Players?
// Is the Weapon Listing matching up with the actual weapon?
if(!MWApplication::GetInstance()->networkingFlag)
// if(MWApplication::GetInstance()->networkingFlag)
{
if (veh->IsDerivedFrom (Vehicle::DefaultData))
{
Vehicle *vehicle = Cast_Object (Vehicle *,veh);
Stuff::ChainIteratorOf<Weapon *> weaponIterator (&vehicle->weaponChain);
m_Weapons.reserve (vehicle->weaponChain.GetSize ());
Weapon *weapon;
while((weapon = weaponIterator.ReadAndNext()) != NULL)
{
Check_Object(weapon);
const Weapon__GameModel *model = weapon->GetGameModel ();
Verify (model);
m_Weapons.push_back (WeaponData (LookupWeapon (model->itemID),weapon->internalLocation));
}
}
if (!veh->IsDerivedFrom (Mech::DefaultData))
{
m_ArmorMode = false;
}
else
{
m_ArmorMode = m_LastMechMode;
}
}
}
}
const char weapon_name[58][8]={
"AC10",
"AC5",
"AM5",
"BMB LAS",
"FLAMER",
"FLARE",
"GAUSS",
"HIGH EX",
"L GAUSS",
"LBX10",
"LBX20",
"LG LAS",
"LG PLS",
"LNG TOM",
"LRM10",
"LRM15",
"LRM20",
"LRM5",
"MD LAS",
"MD PLS",
"MG",
"MRM10",
"MRM20",
"MRM30",
"MRM40",
"NARC",
"PPC",
"SM LAS",
"SM PLS",
"SRM2",
"SRM4",
"SRM6",
"THDRBLT",
"ULTRA 2",
"ULTRA 5",
"C ERLGL",
"C ERMDL",
"C ERPPC",
"C ERSML",
"C ELAMR",
"C GAUSS",
"C LAMS",
"C LBX10",
"C LBX20",
"C LGPLS",
"C LRM10",
"C LRM15",
"C LRM20",
"C LRM5",
"C MDPLS",
"C MG",
"C NARC",
"C SMPLS",
"C STRK2",
"C STRK4",
"C STRK6",
"C UAC2",
"C UAC5"
// {W_SmallLaser ,27},
// {W_MediumLaser ,18},
// {W_LargeLaser ,11},
// {W_SmallPulse ,28},
// {W_MediumPulse ,19},
// {W_LargePulse ,12},
// {W_ERSmallLaser ,27},
// {W_ERMediumLaser ,18},
// {W_ERLargeLaser ,11},
// {W_SmallXPulse, 28},
// {W_MedXPulse ,28},
// {W_LargeXPulse ,28},
// {W_ClanSmallPulse ,52},
// {W_ClanMediumPulse,49},
// {W_ClanLargePulse ,44},
// {W_ClanERSmallLaser ,38},
// {W_ClanERMediumLaser ,36},
// {W_ClanERLargeLaser ,35},
// {W_PPC ,26},
// {W_ERPPC, 26},
// {W_ClanERPPC ,37},
// {W_Flamer,4},
// {W_ERFlamer,4},
// {W_Bombast ,3},
// {W_SRM2 ,29},
// {W_SRM4 ,30},
// {W_SRM6 ,31},
// {W_SSRM2 ,53},
// {W_SSRM4 ,54},
// {W_SSRM6 ,55},
// {W_ClanSSRM2 ,53},
// {W_ClanSSRM4 ,54},
// {W_ClanSSRM6 ,55},
// {W_MRM10 ,21},
// {W_MRM20 ,22},
// {W_MRM30 ,23},
// {W_MRM40 ,24},
// {W_SMRM10 ,21},
// {W_SMRM20 ,22},
// {W_SMRM30 ,23},
// {W_SMRM40 ,24},
// {W_ClanSMRM10 ,21},
// {W_ClanSMRM20 ,22},
// {W_ClanSMRM30 ,23},
// {W_ClanSMRM40 ,24},
// {W_LRM5 ,17},
// {W_LRM10 ,14},
// {W_LRM15 ,15},
// {W_LRM20 ,16},
// {W_ClanLRM5 ,48},
// {W_ClanLRM10 ,45},
// {W_ClanLRM15 ,46},
// {W_ClanLRM20 ,47},
// {W_Thunderbolt ,32},
// {W_NarcBeacon ,25},
// {W_ClanNarcBeacon ,51},
// {W_Flare ,51},
// {W_HighExplosive ,51},
// {W_ArtilleryStrike ,51},
// {W_AC2 ,1},
// {W_AC5 ,1},
// {W_AC10 ,0},
// {W_AC20 ,0},
// {W_LBXAC10 ,9},
// {W_LBXAC20 ,10},
// {W_ClanLBXAC10 ,42},
// {W_ClanLBXAC20 ,43},
// {W_UltraAC2 ,33},
// {W_UltraAC5 ,34},
// {W_UltraAC10 ,34},
// {W_UltraAC20 ,34},
// {W_ClanUltraAC2 ,56},
// {W_ClanUltraAC5 ,57},
// {W_ClanUltraAC10 ,57},
// {W_ClanUltraAC20 ,51},
// {W_LightGauss ,8},
// {W_Gauss ,6},
// {W_HeavyGauss ,51},
// {W_ClanGauss ,40},
// {W_MachineGun ,20},
// {W_ClanMachineGun ,50},
// {W_LongTom ,13},
// {W_RTXAC2, 77},
// {W_RTXAC5, 78},
};
static char mfd_text_targetdamage[8][32]={
"NEAREST\nFRIENDLY","NEXT\nFRIENDLY","PREV\nFRIENDLY","TARGET\nMODE",
"NEAREST\nENEMY","NEXT\nENEMY","PREV\nENEMY","CROSSHAIR\nTARGET",
};
// MSL ADD MECH
// -1 = OFF
static index_redirection[LastMechID+1]={
0 , // Annihilator
1 , // Archer
2 , // Arctic Wolf
3 , // Ares
4 , // Argus
5 , // Assassin2
6 , // Atlas
7 , // Avatar
8 , // Awesome
9 , // Battlemaster
10 , // BattlemasterIIc
11 , // Behemoth
12 , // Behemoth II
13 , // Black Hawk
14 , // Black Knight
15 , // Black Lanner
16 , // Brigand
17 , // Bushwacker
18 , // Catapult
19 , // cauldron-born
20 , // Chimera
21 , // Commando
22 , // Cougar
23 , // Cyclops
24 , // Daishi
25 , // Deimos
26 , // Dragon
27 , // Fafnir
28 , // Flea
29 , // Gladiator
30 , // Grizzly
31 , // Hauptmann
32 , // Hellhound
33 , // Hellspawn
34 , // Highlander
35 , // Hollander II
36 , // Hunchback
37 , // Kodiak
38 , // Loki
39 , // Longbow
40 , // Madcat
41 , // Madcat Mk. II
42 , // Masakari
43 , // Mauler
44 , // Novacat
45 , // Osiris
46 , // Owens
47 , // Puma
48 , // Raven
49 , // Rifleman
50 , // Ryoken
51 , // Shadowcat
52 , // Solitaire
53 , // Sunder
54 , // Templar
55 , // Thanatos
56 , // Thor
57 , // Uller
58 , // Urbanmech
59 , // Uziel
60 , // Victor
61 , // Vulture
62 , // Warhammer
63 , // Wolfhound
64 , // Zeus
};
int GetMechIndex(int idx_org)
{
// MSL 5.02
// if(0<=idx_org && idx_org<21){
if(0<=idx_org && idx_org<LastMechID+1){
return index_redirection[idx_org];
}
return -1;
}
void HUDTargetDamage::DrawImplementation(void)
{
if(!hsh_initialized){
Point3D size;
// const bartable[10] = {658,671,685,699,713,727,741,755,771,785};
// 0 1 2 3 4 5 6 7 8 9
const bartable[11] = {658,670,683,696,709,722,735,748,763,776,789};
DWORD color = MakeColor (0,32,0,150);
if (m_ArmorMode)
{
my_DrawRect (0,467,141,485,color); // name
my_DrawRect (0,488,141,586,color); // armor
color = MakeColor (0,126,0,255);
DrawSpecFrame (0,467,141,485,color);
DrawSpecFrame (0,488,141,586,color);
}
else
{
my_DrawRect (0,467,183,485,color); // name
my_DrawRect (73,488,183,599,color); // diagram
my_DrawRect (0,568,70,599,color); // weapons
color = MakeColor (0,126,0,255);
DrawSpecFrame (0,467,183,485,color); // name
DrawSpecFrame (0,488,70,565,color); // camera
DrawSpecFrame (73,488,183,599,color); // diagram
DrawSpecFrame (0,568,70,599,color); // weapons
}
if (!m_TargetVehicle.GetCurrent ())
return;
// MSL 5.03 Target Damage Display
if (m_TargetVehicle.GetCurrent ())
{
Mech *targetmech;
targetmech = Cast_Object (Mech *,m_TargetVehicle.GetCurrent ());
const Mech__GameModel *model = static_cast<const Mech__GameModel *> (targetmech->GetGameModel ());
m_TargetMechID = model->mechID;
}
else
{
m_TargetMechID = 0;
}
if (m_ShowData)
{
if (!m_ArmorMode)
{
stlport::vector<WeaponData>::iterator iter;
int cury,curx;
cury = 570;
curx = 3;
size = m_Textures[100]->Size ();
for (iter= m_Weapons.begin ();iter != m_Weapons.end ();iter++)
{
if (iter->m_TextureID == -1)
continue;
color = m_DamageColors[m_DamageValues[iter->m_PartLoc]];
my_DrawRect (curx,cury,curx+30,cury+6,color);
m_Textures[100+(iter->m_TextureID)]->Draw (Point3D (curx+1.0f,cury+1.0f,0.9f),size,0xFF000000,HUDTexture::NO_FLIP,true);
cury += 6;
if ((cury+6) >= 598)
{
cury = 570;
curx = 33;
}
}
}
color = MakeColor (0,200,0,150);
if (m_TargetTonnage == -1)
{
//When target is not a mech..
Verify (!m_ArmorMode); // only mechs show armor mode
if (m_TargetVehicle.GetCurrent()->IsDerivedFrom (MWObject::DefaultData))
{
MWObject *veh = Cast_Object (MWObject *,m_TargetVehicle.GetCurrent ());
if (m_ArmorValues[0] != (veh->m_HitPoints / veh->m_MaxHitPoints))
m_HitFlashCount[0] = 1;
m_ArmorValues[0] = (veh->m_HitPoints / veh->m_MaxHitPoints);
int x,y;
size = m_Textures[20]->Size ();
x = 78;
y = 594;
color = Color ();
if (m_ArmorValues[0] != -1)
{
Scalar height;
Scalar tx;
tx = 141-73-10;
height = (m_ArmorValues[0]) * (599-488-10);
Clamp (height,0,(599-488-10));
// if (height > 2.0f)
{
// if (m_HitFlashCount[MAX_HUD_DAMAGE_ZONE] & 0x01)
// my_DrawRect (x,y,(int) (x+tx),(int) (y-height),MakeColor (255,255,255,255));
// else
{
int level;
level = (int) ((m_ArmorValues[0]*(MAX_HUD_DAMAGE_LEVEL))+0.5f);
level = MAX_HUD_DAMAGE_LEVEL - level;
Clamp (level,0,MAX_HUD_DAMAGE_LEVEL-2);
my_DrawRect (x,y,(int) (x+tx),(int) (y-height),m_DamageColors[level]);
}
}
DrawFrame (x,y,(int) (x+tx),y-(599-488-10),Color ());
}
}
}
else
{
//When target is a mech..
Verify (m_TargetVehicle.GetCurrent ()->IsDerivedFrom (Mech::DefaultData));
Mech *mech = Cast_Object(Mech *, m_TargetVehicle.GetCurrent());
Check_Object (mech);
int i;
for (i=0;i<MAX_HUD_DAMAGE_ZONE;i++)
{
if (m_DamageValues[i] != mech->damageArray[i])
m_HitFlashCount[i] = 1;
m_DamageValues[i] = mech->damageArray[i];
if (m_ArmorValues[i] != mech->armorArray[i])
m_HitFlashCount[i] = 1;
m_ArmorValues[i] = mech->armorArray[i];
}
color = MakeColor (0, 0, 0, 150);
Point3D size,loc;
if (m_ArmorMode)
{
//When target is a mech and in armor mode
int x,y;
size = m_Textures[20]->Size ();
// DrawLine (771-658,589,799-658,589,color);
// DrawLine (771-658,599,799-658,599,color);
// DrawLine (799-658,589,799-658,599,color);
x = 5;
y = 582;
color = Color ();
size = m_Textures[20]->Size ();
for (i=0;i<MAX_HUD_DAMAGE_ZONE;i++)
{
if (m_ArmorValues[trans_array[i]] != -1)
{
x = bartable[i]-658;
Scalar height;
Scalar tx;
tx = (TARGET_BARWIDTH - size.x)/2.0f;
height = (m_ArmorValues[trans_array[i]]) * TARGET_BARHEIGHT;
m_Textures[20+i]->Draw (Point3D ((Scalar) bartable[i]+1.0f-658,590.0f,0.9f),size,MakeColor (255,255,255,255),HUDTexture::NO_FLIP,true);
if (!(m_HitFlashCount[trans_array[i]] & 0x01))
m_Textures[40+i]->Draw (Point3D ((Scalar) bartable[i]+1.0f-658,589.0f,0.9f),size,MakeColor (255,255,255,255));
if (height > 2.0f)
{
if (m_HitFlashCount[trans_array[i]] & 0x01)
my_DrawRect (x+3,y,(int) (x+TARGET_BARWIDTH-1),(int) (y-height),MakeColor (255,255,255,255));
else
my_DrawRect (x+3,y,(int) (x+TARGET_BARWIDTH-1),(int) (y-height),m_DamageColors[m_DamageValues[trans_array[i]]]);
}
DrawFrame (x+3,y,x+TARGET_BARWIDTH-1,y-TARGET_BARHEIGHT,Color ());
}
}
color = MakeColor (0,126,0,255);
DrawLine (0,589,142,589,color);
DrawLine (0,599,142,599,color);
for (x=0;x<11;x++)
{
DrawLine (bartable[x]-658,589,bartable[x]-658,599,color);
}
DrawLine (142,589,142,599,color);
}
else
{
// MSL 5.03 Target Damage Display
Verify (m_TargetMechID >=0);
Verify (m_TargetMechID <= LastMechID);
AddTexture (texturename[m_TargetMechID],0,texuv[m_TargetMechID][0][0],texuv[m_TargetMechID][0][1],texuv[m_TargetMechID][0][2],texuv[m_TargetMechID][0][3],128,128); // left leg
AddTexture (texturename[m_TargetMechID],1,texuv[m_TargetMechID][1][0],texuv[m_TargetMechID][1][1],texuv[m_TargetMechID][1][2],texuv[m_TargetMechID][1][3],128,128); // right leg
AddTexture (texturename[m_TargetMechID],2,texuv[m_TargetMechID][2][0],texuv[m_TargetMechID][2][1],texuv[m_TargetMechID][2][2],texuv[m_TargetMechID][2][3],128,128); // left arm
AddTexture (texturename[m_TargetMechID],3,texuv[m_TargetMechID][3][0],texuv[m_TargetMechID][3][1],texuv[m_TargetMechID][3][2],texuv[m_TargetMechID][3][3],128,128); // right arm
AddTexture (texturename[m_TargetMechID],4,texuv[m_TargetMechID][4][0],texuv[m_TargetMechID][4][1],texuv[m_TargetMechID][4][2],texuv[m_TargetMechID][4][3],128,128); // right torso
AddTexture (texturename[m_TargetMechID],5,texuv[m_TargetMechID][5][0],texuv[m_TargetMechID][5][1],texuv[m_TargetMechID][5][2],texuv[m_TargetMechID][5][3],128,128); // left torso
AddTexture (texturename[m_TargetMechID],6,texuv[m_TargetMechID][6][0],texuv[m_TargetMechID][6][1],texuv[m_TargetMechID][6][2],texuv[m_TargetMechID][6][3],128,128); // center torso
AddTexture ("hud\\hud5",7,220,0,252,50); // center torso rear
AddTexture (texturename[m_TargetMechID],8,texuv[m_TargetMechID][8][0],texuv[m_TargetMechID][8][1],texuv[m_TargetMechID][8][2],texuv[m_TargetMechID][8][3],128,128); // head
AddTexture (texturename[m_TargetMechID],9,texuv[m_TargetMechID][9][0],texuv[m_TargetMechID][9][1],texuv[m_TargetMechID][9][2],texuv[m_TargetMechID][9][3],128,128); // special 1
AddTexture (texturename[m_TargetMechID],10,texuv[m_TargetMechID][10][0],texuv[m_TargetMechID][10][1],texuv[m_TargetMechID][10][2],texuv[m_TargetMechID][10][3],128,128); // special 2
AddTexture ("hud\\hud5",11,229,68,238,118); // special 1 rear
AddTexture ("hud\\hud5",12,243,68,254,118); // special 2 rear
if(!hsh_initialized)
{
;
}
else
{
//sanghoon
mfd_device.LoadTargetTexture(texturename[m_TargetMechID]);
}
Point3D boxloc;
boxloc = Location ();
loc.x = boxloc.x;
loc.y = boxloc.y;
int fred;
fred = 0;
for (i=0;i<11;i++)
{//What does the number 13 mean here?
#if 0
if (i != fred)
{
continue;
}
#endif
Verify (m_Textures[i]);
switch (i)
{
case 7: // rear
break;
case 11: // s1
break;
case 12: // s2
break;
default:
if ((m_DamageValues[i] <= 5) && (m_DamageValues[i]>=0))
{
if ((m_DamageValues[i] != 4) || (m_DamageFlash))
{
loc.x = 73 + (offset[m_TargetMechID][i][0]);
loc.y = 482 + (offset[m_TargetMechID][i][1]);
size = m_Textures[i]->Size ();
m_Textures[i]->Draw (loc,size,m_DamageColors[m_DamageValues[i]]);
}
}
break;
}
}
}
}
}
// move it here so that the target range text readout is on top of the damage bars
m_TargetName->Color (MakeColor (73,231,73,255));
m_TargetName->TopLeft (2,468);
m_TargetName->BottomRight (140,484);
m_TargetRangeText->Color (MakeColor (241,33,33,255));
m_TargetRangeText->TopLeft (2,468);
m_TargetRangeText->BottomRight (50,484);
DWORD textw,texth;
m_TargetName->DrawSize (textw,texth);
m_TargetName->Draw (Point3D (140.0f - textw,468,0.9f));
m_TargetRangeText->DrawSize (textw,texth);
m_TargetRangeText->Draw (Point3D (50.0f - textw,468,0.9f));
}
else
if(mfd_device.BeginChannel(3))
{
mfd_device.DrawMFDBackText( mfd_text_targetdamage);
mfd_device.pD3DDevice->SetTexture(0,0);
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, TRUE );
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA );
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA );
if (m_ArmorMode)
{
mfd_device.DrawThickFrame(7,102,635,390,2,0xFFFFFFFF);
}
else
{
mfd_device.DrawThickFrame( 7,102,317,331,2,0xFFFFFFFF);
mfd_device.DrawThickFrame( 7,337,317,434,2,0xFFFFFFFF);
mfd_device.DrawThickFrame(323,102,635,434,2,0xFFFFFFFF);
}
mfd_device.DrawThickFrame(7,44,635,95,2,0xFFFFFFFF);
if (m_TargetVehicle.GetCurrent ())
{
//Draw 3D target or 2D target.
if (!m_ArmorMode)
{
if(g_f3dtarget)
{
mfd_device.pD3DDevice->SetTexture(0,mfd_device.pDDSMechTexture);
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, FALSE);
mfd_device.pD3DDevice->SetTextureStageState(0,D3DTSS_MAGFILTER,D3DTFG_LINEAR);
mfd_device.pD3DDevice->SetTextureStageState(0,D3DTSS_MINFILTER,D3DTFG_LINEAR);
mfd_device.tw=128,mfd_device.th=128;
mfd_device.DrawTexture2(42,104,240,204,0xFFFFFFFF,0,10,120,112);
mfd_device.tw=512,mfd_device.th=512;
mfd_device.pD3DDevice->SetTexture(0,0);
}
else
{
if(m_TargetTonnage != -1)
{
Mech *mech = Cast_Object(Mech *, m_TargetVehicle.GetCurrent());
const Mech__GameModel *model = static_cast<const Mech__GameModel *> (mech->GetGameModel ());
int mechindex=GetMechIndex(model->mechID);
if(mechindex>=0)
{
//Draw only supported mechs.
// MSL 5.02 Target MFD Image
int x=(mechindex%8)*128;
int y=(mechindex/8)*128;
// int x=(mechindex%4)*128;
// int y=(mechindex/4)*128;
//Draw target in 2D.
mfd_device.pD3DDevice->SetTexture(0,mfd_device.pDDSMechTexture);
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, FALSE);
mfd_device.pD3DDevice->SetTextureStageState(0,D3DTSS_MAGFILTER,D3DTFG_LINEAR);
mfd_device.pD3DDevice->SetTextureStageState(0,D3DTSS_MINFILTER,D3DTFG_LINEAR);
//Need to write routine to calculate coordinates per mech type...
// MSL 5.02 Target MFD Image
mfd_device.tw=1024,mfd_device.th=1024;
// MSL 5.02 Target MFD Image Resize
// mfd_device.DrawTexture2(42,104,240,204,0xFFFFFFFF,x,y,x+120,y+120);
mfd_device.DrawTexture2(42,104,240,225,0xFFFFFFFF,x,y,x+120,y+120);
mfd_device.tw=512,mfd_device.th=512;
mfd_device.pD3DDevice->SetTexture(0,0);
}
}
}
}
// MSL 5.03 Target Damage Display
if (m_TargetVehicle.GetCurrent ())
{
Mech *targetmech;
targetmech = Cast_Object (Mech *,m_TargetVehicle.GetCurrent ());
const Mech__GameModel *model = static_cast<const Mech__GameModel *> (targetmech->GetGameModel ());
m_TargetMechID = model->mechID;
}
else
{
m_TargetMechID = 0;
}
// MSL 5.03 Damage on Secondary
if (g_nAuxilMode == 2)
{
if (m_ShowData)
{
// if(radar_device.pDDSRadarDamageTexture==0)
radar_device.LoadRadarDamageTexture(texturename[m_TargetMechID]);
// clear back ground texture
RECT rc={140,407,340,607};
DDBLTFX fx={0,};
fx.dwSize=sizeof(fx);
fx.dwFillColor=0;
radar_device.pDDSTarget->Blt(&rc,NULL,NULL,DDBLT_COLORFILL ,&fx);
for (int i=0;i<11;i++)
{//What does the number 13 mean here?
int dv=m_DamageValues[i];
DWORD color=0xFF000000;
if(0<=dv && dv<=5)
color=SH_DamageColor[dv];
if ((m_DamageValues[i] <= 5) && (m_DamageValues[i]>=0))
{
if ((m_DamageValues[i] != 4) || (m_DamageFlash))
{
color = m_DamageColors[m_DamageValues[i]];
radar_device.pD3DDevice->SetTexture(0,radar_device.pDDSRadarDamageTexture);
radar_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, TRUE );
radar_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA );
radar_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA );
radar_device.tw=256,radar_device.th=256;
radar_device.DrawTexture(
(offset3[m_TargetMechID][i][0]/2)+138,
(offset3[m_TargetMechID][i][1]/2)+406,
color,
texuv3[m_TargetMechID][i][0]/2,
texuv3[m_TargetMechID][i][1]/2,
texuv3[m_TargetMechID][i][2]/2,
texuv3[m_TargetMechID][i][3]/2
);
radar_device.tw=512,radar_device.th=512;
}
}
}
}
else
{
// clear back ground texture
RECT rc={140,407,340,607};
DDBLTFX fx={0,};
fx.dwSize=sizeof(fx);
fx.dwFillColor=0;
radar_device.pDDSTarget->Blt(&rc,NULL,NULL,DDBLT_COLORFILL ,&fx);
}
}
if (m_ShowData)
{
//Routine to display weapon status of target in lower-left..
if (!m_ArmorMode)
{
stlport::vector<WeaponData>::iterator iter;
const int iy=350;//initial y;
const int rh=18;//row height
const int cw=80;//column width
int cury= iy;
int curx = 20;
for (iter= m_Weapons.begin ();iter != m_Weapons.end ();iter++)
{
if (iter->m_TextureID == -1)continue;
int dv=m_DamageValues[iter->m_PartLoc];//damagevalue
if(dv<5)
{
DWORD shcolor=SH_DamageColor[dv];
mfd_device.DrawQuad(curx,cury,curx+cw-5,cury+rh-1,shcolor);
mfd_device.pFont[1].DrawText(curx,cury+rh/2,0xFF000000,weapon_name[iter->m_TextureID],TEXTALIGN_LEFT|TEXTALIGN_VCENTER);
}
cury += rh;
if ((cury+rh) >= 430)
{
cury = iy;
curx += cw;
}
}
}
if (m_TargetTonnage == -1)
{
//When target is not a mech..
Verify (!m_ArmorMode); // only mechs show armor mode
if (m_TargetVehicle.GetCurrent()->IsDerivedFrom (MWObject::DefaultData))
{
MWObject *veh = Cast_Object (MWObject *,m_TargetVehicle.GetCurrent ());
if (m_ArmorValues[0] != (veh->m_HitPoints / veh->m_MaxHitPoints))
m_HitFlashCount[0] = 1;
m_ArmorValues[0] = (veh->m_HitPoints / veh->m_MaxHitPoints);
if (m_ArmorValues[0] != -1)
{
//Draw damage bar graph. Height and color are expressed simultaneously.
int level;
level = (int) ((m_ArmorValues[0]*(MAX_HUD_DAMAGE_LEVEL))+0.5f);
level = MAX_HUD_DAMAGE_LEVEL - level;
Clamp (level,0,MAX_HUD_DAMAGE_LEVEL-2);
float armorval=m_ArmorValues[0];
Clamp(armorval,0,1);
mfd_device.DrawQuad(480-60,(int)(430-armorval*316),480+60,430,SH_DamageColor[level]);
mfd_device.DrawFrame(480-60,114,480+60,430,0xFFFFFFFF);
}
}
}//When the target is not a mech.
else
{
//When target is a mech..
Verify (m_TargetVehicle.GetCurrent ()->IsDerivedFrom (Mech::DefaultData));
Mech *mech = Cast_Object(Mech *, m_TargetVehicle.GetCurrent());
Check_Object (mech);
int i;
for (i=0;i<MAX_HUD_DAMAGE_ZONE;i++)
{
if (m_DamageValues[i] != mech->damageArray[i]) m_HitFlashCount[i] = 1;
m_DamageValues[i] = mech->damageArray[i];
if (m_ArmorValues[i] != mech->armorArray[i]) m_HitFlashCount[i] = 1;
m_ArmorValues[i] = mech->armorArray[i];
}
if (m_ArmorMode)
{
//When target is a mech and in armor mode
for (i=0;i<MAX_HUD_DAMAGE_ZONE;i++)
{
int tr=trans_array[i];
if (m_ArmorValues[tr] != -1)
{
int x = i*58;
int h=(int)(m_ArmorValues[tr]*280);
int u1=i%8*58;
int v1=403+i/8*49;
int u2=u1+58;
int v2=v1+42;
Clamp(h,0,280);
DWORD hsh_color=(m_HitFlashCount[tr] & 0x01)?0xFFFFFFFF:SH_DamageColor[m_DamageValues[tr]];
DWORD hsh_color2=(m_HitFlashCount[tr] & 0x01)?0xFFFFFFFF:0xFFC0C0C0;
mfd_device.pD3DDevice->SetTexture(0,mfd_device.pDDSTexture);
mfd_device.DrawTexture(x,392,hsh_color2,u1,v1,u2,v2);
x+=10;
mfd_device.pD3DDevice->SetTexture(0,0);
mfd_device.DrawQuad(x,388-h,x+38,388,hsh_color);
mfd_device.DrawFrame(x,388-280,x+38,388,0xFFFFFFFF);
}
}
}
else
{
// MSL 5.03 Target Damage Display
mfd_device.LoadTargetTexture(texturename[m_TargetMechID]);
//When target is a mech and NOT in armor mode..
if(mfd_device.pDDSTargetTexture==0)
mfd_device.LoadTargetTexture(texturename[m_TargetMechID]);
for (i=0;i<11;i++)
{//What does the number 13 mean here?
int dv=m_DamageValues[i];
DWORD color=0xFF000000;
if(0<=dv && dv<=5)color=SH_DamageColor[dv];
switch (i)
{
case 7: // rear
break;
case 11: // s1
break;
case 12:
break;
default:
if ((m_DamageValues[i] <= 5) && (m_DamageValues[i]>=0))
{
if ((m_DamageValues[i] != 4) || (m_DamageFlash))
{
mfd_device.pD3DDevice->SetTexture(0,mfd_device.pDDSTargetTexture);
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, TRUE );
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA );
mfd_device.pD3DDevice->SetRenderState( D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA );
mfd_device.DrawTexture(
offset2[m_TargetMechID][i][0]+312,
offset2[m_TargetMechID][i][1]+92,
color,
texuv2[m_TargetMechID][i][0],
texuv2[m_TargetMechID][i][1],
texuv2[m_TargetMechID][i][2],
texuv2[m_TargetMechID][i][3]
);
}
}
break;
}
}
}
}//When the target is a mech.
}//m_ShowData
mfd_device.pFont[0].DrawText(40,69,0xFFFFFFFF,hsh_targetrange,TEXTALIGN_LEFT|TEXTALIGN_VCENTER);
mfd_device.pFont[0].DrawText(605,69,0xFFFFFFFF,hsh_targetname,TEXTALIGN_RIGHT|TEXTALIGN_VCENTER);
}
mfd_device.EndChannel();
}
}