Merge branch 'miami' into Font

# Conflicts:
#	src/render/Font.cpp
#	src/render/Font.h
This commit is contained in:
Sergeanur 2020-06-07 04:16:10 +03:00
commit 24bf4c2cba
36 changed files with 1386 additions and 228 deletions

View File

@ -75,7 +75,7 @@ CDarkel::DrawMessages()
CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f));
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 255, 128, CalcFade(timePassedSinceStart, 3000, 11000)));
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
if (pStartMessage) {
CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, pStartMessage);
}
@ -85,7 +85,7 @@ CDarkel::DrawMessages()
CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f));
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 255, 128, CalcFade(timePassedSinceStart, 0, 8000)));
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
if (pStartMessage) {
CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, pStartMessage);
}
@ -125,7 +125,7 @@ CDarkel::DrawMessages()
CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f));
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(128, 255, 128, CalcFade(timePassedSinceStart, 0, 5000)));
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
int y = SCREEN_HEIGHT / 2 + SCREEN_SCALE_Y(25.0f - timePassedSinceStart * 0.01f);
CFont::PrintString(SCREEN_WIDTH / 2, y, TheText.Get("KF_3"));
}

View File

@ -1337,7 +1337,7 @@ void CGarages::PrintMessages()
CFont::SetBackgroundOff();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(50.0f));
CFont::SetCentreOn();
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); // TODO(MIAMI): redo it
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetColor(CRGBA(0, 0, 0, 255));
#if defined(PS2) || defined (FIX_BUGS)

View File

@ -992,7 +992,7 @@ CPickups::RenderPickUpText()
CFont::SetColor(CRGBA(aMessages[i].m_color.red, aMessages[i].m_color.green, aMessages[i].m_color.blue, aMessages[i].m_color.alpha));
CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
CFont::PrintString(aMessages[i].m_pos.x, aMessages[i].m_pos.y, strToPrint);
}
NumMessages = 0;

View File

@ -1605,7 +1605,7 @@ void CReplay::Display()
CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f));
CFont::SetAlignment(ALIGN_LEFT);
CFont::SetColor(CRGBA(255, 255, 200, 200));
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
if (Mode == MODE_PLAYBACK)
CFont::PrintString(SCREEN_SCALE_X(63.5f), SCREEN_SCALE_Y(30.0f), TheText.Get("REPLAY"));
}

View File

@ -269,7 +269,7 @@ void CSceneEdit::Draw(void)
CFont::SetRightJustifyWrap(0.0f);
CFont::SetBackGroundOnlyTextOff();
#ifdef FIX_BUGS
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
CFont::SetPropOn();
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
CFont::SetDropShadowPosition(1);
@ -292,7 +292,7 @@ void CSceneEdit::Draw(void)
CFont::SetCentreOff();
CFont::SetScale(SCREEN_SCALE_X(0.7f), SCREEN_SCALE_Y(0.7f));
#ifdef FIX_BUGS
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
#else
CFont::SetFontStyle(FONT_HEADING);
#endif

View File

