(lcs) reversed CScrollBar #1297

Open
asm95 wants to merge 2 commits from asm95/lcs-scrollbar into lcs

@ -377,10 +377,16 @@ uint8 ScrollCharSet[59][5] = {
// ---------- CMovingThings ----------
enum eScrollBarTypes
{
SCROLL_ARENA_STRING
SCROLL_BUSINESS,
SCROLL_TRAFFIC,
SCROLL_ENTERTAINMENT,
SCROLL_AIRPORT_DOORS,
SCROLL_AIRPORT_FRONT,
SCROLL_STORE,
SCROLL_USED_CARS
};
CScrollBar aScrollBars[1];
CScrollBar aScrollBars[12];
CMovingThing CMovingThings::StartCloseList;
CMovingThing CMovingThings::EndCloseList;
@ -424,15 +430,29 @@ void CMovingThings::Init()
}
}
// only type SCROLL_TRAFFIC is in unused
aScrollBars[0].Init(CVector( 228.8f, -669.0f, 39.5f), CVector( 228.8f, -649.0f, 42.0f), SCROLL_BUSINESS, 255, 128, 0, 0.30f);
aScrollBars[1].Init(CVector( -1090.11f, -584.224f, 13.246f), CVector( -1090.11f, -591.04797f, 13.781f), SCROLL_AIRPORT_DOORS, 255, 0, 0, 0.11f);
aScrollBars[2].Init(CVector( -1090.11f, -602.04602f, 13.246f), CVector( -1090.11f, -608.87f, 13.781f), SCROLL_AIRPORT_DOORS, 0, 255, 0, 0.11f);
aScrollBars[3].Init(CVector( -1090.11f, -619.81702f, 13.246f), CVector( -1090.11f, -626.64099f, 13.781f), SCROLL_AIRPORT_DOORS, 255, 128, 0, 0.11f);
aScrollBars[4].Init(CVector( -754.078f, -633.50897f, 18.910999f), CVector( -754.078f, -609.86902f, 21.511f), SCROLL_AIRPORT_FRONT, 100, 100, 255, 0.30f);
aScrollBars[5].Init(CVector( -754.078f, -586.672f, 18.910999f), CVector( -754.078f, -563.03198f, 21.511f), SCROLL_AIRPORT_FRONT, 100, 100, 255, 0.30f);
aScrollBars[6].Init(CVector( 85.473f, -1070.012f, 31.0f), CVector( 129.47301f, -1081.012f, 34.348f), SCROLL_STORE, 100, 100, 255, 0.30f);
aScrollBars[7].Init(CVector(74.822998f, -1086.379f, 30.250999f), CVector( 60.0f, -1082.412f, 32.909f), SCROLL_ENTERTAINMENT, 255, 255, 128, 0.30f);
aScrollBars[8].Init(CVector( -29.465f, -1034.743f, 32.534f), CVector( -38.334f, -1032.459f, 33.679001f), SCROLL_ENTERTAINMENT, 150, 255, 50, 0.11f);
aScrollBars[9].Init(CVector( -36.959f, -1030.7371f, 32.534f), CVector(-45.727001f, -1028.053f, 33.679001f), SCROLL_ENTERTAINMENT, 150, 255, 50, 0.11f);
aScrollBars[10].Init(CVector( -45.375f, -1027.2371f, 32.534f), CVector(-53.144001f, -1024.754f, 33.679001f), SCROLL_ENTERTAINMENT, 150, 255, 50, 0.11f);
aScrollBars[11].Init(CVector( 1207.5f, -63.320999f, 19.6f), CVector( 1212.722f, -70.217003f, 21.056999f), SCROLL_USED_CARS, 255, 128, 0, 0.30f);
// LCS: removed
// CEscalators::Init();
// aScrollBars[0].Init(CVector(-1069.209f, 1320.126f, 18.848f), CVector(-1069.209f, 1342.299f, 22.612f), SCROLL_ARENA_STRING, 128, 255, 0, 0.3f);
}
void CMovingThings::Shutdown()
{
for (int16 i = 0; i < ARRAY_SIZE(aScrollBars); i++)
aScrollBars[i].SetVisibility(false);
Nick007J commented 3 years ago (Migrated from github.com)
Review

Looks like all digits originally were at most 3 digits after decimal point, e.g. -591.048f. Same applies to all initialization here.

Looks like all digits originally were at most 3 digits after decimal point, e.g. -591.048f. Same applies to all initialization here.
asm95 commented 3 years ago (Migrated from github.com)
Review

Those extra digits were usually appearing in IDA. Anyway, I'll remove those cases with more than 3 decimal digits.

Those extra digits were usually appearing in IDA. Anyway, I'll remove those cases with more than 3 decimal digits.
aScrollBars[0].SetVisibility(false);
CEscalators::Shutdown();
}
@ -645,7 +665,23 @@ void CScrollBar::Init(CVector pos1, CVector pos2, uint8 type, uint8 red, uint8 g
m_uRed = red;
m_uGreen = green;
m_uBlue = blue;
m_fScale = scale;
m_fScale = scale * 2;
}
const char* FindTunnelMessage() {
if (CStats::CommercialPassed)
return "LIBERTY TUNNEL HAS BEEN OPENED TO ALL TRAFFIC . . . ";
if (CStats::IndustrialPassed)
return "FIRST PHASE LIBERTY TUNNEL HAS BEEN COMPLETED . . . ";
return "FIRST PHASE LIBERTY TUNNEL ABOUT TO BE COMPLETED . . . ";
}
const char* FindBridgeMessage() {
if (CStats::CommercialPassed)
return "WORK SHY STRIKERS RETURN TO THEIR JOBS . . . STAUNTON LIFT BRIDGE IS OPERATIONAL AGAIN ";
if (CStats::IndustrialPassed)
return "LONG DELAYS BEHIND US AS CALLAHAN BRIDGE IS NEARLY COMPLETED . . . ";
return "THE GRAND OPENING OF CALLAHAN BRIDGE IS ONLY DAYS AWAY. . . ";
}
void CScrollBar::Update()
@ -670,46 +706,215 @@ void CScrollBar::Update()
if (m_Counter == 0 && ++m_MessageCurrentChar >= m_MessageLength)
{
const char* previousMessage = m_pMessage;
if (m_Type == SCROLL_ARENA_STRING) {
while (previousMessage == m_pMessage)
{
switch (CGeneral::GetRandomNumber() % 4)
while (previousMessage == m_pMessage)
{
if (m_Type == SCROLL_BUSINESS) {
switch (CGeneral::GetRandomNumber() % 7)
{
case 0:
switch (TonightsEvent) {
case 0:
m_pMessage = "MAIN EVENT TONIGHT: CAR RACING . . . ";
break;
case 1:
m_pMessage = "MAIN EVENT TONIGHT: DESTRUCTION DERBY . . . ";
break;
case 2:
m_pMessage = "MAIN EVENT TONIGHT: BIKE RACING . . . ";
break;
}
break;
m_pMessage = "SHARES DAV<15% JLI>18% MAM>32% STH<80%. . . "; break;
case 1:
switch (TonightsEvent) {
case 0:
m_pMessage = "FOR TICKETS TO THE HOT RING EVENT CALL 555-3764 . . . ";
break;
case 1:
m_pMessage = "FOR TICKETS TO THE BLOOD RING EVENT CALL 555-3765 . . . ";
break;
case 2:
m_pMessage = "FOR TICKETS TO THE DIRT RING EVENT CALL 555-3766 . . . ";
break;
}
break;
m_pMessage = "GANG WAR RAGES IN LIBERTY CITY . . . "; break;
case 2:
m_pMessage = "HYMAN MEMORIAL STADIUM. HOME TO SOME OF THE BIGGEST EVENTS OF"
" THE WESTERN HEMISPHERE. ALSO AVAILABLE FOR CHILDREN PARTIES. . . ";
m_pMessage = "SHARES MJD>23% CJW<5% RAMMAN<7% HNTR>43% NJM>12% AAG>110%. . . "; break;
case 3:
m_pMessage = FindTunnelMessage(); break;
case 4:
m_pMessage = FindBridgeMessage(); break;
case 5:
m_pMessage = FindTimeMessage(); break;
case 6:
if (
FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_FRENCH ||
FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_GERMAN
)
m_pMessage = FindTimeMessage();
else
m_pMessage = "WWW.GRANDTHEFTAUTO3.COM ";
break;
default: break;
}
}
else if (m_Type == SCROLL_TRAFFIC) {
switch (CGeneral::GetRandomNumber() % 8) {
case 0:
m_pMessage = "DRIVE SAFE . . . "; break;
case 1:
m_pMessage = "ROAD DEATHS UP ! GOOD DRIVERS DRIVE NICE . . . "; break;
case 2:
m_pMessage = "SPEEDING KILLS . . . SLOW DOWN . . . DELAYS EXPECTED. . . "; break;
case 3:
m_pMessage = FindTimeMessage();
m_pMessage = "CONGESTION EASING . . . "; break;
case 4:
if (CWeather::Foggyness > 0.5f)
m_pMessage = "VISIBILITY LOW ! ";
else if (CWeather::WetRoads > 0.5f)
m_pMessage = "SNOW EXPECTED ! ";
else
m_pMessage = "CAUTION: CARJACKING CRIME WAVE HITS CITY . . . HAVE A NICE DAY . . . ";
break;
default:
case 5:
m_pMessage = FindTunnelMessage(); break;
case 6:
m_pMessage = FindBridgeMessage(); break;
case 7:
m_pMessage = FindTimeMessage(); break;
default: break;
}
}
else if (m_Type == SCROLL_ENTERTAINMENT) {
switch (CGeneral::GetRandomNumber() % 12) {
case 0:
m_pMessage = " THE TECHNICOLOR SPECTACULAR )JESUS, MARY AND JOSEPH!) IS A GODSEND! BEING SUNG"
" ENTIRELY IN ARAMAIC, THE MUSICAL MAY BE DIFFICULT TO FOLLOW, BUT BOY THERE SURE ARE"
" SOME SANDAL-TAPPING TUNES IN THERE ! "; break;
case 1:
m_pMessage = " THE MUSICAL )WINGDING, SONS OF A BITCH TAKE FLIGHT) IS SLAYING THEM IN THEATERS"
" ACROSS TOWN. CRITICS HAVE DESCRIBED IT AS )BLOWING THE COBWEBS OFF THE MUSICAL GENRE"
" LIKE A DIVINE WIND) . . . IT)S AN EVENING OF MUSIC, DANCE, DEATH AND DESTRUCTION!"
" INCLUDES THE HIT SONG )ALL YOUR BASE ARE BELONG TO USA). YOU ARE SURE TO LEAVE WITH A"
" SMILE ON YOUR FAT FACE . . . "; break;
case 2:
m_pMessage = " THE UNMISSABLE )GTA3, THE MUSICAL) IS STILL RUNNING IN LIBERTY CITY THEATERS"
" AFTER 250 WEEKS . . . CONTROVERSY HAS PLAGUED THE PRODUCTION AFTER PRESSURE GROUPS"
" URGED CONCERN OVER A POSSIBLE CAUSAL LINK BETWEEN THE PLAY AND THE END OF THE"
" WORLD . . . "; break;
case 3:
m_pMessage = " THE OPERA IS MAKING A COMEBACK IN LIBERTY CITY AS PLANS ARE UNDERWAY"
" TO STAGE MALBOLOKOV"; break;
case 4:
m_pMessage = " NOW PLAYING )HEAVY WEAPONS) BUFF T AND SUCK WILD REUNITE IN THE SEQUEL"
" TO )WEAPONS OF ASS DISTRACTION). THE CHIPS ARE DOWN AND SO ARE THE IQ)S IN THIS"
" SUMMER)S MONSTER BLOCKBUSTER. . . THE PRESIDENT)S ASS IS ON THE LINE. HE NEEDS"
" A PLAN TO STOP FREEDOM BEING STOLEN BY THE BAD GUYS. STEP UP BUFF AND SUCK!"
" IT)S TIME TO UNLEASH THE HEAVY WEAPONS AND )SUCK IT TO )EM!)"; break;
case 5:
Nick007J commented 3 years ago (Migrated from github.com)
Review

This was a switch. If it was taken from re3, then it needs to be fixed as well :P

This was a switch. If it was taken from re3, then it needs to be fixed as well :P
asm95 commented 3 years ago (Migrated from github.com)
Review

Oh, damn that's right... Will change that to a switch(m_Type){...} statement. Yeah, I followed miami's branch but forgot that was a switch in IDA and also in master branch.

Oh, damn that's right... Will change that to a `switch(m_Type){...}` statement. Yeah, I followed [miami](https://github.com/GTAmodding/re3/blob/miami/src/renderer/Fluff.cpp#L672)'s branch but forgot that was a `switch` in IDA and also in [master](https://github.com/GTAmodding/re3/blob/master/src/renderer/Fluff.cpp#L361) branch.
m_pMessage = " COMING SOON . . . A SPECIAL PREVIEW NIGHT OF )FUBAR). AN EPIC URBAN"
" BIOPIC ABOUT LIFE IN THE GHETTO WHEN YOU)RE A MILLIONAIRE GANGSTA RAPPER"
" JUST TRYING TO GET BY AND KEEP IT REAL . . . STARS DB-P, FAITH W, AND BLACK"
" LIGHTMAN . . . SEATS STILL AVAILABLE . . . "; break;
case 6:
m_pMessage = " STILL SHOWING: )BAD MAN RETURNS - THIS TIME IT)S POOR) . . ."
" THE CHILDHOOD PSYCHOLOGICAL SCARS OF POTTY TRAINING TURNED MILLIONAIRE"
" PLAYBOY BRUTE LAME INTO )BAD MAN), THE CRAP CRUSADER. CLOAKED IN DARKNESS,"
" HE TRACKS DOWN ALL GRIME IN THE CITY! . . . IF YOU DON)T FLUSH, HE)LL"
" FLUSH YOU! "; break;
case 7:
m_pMessage = " THIS WEEKEND)S MUST SEE MOVIE IS )LET)S MAKE FORMULA). THE"
" HUGELY SUCCESSFUL COMEDY, ROMANCE, BUDDY-BUDDY, ACTION MOVIE SERIES"
" CONTINUES WITH THE LATEST INSTALLMENT - )HONEY, I SHRUNK MY SKIDS). . ."
" AND CATCH THIS ONE IF YOU CAN, )THE COMMON COLD). . . "; break;
case 8:
m_pMessage = FindTunnelMessage(); break;
case 9:
m_pMessage = FindBridgeMessage(); break;
case 10:
m_pMessage = FindTimeMessage(); break;
case 11:
m_pMessage = "WWW.ROCKSTARGAMES.COM "; break;
default: break;
}
}
else if (m_Type == SCROLL_AIRPORT_DOORS) {
switch (CGeneral::GetRandomNumber() % 5) {
case 0:
m_pMessage = "WELCOME TO LIBERTY CITY . . . FREEDOM"; break;
case 1:
m_pMessage = "PLEASE HAVE YOUR PASSPORT READY . . . "; break;
case 2:
m_pMessage = "PLACE BRASS-KNUCKLES, FIREARMS, CHANGE AND OTHER METAL OBJECTS"
" ON THE TRAY PLEASE . . . "; break;
case 3:
m_pMessage = FindTimeMessage(); break;
case 4:
m_pMessage = "WWW.ROCKSTARLEEDS.COM "; break;
default: break;
}
}
else if (m_Type == SCROLL_AIRPORT_FRONT) {
switch (CGeneral::GetRandomNumber() % 3) {
case 0:
m_pMessage = "WELCOME TO FRANCIS INTERNATIONAL AIRPORT . . . "; break;
case 1:
m_pMessage = "PLEASE DO NOT LEAVE LUGGAGE UNATTENDED . . . "; break;
case 2:
m_pMessage = "FOLLOW 1 FOR LONG AND SHORT TERM PARKING "; break;
case 3:
m_pMessage = FindTimeMessage(); break;
default: break;
}
}
else if (m_Type == SCROLL_STORE) {
switch (CGeneral::GetRandomNumber() % 11) {
case 0:
m_pMessage = "WWW.ROCKSTARGAMES.COM "; break;
case 1:
m_pMessage = ")GRAND THEFT PORTO) OUT NOW . . . "; break;
case 2:
m_pMessage = "OUR STUFF IS CHEAPER THAN CHEAP . . . "; break;
case 3:
m_pMessage = "BUY 12 DVDS GET 1 VIDEO CASSETTE FREE . . . "; break;
case 4:
m_pMessage = "WE)RE CLOSING DOWN AGAIN! . . . YES! WE DID SO MUCH TRADE AT OUR"
" LAST CLOSING DOWN SALE THAT WE)VE MANAGED TO STAY IN BUSINESS LONG ENOUGH"
" TO HAVE ANOTHER ONE . . . "; break;
case 5:
m_pMessage = "SPECIAL OFFERS . . . SPECIAL OFFERS . . . SPECIAL OFFERS . . . "; break;
case 6:
m_pMessage = "APPLY FOR A STORE CARD AND GET 0% OFF YOUR FIRST PURCHASE . . . "; break;
case 7:
m_pMessage = "RELEASED THIS WEEK: )NEW SKIDS ON THE POT) GREATEST HITS CD,)NUKED IDS):"
" INCLUDES THEIR BIG CHART HITS )PUPPY PHAT LUVA) AND )BANGING STUFF) . . . "; break;
case 8:
m_pMessage = "CHECK IN-STORE FOR THE PRODUCERS CUT DVD RELEASE OF THE CLASSIC SCIFI"
" MOVIE )TOTAL REHAB) STARRING ARNOLD STEELONE. IT)S NOT VERY GOOD BUT IT CAME"
" OUT ON TIME . . . "; break;
case 9:
m_pMessage = FindTimeMessage(); break;
case 10:
m_pMessage = "WWW.ROCKSTARLEEDS.COM "; break;
default: break;
}
}
else if (m_Type == SCROLL_USED_CARS) {
switch (CGeneral::GetRandomNumber() % 12) {
case 0:
m_pMessage = "COME AND TAKE ONE OF OUR CARS FOR A SPIN TODAY. . . "; break;
case 1:
m_pMessage = "CAPITAL AUTO SALES: STEERING WHEEL-Y GOOD DEALS YOUR WAY "; break;
case 2:
m_pMessage = "FINANCE ARRANGED AT 2000% APR. . . THAT)S A GREAT DEAL. . . "; break;
case 3:
m_pMessage = "WANT A TEST DRIVE? OUR SALESMEN ARE SURE TO TAKE YOU FOR"
" A RIDE. . . "; break;
case 4:
m_pMessage = "OUR DEALS ARE SUCH A STEAL WE CAN)T KEEP PEOPLE OUT OF THE"
" SHOWROOM. . . GRAB OUR CARS WHILE YOU CAN. . . "; break;
case 5:
m_pMessage = "CAPITAL AUTO SALES: THE ONLY DEALER WITH THE INSIDE DOPE ON"
" POTTY PRICES. . . "; break;
case 6:
m_pMessage = "PORTLAND)S NUMBER ONE DEALERSHIP. . . "; break;
case 7:
m_pMessage = "CAPITAL AUTO SALES FOR SHATTERING BREAKTHROUGH DEALS AND"
" EASY AVAILABILITY. . . "; break;
case 8:
m_pMessage = "SALES PERSON REQUIRED. . . MUST HAVE GREAT TEETH. . ."
" APPLY WITHIN. . . "; break;
case 9:
if (
FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_FRENCH ||
FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_GERMAN
)
m_pMessage = "COME AND TAKE ONE OF OUR CARS FOR A SPIN TODAY. . . ";
else
m_pMessage = "DON)T BE DRIVEN TO RUIN BY OTHER DEALERS. . . BUY FROM US AND DRIVE YOURSELF. . . ";
break;
case 10:
m_pMessage = FindTimeMessage(); break;
case 11:
m_pMessage = "WWW.ROCKSTARLEEDS.COM "; break;
default: break;
}
}
}
@ -759,9 +964,9 @@ void CScrollBar::Render()
{
for (int j = 0; j < 5; ++j)
{
coronaCoord.x = m_Position.x + m_Size.x * i;
coronaCoord.x = m_Position.x + (m_Size.x * i) * 0.5;
coronaCoord.y = m_Position.y + m_Size.y * i;
coronaCoord.z = m_Position.z + m_Size.z * j;
coronaCoord.z = m_Position.z + (m_Size.z * j) * 0.5;
// Render main coronas
if (m_MessageBar[i] & (1 << j))