@ -14288,7 +14288,11 @@ void CTheScripts::UpdateObjectIndices()
if (!pModel)
continue;
strcpy(name, pModel->GetName());
#ifdef FIX_BUGS
for (int k = 0; k < USED_OBJECT_NAME_LENGTH && name[k]; k++)
#else
for (int k = 0; k < USED_OBJECT_NAME_LENGTH; k++)
#endif
name[k] = toupper(name[k]);
if (strcmp(name, UsedObjectArray[i].name) == 0) {
found = true;

View File

@ -437,9 +437,9 @@ void CControllerConfigManager::InitialiseControllerActionNameArray()
SETACTIONNAME(PED_CYCLE_TARGET_LEFT);
SETACTIONNAME(PED_CYCLE_TARGET_RIGHT);
SETACTIONNAME(PED_CENTER_CAMERA_BEHIND_PLAYER);
SETACTIONNAME(VEHICLE_LOOKBEHIND);
SETACTIONNAME(PED_DUCK);
SETACTIONNAME(PED_ANSWER_PHONE);
SETACTIONNAME(VEHICLE_LOOKBEHIND);
SETACTIONNAME(VEHICLE_LOOKLEFT);
SETACTIONNAME(VEHICLE_LOOKRIGHT);
SETACTIONNAME(VEHICLE_HORN);
@ -462,6 +462,10 @@ void CControllerConfigManager::InitialiseControllerActionNameArray()
SETACTIONNAME(GO_RIGHT);
SETACTIONNAME(GO_FORWARD);
SETACTIONNAME(GO_BACK);
SETACTIONNAME(VEHICLE_TURRETLEFT);
SETACTIONNAME(VEHICLE_TURRETRIGHT);
SETACTIONNAME(VEHICLE_TURRETUP);
SETACTIONNAME(VEHICLE_TURRETDOWN);
SETACTIONNAME(NETWORK_TALK);
SETACTIONNAME(TOGGLE_DPAD);
SETACTIONNAME(SWITCH_DEBUG_CAM_ON);

View File

@ -55,7 +55,7 @@ CDebug::DebugDisplayTextBuffer()
CFont::SetJustifyOn();
CFont::SetRightJustifyWrap(0.0f);
CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
#else
// this is not even readable
CFont::SetPropOff();
@ -65,7 +65,7 @@ CDebug::DebugDisplayTextBuffer()
CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f);
CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
CFont::SetPropOff();
#endif
do {
@ -113,7 +113,7 @@ CDebug::DisplayScreenStrings()
CFont::SetRightJustifyWrap(0.0f);
CFont::SetWrapx(9999.0f);
CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
for(i = 0; i < ms_nScreenStrs; i++){
/*

View File

@ -826,7 +826,7 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen)
if (aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL) {
CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENULABEL_X_MARGIN));
CFont::SetRightJustifyWrap(SCREEN_SCALE_X(MENULABEL_WIDTH));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(BIGTEXT2_X_SCALE), MENU_Y(BIGTEXT2_Y_SCALE));
CFont::SetRightJustifyOff();
@ -911,7 +911,7 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen)
wchar* leftText;
if (aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot >= SAVESLOT_1 && aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot <= SAVESLOT_8) {
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(MEDIUMTEXT_X_SCALE), MENU_Y(MEDIUMTEXT_Y_SCALE));
CFont::SetDropShadowPosition(0);
} else {
@ -1255,7 +1255,7 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen)
CFont::SetCentreOff();
CFont::SetRightJustifyOn();
if (aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot >= SAVESLOT_1 && aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot <= SAVESLOT_8) {
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(MEDIUMTEXT_X_SCALE), MENU_Y(MEDIUMTEXT_Y_SCALE));
} else {
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
@ -1720,7 +1720,7 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8
CFont::SetRightJustifyOff();
CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
if (!m_bKeyIsOK)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
@ -1733,7 +1733,7 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8
CFont::PrintString(MENU_X_LEFT_ALIGNED(275.0f), SCREEN_SCALE_FROM_BOTTOM(114.0f), TheText.Get("FET_CIG")); // BACKSPACE TO CLEAR - LMB,RETURN TO CHANGE
CFont::SetRightJustifyOff();
CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
m_bKeyIsOK = false;
m_bKeyChangeNotProcessed = false;
}
@ -1745,7 +1745,7 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8
CFont::PrintString(MENU_X_LEFT_ALIGNED(275.0f), SCREEN_SCALE_FROM_BOTTOM(114.0f), TheText.Get("FET_EIG")); // CANNOT SET A CONTROL FOR THIS ACTION
CFont::SetRightJustifyOff();
CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
}
}
}
@ -1918,7 +1918,7 @@ CMenuManager::DrawControllerSetupScreen()
CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X), MENU_Y(CONTSETUP_LIST_TOP), TheText.Get("FET_CCR"));
CFont::SetRightJustifyOff();
CFont::SetScale(MENU_X_LEFT_ALIGNED(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
int yStart;
if (m_ControlMethod == CONTROL_CLASSIC)
yStart = CONTSETUP_LIST_HEADER_HEIGHT + 29;
@ -2221,7 +2221,7 @@ CMenuManager::DrawBackground()
if (CheckHover(xStart, xStart + optionWidth, optionTop, optionBottom))
hoveredBottomBarOption = i;
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(0.35f), MENU_Y(0.7f));
CFont::SetRightJustifyOff();
if (hoveredBottomBarOption == i && hoveredBottomBarOption != curBottomBarOption)
@ -2626,7 +2626,7 @@ CMenuManager::DrawPlayerSetupScreen()
// Skin list
CFont::SetRightJustifyOff();
CFont::SetScale(MENU_X(PLAYERSETUP_ROW_TEXT_X_SCALE), MENU_Y(PLAYERSETUP_ROW_TEXT_Y_SCALE));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
if (m_nSkinsTotal > 0) {
for (m_pSelectedSkin = m_pSkinListHead.nextSkin; m_pSelectedSkin->skinId != m_nFirstVisibleRowOnList;
m_pSelectedSkin = m_pSelectedSkin->nextSkin);
@ -3281,7 +3281,7 @@ CMenuManager::SmallMessageScreen(const char* text)
CFont::SetJustifyOn();
CFont::SetBackGroundOnlyTextOn();
CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(95.0f), SCREEN_SCALE_FROM_BOTTOM(165.0f), SCREEN_SCALE_FROM_RIGHT(95.0f), SCREEN_SCALE_Y(115.0f)), CRGBA(50, 50, 50, FadeIn(210)));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetCentreSize(SCREEN_SCALE_X(430.0f));
CFont::SetCentreOn();
CFont::SetColor(CRGBA(255, 217, 106, FadeIn(255)));
@ -3293,7 +3293,7 @@ void
CMenuManager::PrintBriefs()
{
CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetRightJustifyOff();
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why
@ -3345,7 +3345,7 @@ CMenuManager::PrintStats()
{
int rowNum = ConstructStatLine(99999);
#ifdef GTA3_1_1_PATCH
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
#endif
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why
float nextYChange, y, alphaMult;
@ -4545,11 +4545,6 @@ CMenuManager::ProcessButtonPresses(void)
}
break;
}
//case MENUACTION_KEYBOARDCTRLS:
// SwitchToNewScreen(MENUPAGE_KEYBOARD_CONTROLS);
// m_nSelectedListRow = 0;
// m_nCurrExLayer = HOVEROPTION_LIST;
// break;
}
}
ProcessOnOffMenuOptions();
@ -4767,6 +4762,7 @@ void
CMenuManager::ProcessOnOffMenuOptions()
{
switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) {
#ifdef LEGACY_MENU_OPTIONS
case MENUACTION_CTRLVIBRATION:
m_PrefsUseVibration = !m_PrefsUseVibration;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
@ -4777,6 +4773,7 @@ CMenuManager::ProcessOnOffMenuOptions()
CPad::GetPad(0)->Mode = 0;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
#endif
case MENUACTION_FRAMESYNC:
m_PrefsVsyncDisp = !m_PrefsVsyncDisp;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
@ -5341,7 +5338,7 @@ CMenuManager::PrintMap(void)
CRGBA(MAPINFOBOX_COLOR.r, MAPINFOBOX_COLOR.g, MAPINFOBOX_COLOR.b, MAPINFOBOX_COLOR.a));
CFont::SetScale(MENU_X(0.4f), MENU_Y(0.7f));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
float nextX = MENU_X(30.0f), nextY = 95.0f;

View File

@ -218,8 +218,8 @@ enum eMenuAction
MENUACTION_YES,
MENUACTION_NO,
MENUACTION_CHANGEMENU,
MENUACTION_CTRLVIBRATION,
MENUACTION_CTRLCONFIG,
MENUACTION_UNK5,
MENUACTION_INVERTPADY,
MENUACTION_FRAMESYNC,
MENUACTION_FRAMELIMIT,
MENUACTION_TRAILS,
@ -255,7 +255,6 @@ enum eMenuAction
MENUACTION_PARSEHEAP,
// MENUACTION_MEMCARDSAVECONFIRM is that on VC enum??
MENUACTION_DEBUGSTREAM,
//MENUACTION_KEYBOARDCTRLS,
MENUACTION_GETKEY,
MENUACTION_SHOWHEADBOB,
MENUACTION_UNK80,
@ -273,13 +272,6 @@ enum eMenuAction
MENUACTION_CTRLMETHOD,
MENUACTION_DYNAMICACOUSTIC,
MENUACTION_MOUSESTEER,
MENUACTION_UNK103,
MENUACTION_UNK104,
MENUACTION_UNK105,
MENUACTION_UNK106,
MENUACTION_UNK107,
MENUACTION_UNK108,
MENUACTION_UNK109,
MENUACTION_UNK110,
#ifdef MORE_LANGUAGES
MENUACTION_LANG_PL,
@ -290,7 +282,11 @@ enum eMenuAction
MENUACTION_SCREENMODE,
#endif
#ifdef FREE_CAM
MENUACTION_FREECAM
MENUACTION_FREECAM,
#endif
#ifdef LEGACY_MENU_OPTIONS
MENUACTION_CTRLVIBRATION,
MENUACTION_CTRLCONFIG,
#endif
};

View File

@ -2517,7 +2517,7 @@ void CPad::PrintErrorMessage(void)
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetColor(CRGBA(255, 255, 200, 200));
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
CFont::PrintString
(
SCREEN_WIDTH / 2,
@ -2534,7 +2534,7 @@ void CPad::PrintErrorMessage(void)
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetColor(CRGBA(255, 255, 200, 200));
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
CFont::PrintString
(
SCREEN_WIDTH / 2,

View File

@ -405,7 +405,7 @@ inline T *WriteSaveBuf(uint8 *&buf, const T &value)
WriteSaveBuf(buf, b);\
WriteSaveBuf(buf, c);\
WriteSaveBuf(buf, d);\
WriteSaveBuf(buf, size);
WriteSaveBuf<uint32>(buf, size);
#define CheckSaveHeader(buf,a,b,c,d,size)\
assert(ReadSaveBuf<char>(buf) == a);\

View File

@ -514,7 +514,7 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
CFont::SetScale(SCREEN_SCALE_X(0.75f), yscale);
CFont::SetPropOn();
CFont::SetRightJustifyOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
CFont::SetColor(CRGBA(255, 255, 255, 255));
AsciiToUnicode(str1, tmpstr);
CFont::PrintString(hpos, top, tmpstr);
@ -711,7 +711,7 @@ DisplayGameDebugText()
CFont::SetPropOn();
CFont::SetBackgroundOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
CFont::SetScale(SCREEN_SCALE_X(0.5f), SCREEN_SCALE_Y(0.5f));
CFont::SetCentreOff();
CFont::SetRightJustifyOff();

View File

@ -92,7 +92,7 @@ void tbDisplay()
CFont::SetWrapx(640.0f);
CFont::SetRightJustifyOff();
CFont::SetPropOn();
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
sprintf(temp, "FPS: %.2f", Diag_GetFPS());
AsciiToUnicode(temp, wtemp);
CFont::SetColor(CRGBA(255, 255, 255, 255));

View File

@ -27,6 +27,10 @@ CPhysical::CPhysical(void)
{
int i;
#ifdef FIX_BUGS
m_nLastTimeCollided = 0;
#endif
m_fForceMultiplier = 1.0f;
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
@ -68,6 +72,9 @@ CPhysical::CPhysical(void)
m_phy_flagA20 = false;
#ifdef FIX_BUGS
m_nSurfaceTouched = SURFACE_DEFAULT;
#endif
m_nZoneLevel = LEVEL_NONE;
bIsFrozen = false;

View File

@ -30,7 +30,11 @@ public:
RwMatrixDestroy(m_attachment);
}
void Attach(RwMatrix *matrix, bool owner = false){
#ifdef FIX_BUGS
if(m_attachment && m_hasRwMatrix)
#else
if(m_hasRwMatrix && m_attachment)
#endif
RwMatrixDestroy(m_attachment);
m_attachment = matrix;
m_hasRwMatrix = owner;

View File

@ -159,6 +159,12 @@ enum
MI_TAXI_D = 28, // HMOCA
MI_BMYBB = 47,
MI_WMOST = 52,
MI_WMYBE = 58,
MI_WFOBE,
MI_WMOBE,
MI_WFOGO = 63,
MI_WMOGO = 64,

View File

@ -185,6 +185,9 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_queuedSound = SOUND_NO_SOUND;
m_objective = OBJECTIVE_NONE;
m_prevObjective = OBJECTIVE_NONE;
#ifdef FIX_BUGS
m_objectiveTimer = 0;
#endif
CharCreatedBy = RANDOM_CHAR;
m_leader = nil;
m_pedInObjective = nil;
@ -244,6 +247,9 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_nPedState = PED_IDLE;
m_nLastPedState = PED_NONE;
m_nMoveState = PEDMOVE_STILL;
#ifdef FIX_BUGS
m_nPrevMoveState = PEDMOVE_NONE;
#endif
m_nStoredMoveState = PEDMOVE_NONE;
m_pFire = nil;
m_pPointGunAt = nil;
@ -4341,30 +4347,29 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
if (bInVehicle) {
if (method != WEAPONTYPE_DROWNING) {
#ifdef VC_PED_PORTS
if (m_pMyVehicle) {
bool bDone = false;
if (m_pMyVehicle->IsBike()) {
m_fHealth = 0.0f;
//CBike::KnockOffRider -- TODO(MIAMI)
((CBike*)m_pMyVehicle)->KnockOffRider(method, direction, this, false);
bDone = true;
}
else {
if (m_pMyVehicle->IsCar() && m_pMyVehicle->pDriver == this) {
if (m_pMyVehicle->GetStatus() == STATUS_SIMPLE) {
m_pMyVehicle->SetStatus(STATUS_PHYSICS);
CCarCtrl::SwitchVehicleToRealPhysics(m_pMyVehicle);
} else {
if (m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_CAR) {
if (m_pMyVehicle->pDriver == this) {
if (m_pMyVehicle->GetStatus() == STATUS_SIMPLE) {
m_pMyVehicle->SetStatus(STATUS_PHYSICS);
CCarCtrl::SwitchVehicleToRealPhysics(m_pMyVehicle);
}
m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0;
m_pMyVehicle->AutoPilot.m_nTempAction = TEMPACT_HANDBRAKESTRAIGHT;
m_pMyVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 2000;
}
m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0;
m_pMyVehicle->AutoPilot.m_nTempAction = TEMPACT_HANDBRAKESTRAIGHT;
m_pMyVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 2000;
}
// TODO(MIAMI): argument
if (m_pMyVehicle->CanPedExitCar(false)) {
SetObjective(OBJECTIVE_LEAVE_CAR_AND_DIE, m_pMyVehicle);
}
else {
} else {
m_fHealth = 0.0f;
if (m_pMyVehicle && m_pMyVehicle->pDriver == this) {
SetRadioStation();
@ -4397,7 +4402,6 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
if (bDone)
return true;
}
#endif
m_fHealth = 1.0f;
return false;
}
@ -4421,6 +4425,7 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
}
if (method == WEAPONTYPE_DROWNING)
bIsInTheAir = false;
// TODO(Miami): timesDrowned
return true;
}
@ -5684,6 +5689,7 @@ CPed::SetFlee(CVector2D const &from, int time)
}
}
// --MIAMI: Only some part is done
void
CPed::SetWaitState(eWaitState state, void *time)
{
@ -5858,13 +5864,20 @@ CPed::SetWaitState(eWaitState state, void *time)
else
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 100000;
break;
case WAITSTATE_FAST_FALL:
SetFall(-1, ANIM_KO_SKID_FRONT, true);
break;
case WAITSTATE_BOMBER:
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_BOMBER, 4.0f);
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + *(int*)time;
break;
case WAITSTATE_LANCESITTING:
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_LANCE, ANIM_SUNBATHE, 4.0f);
break;
case WAITSTATE_SUN_BATHE_PRE:
case WAITSTATE_SUN_BATHE_DOWN:
case WAITSTATE_SUN_BATHE_IDLE:
case WAITSTATE_FAST_FALL:
case WAITSTATE_BOMBER:
case WAITSTATE_GROUND_ATTACK:
case WAITSTATE_LANCESITTING:
case WAITSTATE_PLAYANIM_HANDSUP_SIMPLE:
default:
ClearWaitState();
@ -6790,7 +6803,7 @@ CPed::EnterCar(void)
LineUpPedWithCar(LINE_UP_TO_CAR_START);
if (veh->IsBike()) {
CBike *bike = (CBike*)veh;
if (bike->GetStatus() != STATUS_ABANDONED || bike->m_bike_flag08 || !m_pVehicleAnim) {
if (bike->GetStatus() != STATUS_ABANDONED || bike->bIsBeingPickedUp || !m_pVehicleAnim) {
if (m_nPedState == PED_CARJACK && m_pVehicleAnim) {
if (m_pVehicleAnim->currentTime > 0.4f && m_pVehicleAnim->currentTime - m_pVehicleAnim->timeStep <= 0.4f) {
int anim = m_pVehicleAnim->animId;
@ -6806,9 +6819,9 @@ CPed::EnterCar(void)
// One is pickup and other one is pullup, not same :p
if ((anim == ANIM_BIKE_PICKUP_R || anim == ANIM_BIKE_PICKUP_L) && m_pVehicleAnim->currentTime > 0.4667f)
bike->m_bike_flag08 = true;
bike->bIsBeingPickedUp = true;
else if ((anim == ANIM_BIKE_PULLUP_R || anim == ANIM_BIKE_PULLUP_L) && m_pVehicleAnim->currentTime > 0.4667f)
bike->m_bike_flag08 = true;
bike->bIsBeingPickedUp = true;
}
}
} else {
@ -6946,40 +6959,72 @@ CPed::ExitTrain(void)
}
#endif
// --MIAMI: Done
void
CPed::ExitCar(void)
{
if (!m_pVehicleAnim)
if (!m_pVehicleAnim) {
if (InVehicle()) {
if (m_pMyVehicle->IsBike()) {
// TODO(Miami): What are those?
if (m_vehEnterType == 18 || m_vehEnterType == 8) {
((CBike*)m_pMyVehicle)->KnockOffRider(WEAPONTYPE_UNARMED, 0, this, false);
}
} else if (m_pMyVehicle->IsCar()) {
if (RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_ROLLOUT_LHS)) {
((CAutomobile*)m_pMyVehicle)->KnockPedOutCar(WEAPONTYPE_UNIDENTIFIED, CAR_DOOR_LF, this);
} else if (RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_ROLLOUT_RHS)) {
((CAutomobile*)m_pMyVehicle)->KnockPedOutCar(WEAPONTYPE_UNIDENTIFIED, CAR_DOOR_RF, this);
}
}
}
return;
}
AnimationId exitAnim = (AnimationId) m_pVehicleAnim->animId;
float animTime = m_pVehicleAnim->currentTime;
m_pMyVehicle->ProcessOpenDoor(m_vehEnterType, exitAnim, animTime);
if (exitAnim == ANIM_BIKE_GETOFF_BACK) {
if (animTime > 0.35f && m_pMyVehicle && m_pMyVehicle->IsBike())
((CBike*)m_pMyVehicle)->KnockOffRider(WEAPONTYPE_UNARMED, 0, this, false);
else
LineUpPedWithCar(LINE_UP_TO_CAR_FALL);
if (m_pSeekTarget) {
// Car is upside down
if (m_pMyVehicle->GetUp().z > -0.8f) {
if (exitAnim != ANIM_CAR_CLOSE_RHS && exitAnim != ANIM_CAR_CLOSE_LHS && animTime <= 0.3f)
LineUpPedWithCar((m_pMyVehicle->GetModelIndex() == MI_DODO ? LINE_UP_TO_CAR_END : LINE_UP_TO_CAR_START));
else
} else if (exitAnim != ANIM_CAR_ROLLOUT_LHS && exitAnim != ANIM_CAR_ROLLOUT_RHS) {
m_pMyVehicle->ProcessOpenDoor(m_vehEnterType, exitAnim, animTime);
if (m_pSeekTarget) {
// Car is upside down
if (m_pMyVehicle->GetUp().z > -0.8f) {
if (exitAnim != ANIM_CAR_CLOSE_RHS && exitAnim != ANIM_CAR_CLOSE_LHS && animTime <= 0.3f)
LineUpPedWithCar((m_pMyVehicle->GetModelIndex() == MI_DODO ? LINE_UP_TO_CAR_END : LINE_UP_TO_CAR_START));
else
LineUpPedWithCar(LINE_UP_TO_CAR_END);
}
else {
LineUpPedWithCar(LINE_UP_TO_CAR_END);
} else {
LineUpPedWithCar(LINE_UP_TO_CAR_END);
}
}
// If there is someone in front of the door, make him fall while we exit.
if (m_nPedState == PED_EXIT_CAR) {
CPed *foundPed = nil;
for (int i = 0; i < m_numNearPeds; i++) {
if ((m_nearPeds[i]->GetPosition() - GetPosition()).MagnitudeSqr2D() < 0.04f) {
foundPed = m_nearPeds[i];
break;
}
}
if (foundPed && animTime > 0.4f && foundPed->IsPedInControl())
foundPed->SetFall(1000, ANIM_KO_SKID_FRONT, 1);
// If there is someone in front of the door, make him fall while we exit.
if (m_nPedState == PED_EXIT_CAR) {
CPed* foundPed = nil;
for (int i = 0; i < m_numNearPeds; i++) {
if ((m_nearPeds[i]->GetPosition() - GetPosition()).MagnitudeSqr2D() < 0.04f) {
foundPed = m_nearPeds[i];
break;
}
}
if(foundPed && (!foundPed->IsPlayer() || m_nPedType == PEDTYPE_COP || m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS))
if (animTime > 0.4f && foundPed->IsPedInControl())
foundPed->SetFall(1000, ANIM_KO_SKID_FRONT, 1);
}
} else if (animTime <= 0.07f || !m_pMyVehicle || !m_pMyVehicle->IsCar()) {
LineUpPedWithCar(LINE_UP_TO_CAR_FALL);
} else if (exitAnim == ANIM_CAR_ROLLOUT_LHS) {
((CAutomobile*)m_pMyVehicle)->KnockPedOutCar(WEAPONTYPE_UNIDENTIFIED, CAR_DOOR_LF, this);
} else {
((CAutomobile*)m_pMyVehicle)->KnockPedOutCar(WEAPONTYPE_UNIDENTIFIED, CAR_DOOR_RF, this);
}
}
@ -7619,6 +7664,7 @@ CPed::FinishLaunchCB(CAnimBlendAssociation *animAssoc, void *arg)
}
}
// --MIAMI: Done
void
CPed::FinishedWaitCB(CAnimBlendAssociation *animAssoc, void *arg)
{
@ -7629,6 +7675,7 @@ CPed::FinishedWaitCB(CAnimBlendAssociation *animAssoc, void *arg)
ped->Wait();
}
// --MIAMI: Some part is done
void
CPed::Wait(void)
{
@ -7957,15 +8004,38 @@ CPed::Wait(void)
ClearWaitState();
}
break;
case WAITSTATE_RIOT:
if (m_nPedState == PED_FLEE_ENTITY || m_nPedState == PED_ATTACK) {
ClearWaitState();
break;
}
PlayRandomAnimationsFromAnimBlock(this, ASSOCGRP_RIOT, ANIM_RIOT_ANGRY, ANIM_RIOT_FUKU - ANIM_RIOT_ANGRY + 1);
if (IsPedInControl() && CGeneral::GetRandomNumberInRange(0.f,1.f) < 0.25f
&& CPopulation::CanJeerAtStripper(m_modelIndex)) {
for (int i = 0; i < m_numNearPeds; ++i) {
CPed *nearPed = m_nearPeds[i];
if (nearPed) {
if ((GetPosition() - nearPed->GetPosition()).MagnitudeSqr() < sq(10.f)) {
for (int anim = ANIM_STRIP_A; anim <= ANIM_STRIP_G; anim++) {
if (RpAnimBlendClumpGetAssociation(nearPed->GetClump(), anim))
Say(SOUND_PED_149);
}
}
}
}
}
break;
case WAITSTATE_BOMBER:
if (CTimer::GetTimeInMilliseconds() > m_nWaitTimer)
ClearWaitState();
break;
case WAITSTATE_STRIPPER:
PlayRandomAnimationsFromAnimBlock(this, ASSOCGRP_STRIP, ANIM_STRIP_A, ANIM_STRIP_G - ANIM_STRIP_A + 1);
break;
case WAITSTATE_SUN_BATHE_PRE:
case WAITSTATE_SUN_BATHE_DOWN:
case WAITSTATE_SUN_BATHE_IDLE:
case WAITSTATE_RIOT:
case WAITSTATE_FAST_FALL:
case WAITSTATE_BOMBER:
case WAITSTATE_STRIPPER:
case WAITSTATE_GROUND_ATTACK:
case WAITSTATE_LANCESITTING:
case WAITSTATE_PLAYANIM_HANDSUP_SIMPLE:
assert(0);
default:
@ -12525,12 +12595,10 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (ped->m_objective == OBJECTIVE_LEAVE_VEHICLE)
ped->RestorePreviousObjective();
#ifdef VC_PED_PORTS
else if (ped->m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) {
ped->m_fHealth = 0.0f;
ped->SetDie(ANIM_FLOOR_HIT, 4.0f, 0.5f);
}
#endif
ped->bInVehicle = false;
if (veh && veh->IsCar() && !veh->IsRoomForPedToLeaveCar(ped->m_vehEnterType, nil)) {
@ -12590,7 +12658,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
}
}
#ifdef VC_PED_PORTS
else {
else if (ped->m_nPedState == PED_DRIVING) {
ped->m_nPedState = PED_IDLE;
}
#endif
@ -18296,41 +18364,106 @@ CPed::SetNewAttraction(CPedAttractor* pAttractor, const CVector& pos, float head
m_positionInQueue = qid;
}
// --MIAMI: Done
void
CPed::ClearWaitState(void)
{
CAnimBlendAssociation *assoc;
switch (m_nWaitState) {
case WAITSTATE_PLAYANIM_CHAT:
case WAITSTATE_SIT_DOWN:
case WAITSTATE_SIT_DOWN_RVRS:
case WAITSTATE_SIT_UP:
case WAITSTATE_SIT_IDLE:
case WAITSTATE_USE_ATM:
if (CTimer::GetTimeInMilliseconds() <= m_nWaitTimer) {
AnimationId id;
switch (m_nWaitState) { // TODO(MIAMI): actual!
case WAITSTATE_PLAYANIM_CHAT: id = ANIM_IDLE_CHAT; break;
case WAITSTATE_SIT_DOWN: id = ANIM_SEAT_DOWN; break;
case WAITSTATE_SIT_DOWN_RVRS: id = ANIM_SEAT_DOWN2; break;
case WAITSTATE_SIT_UP: id = ANIM_SEAT_UP; break;
case WAITSTATE_SIT_IDLE: id = ANIM_SEAT_IDLE; break;
case WAITSTATE_USE_ATM: id = ANIM_ATM; break;
case WAITSTATE_PLAYANIM_CHAT:
case WAITSTATE_SIT_DOWN:
case WAITSTATE_SIT_DOWN_RVRS:
case WAITSTATE_SIT_UP:
case WAITSTATE_SIT_IDLE:
case WAITSTATE_USE_ATM:
if (CTimer::GetTimeInMilliseconds() <= m_nWaitTimer) {
if (m_nWaitState == WAITSTATE_USE_ATM) {
assoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_ATM);
if (assoc)
assoc->blendDelta = -8.0f;
if (m_attractor)
GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
} else if (m_nWaitState == WAITSTATE_PLAYANIM_CHAT) {
assoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_IDLE_CHAT);
if (assoc)
assoc->blendDelta = -8.0f;
if (m_attractor)
GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
} else if (m_nWaitState == WAITSTATE_SIT_DOWN || m_nWaitState == WAITSTATE_SIT_DOWN_RVRS || m_nWaitState == WAITSTATE_SIT_IDLE || m_nWaitState == WAITSTATE_SIT_UP) {
switch (m_nWaitState) {
case WAITSTATE_SIT_DOWN:
assoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_SEAT_DOWN);
if (assoc)
assoc->blendDelta = -8.0f;
break;
case WAITSTATE_SIT_IDLE:
assoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_SEAT_IDLE);
if (assoc)
assoc->blendDelta = -8.0f;
break;
case WAITSTATE_SIT_UP:
assoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_SEAT_UP);
if (assoc)
assoc->blendDelta = -8.0f;
break;
default:
break;
}
if (m_attractor)
GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
}
}
CAnimBlendAssociation* pAssoc = RpAnimBlendClumpGetAssociation(GetClump(), id);
if (pAssoc)
pAssoc->blendDelta = -8.0f;
if (m_attractor)
GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
break;
case WAITSTATE_RIOT:
{
CAnimBlock* riotAnimBlock = CAnimManager::GetAnimationBlock("riot");
for (assoc = RpAnimBlendClumpGetFirstAssociation(GetClump()); assoc; assoc = RpAnimBlendGetNextAssociation(assoc)) {
int first = riotAnimBlock->firstIndex;
int index = assoc->hierarchy - CAnimManager::GetAnimation(0);
if (index >= first && index < first + riotAnimBlock->numAnims) {
assoc->blendDelta = -1000.0f;
}
}
break;
}
break;
case WAITSTATE_RIOT:
case WAITSTATE_FAST_FALL:
case WAITSTATE_BOMBER:
case WAITSTATE_STRIPPER:
case WAITSTATE_GROUND_ATTACK:
case WAITSTATE_LANCESITTING:
case WAITSTATE_PLAYANIM_HANDSUP_SIMPLE:
assert(0);
case WAITSTATE_FAST_FALL:
if (RpAnimBlendClumpGetAssociation(GetClump(), ANIM_KO_SKID_FRONT))
SetGetUp();
break;
case WAITSTATE_BOMBER:
assoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_BOMBER);
if (assoc)
assoc->blendDelta = -8.0f;
break;
case WAITSTATE_STRIPPER:
{
CAnimBlock* stripAnimBlock = CAnimManager::GetAnimationBlock("strip");
for (assoc = RpAnimBlendClumpGetFirstAssociation(GetClump()); assoc; assoc = RpAnimBlendGetNextAssociation(assoc)) {
int first = stripAnimBlock->firstIndex;
int index = assoc->hierarchy - CAnimManager::GetAnimation(0);
if (index >= first && index < first + stripAnimBlock->numAnims) {
assoc->blendDelta = -1000.0f;
}
}
break;
}
case WAITSTATE_LANCESITTING:
assoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_SUNBATHE);
if (assoc)
assoc->blendDelta = -8.0f;
break;
case WAITSTATE_PLAYANIM_HANDSUP_SIMPLE:
assoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_HANDSUP);
if (assoc)
assoc->blendDelta = -8.0f;
break;
default:
break;
}
m_nWaitState = WAITSTATE_FALSE;
}
@ -18735,12 +18868,9 @@ CPed::DriveVehicle(void)
float velocityFwdDotProd = DotProduct(bike->m_vecMoveSpeed, bike->GetForward());
if (m_vecTurnSpeed.MagnitudeSqr() > 0.09f) {
// TODO(Miami)
/*
bike->KnockOffRider(walkbackAssoc, 44, 2, this, 0);
bike->KnockOffRider(WEAPONTYPE_FALL, 2, this, false);
if (bike->pPassengers[0])
bike->KnockOffRider(walkbackAssoc, 44, 2, bike->pPassengers[0], 0);
*/
bike->KnockOffRider(WEAPONTYPE_FALL, 2, bike->pPassengers[0], false);
return;
}
if (!drivebyAssoc && Abs(velocityFwdDotProd) < 0.02f) {
@ -18756,12 +18886,9 @@ CPed::DriveVehicle(void)
} else {
float maxReverseSpeed = bike->pHandling->Transmission.fMaxReverseVelocity;
if (3.5f * maxReverseSpeed > velocityFwdDotProd && (bike->m_nWheelsOnGround || bike->GetUp().z < -0.5f)) {
// TODO(Miami)
/*
bike->KnockOffRider(walkbackAssoc, 44, 2, this, 0);
bike->KnockOffRider(WEAPONTYPE_FALL, 2, this, false);
if (bike->pPassengers[0])
bike->KnockOffRider(walkbackAssoc, 44, 2, bike->pPassengers[0], 0);
*/
bike->KnockOffRider(WEAPONTYPE_FALL, 2, bike->pPassengers[0], false);
return;
}
if (bike->m_fGasPedal >= 0.0 || velocityFwdDotProd <= maxReverseSpeed * 1.5) {
@ -19024,6 +19151,42 @@ CPed::DriveVehicle(void)
}
}
void
PlayRandomAnimationsFromAnimBlock(CPed* ped, AssocGroupId animGroup, uint32 first, uint32 amount)
{
if (!ped->IsPedInControl())
return;
const char *groupName = CAnimManager::GetAnimGroupName(animGroup);
CAnimBlock *animBlock = CAnimManager::GetAnimationBlock(groupName);
CAnimBlendAssociation *assoc;
for (assoc = RpAnimBlendClumpGetFirstAssociation(ped->GetClump()); assoc; assoc = RpAnimBlendGetNextAssociation(assoc)) {
int first = animBlock->firstIndex;
int index = assoc->hierarchy - CAnimManager::GetAnimation(0);
if (index >= first && index < first + animBlock->numAnims) {
break;
}
}
if (CTimer::GetTimeInMilliseconds() > ped->m_nWaitTimer && assoc)
assoc->flags &= ~ASSOC_REPEAT;
if (!assoc || assoc->blendDelta < 0.0f) {
int selectedAnimOffset;
do
selectedAnimOffset = CGeneral::GetRandomNumberInRange(0, amount);
while (assoc && first + selectedAnimOffset == assoc->animId);
assoc = CAnimManager::BlendAnimation(ped->GetClump(), animGroup, (AnimationId)(first + selectedAnimOffset), 3.0f);
assoc->SetFinishCallback(CPed::FinishedWaitCB, ped);
if (assoc->flags & ASSOC_REPEAT)
ped->m_nWaitTimer = CTimer::GetTimeInMilliseconds() + CGeneral::GetRandomNumberInRange(3000, 8000);
else
ped->m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 8000;
}
}
bool
IsPedPointerValid_NotInWorld(CPed* pPed)
{

View File

@ -1092,6 +1092,7 @@ public:
void FinishTalkingOnMobileCB(CAnimBlendAssociation* assoc, void* arg);
void StartTalkingOnMobileCB(CAnimBlendAssociation* assoc, void* arg);
void FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg);
void PlayRandomAnimationsFromAnimBlock(CPed* ped, AssocGroupId animGroup, uint32 first, uint32 amount);
// TODO(Miami): Change those when Ped struct is done
#ifndef PED_SKIN

View File

@ -40,6 +40,9 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
{
m_fMoveSpeed = 0.0f;
SetModelIndex(MI_PLAYER);
#ifdef FIX_BUGS
m_fCurrentStamina = m_fMaxStamina = 150.0f;
#endif
SetInitialState();
m_pWanted = new CWanted();
@ -56,8 +59,9 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
m_pPointGunAt = nil;
SetPedState(PED_IDLE);
m_fMaxStamina = 150.0f;
m_fCurrentStamina = m_fMaxStamina;
#ifndef FIX_BUGS
m_fCurrentStamina = m_fMaxStamina = 150.0f;
#endif
m_fStaminaProgress = 0.0f;
m_nEvadeAmount = 0;
m_pEvadingFrom = nil;

View File

@ -1113,4 +1113,10 @@ CPopulation::IsSkateable(CVector const& pos)
return false;
return foundCol.surfaceB == SURFACE_TARMAC || foundCol.surfaceB == SURFACE_PAVEMENT;
}
bool
CPopulation::CanJeerAtStripper(int32 model)
{
return model == MI_WMOBE || model == MI_WMYBE || model == MI_WMOST || model == MI_BMYBB;
}

View File

@ -90,6 +90,7 @@ public:
static bool TestRoomForDummyObject(CObject*);
static bool TestSafeForRealObject(CDummyObject*);
static bool IsSkateable(CVector const&);
static bool CanJeerAtStripper(int32 model);
static CPed* AddDeadPedInFrontOfCar(const CVector& pos, CVehicle* pCulprit);
};

View File

@ -63,7 +63,7 @@ CConsole::Display()
CFont::SetJustifyOn();
CFont::SetRightJustifyWrap(0.0f);
CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
#ifndef FIX_BUGS
CFont::SetPropOff(); // not sure why this is here anyway
#endif

View File

@ -392,7 +392,7 @@ void CHud::Draw()
CFont::SetCentreSize(SCREEN_SCALE_X(640.0f));
CFont::SetPropOn();
CFont::SetDropShadowPosition(0);
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
if (Min(9999, TotalAmmo - AmmoInClip) != 9999 && !CDarkel::FrenzyOnGoing() && weaponInfo->m_nWeaponSlot > 1 && weapon->m_eWeaponType != WEAPONTYPE_DETONATOR) {
CFont::SetDropShadowPosition(2);
@ -609,7 +609,7 @@ void CHud::Draw()
CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f);
CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f) + SCREEN_SCALE_Y(1.0f), m_ZoneToPrint);
@ -708,7 +708,7 @@ void CHud::Draw()
CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f);
CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(105.f) + SCREEN_SCALE_Y(1.0f), m_pVehicleNameToPrint);
@ -1020,7 +1020,7 @@ void CHud::Draw()
CFont::SetScale(SCREEN_SCALE_X(0.48f), SCREEN_SCALE_Y(1.120f));
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
float offsetX = SCREEN_SCALE_X(40.0f) + SCREEN_SCALE_X(8.0f);
float center = SCREEN_SCALE_FROM_RIGHT(50.0f) - SCREEN_SCALE_X(8.0f) - offsetX;
@ -1223,7 +1223,7 @@ void CHud::DrawAfterFade()
else
#endif
CFont::SetWrapx(SCREEN_SCALE_X(200.0f + 26.0f - 4.0f));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetBackgroundOn();
CFont::SetBackGroundOnlyTextOff();
CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha * 0.9f));
@ -1301,7 +1301,7 @@ void CHud::DrawAfterFade()
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_SCALE_X(600.0f));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[3]);
@ -1318,7 +1318,7 @@ void CHud::DrawAfterFade()
CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_SCALE_X(620.0f));
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::PrintString((SCREEN_WIDTH / 2) - SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) - SCREEN_SCALE_Y(2.0f), m_BigMessage[4]);
@ -1375,7 +1375,7 @@ void CHud::DrawAfterFade()
CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f));
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
#ifdef BETA_SLIDING_TEXT
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f) - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]);

View File

@ -1050,7 +1050,7 @@ CMoneyMessage::Render()
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(m_Colour.r, m_Colour.g, m_Colour.b, (255.0f - 255.0f * fLifeTime) * m_fOpacity));
CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
CFont::PrintString(vecOut.x, vecOut.y, m_aText);
}
}

View File

@ -233,7 +233,7 @@ ConvertingTexturesScreen(uint32 num, uint32 count, const char *text)
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 217, 106, 255));
CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetFontStyle(FONT_STANDARD);
CFont::PrintString(SCREEN_SCALE_X(170.0f), SCREEN_SCALE_Y(160.0f), TheText.Get(text));
CFont::DrawFonts();
DoRWStuffEndOfFrame();

View File

@ -421,7 +421,7 @@ CAutomobile::ProcessControl(void)
m_aSuspensionSpringRatio[3] < 1.0f && CSurfaceTable::GetAdhesionGroup(m_aWheelColPoints[3].surfaceB) == ADHESIVE_SAND){
if(GetModelIndex() != MI_RCBANDIT && GetModelIndex() != MI_RHINO){
float slowdown;
CVector parallelSpeed = m_vecMoveSpeed - DotProduct(m_vecMoveSpeed, GetUp())*m_vecMoveSpeed;
CVector parallelSpeed = m_vecMoveSpeed - DotProduct(m_vecMoveSpeed, GetUp())*GetUp();
float fSpeed = parallelSpeed.MagnitudeSqr();
if(fSpeed > SQR(0.3f)){
fSpeed = Sqrt(fSpeed);
@ -752,7 +752,7 @@ CAutomobile::ProcessControl(void)
fwdSpeed *= 0.7f;
float f = 1.0f - fwdSpeed/0.3f - 0.7f*CWeather::WetRoads;
f = Max(f, 0.4f);
m_aSuspensionSpringRatio[i] += f*(m_aSuspensionLineLength[i]-m_aSuspensionSpringLength[i])/m_aSuspensionSpringLength[i];
m_aSuspensionSpringRatio[i] += 0.35f*f*(m_aSuspensionLineLength[i]-m_aSuspensionSpringLength[i])/m_aSuspensionSpringLength[i];
if(m_aSuspensionSpringRatio[i] > 1.0f)
m_aSuspensionSpringRatio[i] = 1.0f;
}
@ -1860,7 +1860,7 @@ CAutomobile::PreRender(void)
if(Damage.GetWheelStatus(i) == WHEEL_STATUS_BURST && m_aSuspensionSpringRatioPrev[i] < 1.0f){
static float speedSq;
speedSq = m_vecMoveSpeed.MagnitudeSqr();
if(speedSq > 0.01f &&
if(speedSq > SQR(0.1f) &&
m_aWheelColPoints[i].surfaceB != SURFACE_GRASS &&
m_aWheelColPoints[i].surfaceB != SURFACE_MUD_DRY &&
m_aWheelColPoints[i].surfaceB != SURFACE_SAND &&
@ -3847,7 +3847,7 @@ CAutomobile::DoDriveByShootings(void)
if (!anim || !anim->IsRunning()) {
if (CPad::GetPad(0)->GetCarGunFired() && CTimer::GetTimeInMilliseconds() > weapon->m_nTimer) {
weapon->FireFromCar(this, lookingLeft);
weapon->FireFromCar(this, lookingLeft, true);
weapon->m_nTimer = CTimer::GetTimeInMilliseconds() + 70;
}
}
@ -4450,25 +4450,16 @@ CAutomobile::AddWheelDirtAndWater(CColPoint *colpoint, uint32 belowEffectSpeed)
}
return 0;
default:
if ( CWeather::WetRoads > 0.01f
#ifdef PC_PARTICLE
&& CTimer::GetFrameCounter() & 1
#endif
)
{
CParticle::AddParticle(
#ifdef FIX_BUGS
PARTICLE_WHEEL_WATER,
#else
PARTICLE_WATERSPRAY,
#endif
colpoint->point + CVector(0.0f, 0.0f, 0.25f+0.25f),
CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.005f, 0.04f)),
nil,
CGeneral::GetRandomNumberInRange(0.1f, 0.5f), waterCol);
if(CWeather::WetRoads > 0.01f){
if(CTimer::GetFrameCounter() & 1)
CParticle::AddParticle(
PARTICLE_WATERSPRAY,
colpoint->point + CVector(0.0f, 0.0f, 0.25f+0.25f),
CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.005f, 0.04f)),
nil,
CGeneral::GetRandomNumberInRange(0.1f, 0.5f), waterCol);
return 0;
}
return 1;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -69,11 +69,11 @@ public:
uint8 m_bike_flag01 : 1;
uint8 m_bike_flag02 : 1;
uint8 bWaterTight : 1;
uint8 m_bike_flag08 : 1;
uint8 bIsBeingPickedUp : 1;
uint8 bIsStanding : 1;
uint8 bExtraSpeed : 1; // leaning forward
uint8 bIsOnFire : 1;
uint8 m_bike_flag80 : 1; // doing wheelie?
uint8 m_bike_flag80 : 1;
int16 m_doingBurnout;
float m_fTireTemperature;
float m_fBrakeDestabilization;
@ -117,9 +117,12 @@ public:
float GetHeightAboveRoad(void);
void PlayCarHorn(void);
void KnockOffRider(eWeaponType weapon, uint8 direction, CPed *ped, bool bGetBackOn);
void VehicleDamage(void);
void ProcessBuoyancy(void);
void DoDriveByShootings(void);
void AddDamagedVehicleParticles(void);
int32 AddWheelDirtAndWater(CColPoint *colpoint, uint32 belowEffectSpeed);
void PlayHornIfNecessary(void);
void ResetSuspension(void);
void SetupSuspensionLines(void);

View File

@ -975,7 +975,7 @@ CBoat::DoDriveByShootings(void)
if (!anim || !anim->IsRunning()) {
if (CPad::GetPad(0)->GetCarGunFired() && CTimer::GetTimeInMilliseconds() > weapon->m_nTimer) {
weapon->FireFromCar(this, lookingLeft);
weapon->FireFromCar(this, lookingLeft, true);
weapon->m_nTimer = CTimer::GetTimeInMilliseconds() + 70;
}
}

View File

@ -264,7 +264,7 @@ INITSAVEBUF
WriteSaveBuf(buffer, ProcessCounter);
WriteSaveBuf(buffer, GenerateEvenIfPlayerIsCloseCounter);
WriteSaveBuf(buffer, (int16)0); // alignment
WriteSaveBuf(buffer, sizeof(CarGeneratorArray));
WriteSaveBuf(buffer, (uint32)sizeof(CarGeneratorArray));
for (int i = 0; i < NUM_CARGENS; i++)
WriteSaveBuf(buffer, CarGeneratorArray[i]);
VALIDATESAVEBUF(*size)

View File

@ -84,6 +84,10 @@ CPlane::CPlane(int32 id, uint8 CreatedBy)
SetStatus(STATUS_PLANE);
bIsBIGBuilding = true;
m_level = LEVEL_NONE;
#ifdef FIX_BUGS
m_isFarAway = true;
#endif
}
CPlane::~CPlane()

View File

@ -64,6 +64,10 @@ CTrain::CTrain(int32 id, uint8 CreatedBy)
bUsesCollision = true;
SetStatus(STATUS_TRAIN_MOVING);
#ifdef FIX_BUGS
m_isFarAway = true;
#endif
#else
assert(0 && "No trains in this game");
#endif

View File

@ -80,6 +80,9 @@ CVehicle::CVehicle(uint8 CreatedBy)
bIsLawEnforcer = false;
bIsAmbulanceOnDuty = false;
bIsFireTruckOnDuty = false;
#ifdef FIX_BUGS
bIsHandbrakeOn = false;
#endif
CCarCtrl::UpdateCarCount(this, false);
m_fHealth = 1000.0f;
bEngineOn = true;
@ -117,7 +120,7 @@ CVehicle::CVehicle(uint8 CreatedBy)
m_numPedsUseItAsCover = 0;
bIsCarParkVehicle = false;
bHasAlreadyBeenRecorded = false;
m_bSirenOrAlarm = 0;
m_bSirenOrAlarm = false;
m_nCarHornTimer = 0;
m_nCarHornPattern = 0;
m_nCarHornDelay = 0;
@ -748,7 +751,7 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
static bool bBraking;
static bool bDriving;
#ifdef FIX_BUGS
#ifdef FIX_SIGNIFICANT_BUGS
bAlreadySkidding = false;
#endif
@ -903,7 +906,7 @@ CVehicle::ProcessBikeWheel(CVector &wheelFwd, CVector &wheelRight, CVector &whee
static bool bDriving;
static bool bReversing;
#ifdef FIX_BUGS
#ifdef FIX_SIGNIFICANT_BUGS
bAlreadySkidding = false;
#endif
@ -1032,7 +1035,6 @@ CVehicle::ProcessBikeWheel(CVector &wheelFwd, CVector &wheelRight, CVector &whee
float impulse = speed*m_fMass;
float turnImpulse = speed*GetMass(wheelContactPoint, direction);
CVector vTurnImpulse = turnImpulse * direction;
ApplyMoveForce(impulse * direction);
float turnRight = DotProduct(vTurnImpulse, GetRight());

View File

@ -31,6 +31,7 @@
#include "WeaponInfo.h"
#include "World.h"
#include "SurfaceTable.h"
#include "Bike.h"
// TODO(Miami)
#define AUDIO_NOT_READY
@ -386,7 +387,7 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
}
bool
CWeapon::FireFromCar(CVehicle *shooter, bool left)
CWeapon::FireFromCar(CVehicle *shooter, bool left, bool right)
{
ASSERT(shooter!=nil);
@ -396,7 +397,7 @@ CWeapon::FireFromCar(CVehicle *shooter, bool left)
if ( m_nAmmoInClip <= 0 )
return false;
if ( FireInstantHitFromCar(shooter, left) )
if ( FireInstantHitFromCar(shooter, left, right) )
{
DMAudio.PlayOneShot(shooter->m_audioEntityId, SOUND_WEAPON_SHOT_FIRED, 0.0f);
@ -524,7 +525,22 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
}
damageEntityRegistered = 3;
// TODO(Miami): Bike
if (victimPed->bInVehicle) {
CVehicle *victimVeh = victimPed->m_pMyVehicle;
if (victimVeh) {
if (victimVeh->IsBike()) {
CBike *victimBike = (CBike*)victimVeh;
victimBike->KnockOffRider(m_eWeaponType, localDir, victimPed, false);
if (victimBike->pDriver) {
victimBike->pDriver->ReactToAttack(shooterPed);
} else {
if (victimVeh->pPassengers[0])
victimVeh->pPassengers[0]->ReactToAttack(shooterPed);
}
continue;
}
}
}
if ( !victimPed->DyingOrDead() )
victimPed->ReactToAttack(shooterPed);
@ -2005,8 +2021,9 @@ CWeapon::FireM16_1stPerson(CEntity *shooter)
}
bool
CWeapon::FireInstantHitFromCar(CVehicle *shooter, bool left)
CWeapon::FireInstantHitFromCar(CVehicle *shooter, bool left, bool right)
{
// TODO(MIAMI): bikes
CWeaponInfo *info = GetInfo();
CVehicleModelInfo *modelInfo = shooter->GetModelInfo();

View File

@ -37,7 +37,7 @@ public:
void Shutdown();
bool Fire (CEntity *shooter, CVector *fireSource);
bool FireFromCar (CVehicle *shooter, bool left);
bool FireFromCar (CVehicle *shooter, bool left, bool right);
bool FireMelee (CEntity *shooter, CVector &fireSource);
bool FireInstantHit(CEntity *shooter, CVector *fireSource);
@ -52,7 +52,7 @@ public:
bool FireAreaEffect (CEntity *shooter, CVector *fireSource);
bool FireSniper (CEntity *shooter);
bool FireM16_1stPerson (CEntity *shooter);
bool FireInstantHitFromCar(CVehicle *shooter, bool left);
bool FireInstantHitFromCar(CVehicle *shooter, bool left, bool right);
static void DoDoomAiming (CEntity *shooter, CVector *source, CVector *target);
static void DoTankDoomAiming (CEntity *shooter, CEntity *driver, CVector *source, CVector *target);