summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-04-25 15:48:03 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-04-25 15:48:03 +0200
commit7ddfc4067529e6635b29cc0805a4cc927b37bbf3 (patch)
treec68d7c956619f68a5928ed00fabbc00f6061aa44
parentfixed flight control code (diff)
parentfixed shooting target (diff)
downloadre3-7ddfc4067529e6635b29cc0805a4cc927b37bbf3.tar
re3-7ddfc4067529e6635b29cc0805a4cc927b37bbf3.tar.gz
re3-7ddfc4067529e6635b29cc0805a4cc927b37bbf3.tar.bz2
re3-7ddfc4067529e6635b29cc0805a4cc927b37bbf3.tar.lz
re3-7ddfc4067529e6635b29cc0805a4cc927b37bbf3.tar.xz
re3-7ddfc4067529e6635b29cc0805a4cc927b37bbf3.tar.zst
re3-7ddfc4067529e6635b29cc0805a4cc927b37bbf3.zip
m---------librw0
-rw-r--r--src/animation/FrameUpdate.cpp24
-rw-r--r--src/core/re3.cpp48
-rw-r--r--src/extras/debugmenu.h4
-rw-r--r--src/rw/RwHelper.cpp4
-rw-r--r--src/rw/RwHelper.h2
-rw-r--r--src/weapons/Weapon.cpp4
7 files changed, 50 insertions, 36 deletions
diff --git a/librw b/librw
-Subproject 5ffbde3890d1f959490c3ce16721c2a263415d8
+Subproject d8d13d44293a58b58d51c3a8e91e3ea76c6d6fe
diff --git a/src/animation/FrameUpdate.cpp b/src/animation/FrameUpdate.cpp
index a38ebc74..a1121282 100644
--- a/src/animation/FrameUpdate.cpp
+++ b/src/animation/FrameUpdate.cpp
@@ -10,12 +10,12 @@ CAnimBlendClumpData *gpAnimBlendClump;
// PS2 names without "NonSkinned"
void FrameUpdateCallBackNonSkinned(AnimBlendFrameData *frame, void *arg);
-void FrameUpdateCallBackNonSkinnedWithVelocityExtraction(AnimBlendFrameData *frame, void *arg);
-void FrameUpdateCallBackNonSkinnedWith3dVelocityExtraction(AnimBlendFrameData *frame, void *arg);
+void FrameUpdateCallBackWithVelocityExtractionNonSkinned(AnimBlendFrameData *frame, void *arg);
+void FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(AnimBlendFrameData *frame, void *arg);
void FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg);
-void FrameUpdateCallBackSkinnedWithVelocityExtraction(AnimBlendFrameData *frame, void *arg);
-void FrameUpdateCallBackSkinnedWith3dVelocityExtraction(AnimBlendFrameData *frame, void *arg);
+void FrameUpdateCallBackWithVelocityExtractionSkinned(AnimBlendFrameData *frame, void *arg);
+void FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, void *arg);
void
@@ -31,9 +31,9 @@ FrameUpdateCallBackNonSkinned(AnimBlendFrameData *frame, void *arg)
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
gpAnimBlendClump->velocity){
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
- FrameUpdateCallBackNonSkinnedWith3dVelocityExtraction(frame, arg);
+ FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(frame, arg);
else
- FrameUpdateCallBackNonSkinnedWithVelocityExtraction(frame, arg);
+ FrameUpdateCallBackWithVelocityExtractionNonSkinned(frame, arg);
return;
}
@@ -70,7 +70,7 @@ FrameUpdateCallBackNonSkinned(AnimBlendFrameData *frame, void *arg)
}
void
-FrameUpdateCallBackNonSkinnedWithVelocityExtraction(AnimBlendFrameData *frame, void *arg)
+FrameUpdateCallBackWithVelocityExtractionNonSkinned(AnimBlendFrameData *frame, void *arg)
{
CVector vec, pos(0.0f, 0.0f, 0.0f);
CQuaternion q, rot(0.0f, 0.0f, 0.0f, 0.0f);
@@ -150,7 +150,7 @@ FrameUpdateCallBackNonSkinnedWithVelocityExtraction(AnimBlendFrameData *frame, v
// original code uses do loops?
void
-FrameUpdateCallBackNonSkinnedWith3dVelocityExtraction(AnimBlendFrameData *frame, void *arg)
+FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(AnimBlendFrameData *frame, void *arg)
{
CVector vec, pos(0.0f, 0.0f, 0.0f);
CQuaternion q, rot(0.0f, 0.0f, 0.0f, 0.0f);
@@ -227,9 +227,9 @@ FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg)
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
gpAnimBlendClump->velocity){
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
- FrameUpdateCallBackSkinnedWith3dVelocityExtraction(frame, arg);
+ FrameUpdateCallBackWith3dVelocityExtractionSkinned(frame, arg);
else
- FrameUpdateCallBackSkinnedWithVelocityExtraction(frame, arg);
+ FrameUpdateCallBackWithVelocityExtractionSkinned(frame, arg);
return;
}
@@ -267,7 +267,7 @@ FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg)
}
void
-FrameUpdateCallBackSkinnedWithVelocityExtraction(AnimBlendFrameData *frame, void *arg)
+FrameUpdateCallBackWithVelocityExtractionSkinned(AnimBlendFrameData *frame, void *arg)
{
CVector vec, pos(0.0f, 0.0f, 0.0f);
CQuaternion q, rot(0.0f, 0.0f, 0.0f, 0.0f);
@@ -347,7 +347,7 @@ FrameUpdateCallBackSkinnedWithVelocityExtraction(AnimBlendFrameData *frame, void
}
void
-FrameUpdateCallBackSkinnedWith3dVelocityExtraction(AnimBlendFrameData *frame, void *arg)
+FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, void *arg)
{
CVector vec, pos(0.0f, 0.0f, 0.0f);
CQuaternion q, rot(0.0f, 0.0f, 0.0f, 0.0f);
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index d4d2c208..2a9cbc77 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -322,8 +322,12 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); });
DebugMenuAddCmd("Spawn", "Spawn Predator", [](){ SpawnCar(MI_PREDATOR); });
- DebugMenuAddVarBool8("Debug", "Draw hud", (int8*)&CHud::m_Wants_To_Draw_Hud, nil);
- DebugMenuAddVarBool8("Debug", "Edit on", (int8*)&CSceneEdit::m_bEditOn, nil);
+#ifdef LIBRW
+ DebugMenuAddVarBool8("Render", "PS2 Alpha test Emu", &gPS2alphaTest, nil);
+#endif
+
+ DebugMenuAddVarBool8("Debug", "Draw hud", &CHud::m_Wants_To_Draw_Hud, nil);
+ DebugMenuAddVarBool8("Debug", "Edit on", &CSceneEdit::m_bEditOn, nil);
#ifdef MENU_MAP
DebugMenuAddCmd("Debug", "Teleport to map waypoint", TeleportToWaypoint);
#endif
@@ -333,27 +337,27 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Debug", "Toggle Comedy Controls", ToggleComedy);
DebugMenuAddCmd("Debug", "Place Car on Road", PlaceOnRoad);
- DebugMenuAddVarBool8("Debug", "Catalina Heli On", (int8*)&CHeli::CatalinaHeliOn, nil);
+ DebugMenuAddVarBool8("Debug", "Catalina Heli On", &CHeli::CatalinaHeliOn, nil);
DebugMenuAddCmd("Debug", "Catalina Fly By", CHeli::StartCatalinaFlyBy);
DebugMenuAddCmd("Debug", "Catalina Take Off", CHeli::CatalinaTakeOff);
DebugMenuAddCmd("Debug", "Catalina Fly Away", CHeli::MakeCatalinaHeliFlyAway);
- DebugMenuAddVarBool8("Debug", "Script Heli On", (int8*)&CHeli::ScriptHeliOn, nil);
-
- DebugMenuAddVarBool8("Debug", "Show Ped Paths", (int8*)&gbShowPedPaths, nil);
- DebugMenuAddVarBool8("Debug", "Show Car Paths", (int8*)&gbShowCarPaths, nil);
- DebugMenuAddVarBool8("Debug", "Show Car Path Links", (int8*)&gbShowCarPathsLinks, nil);
- DebugMenuAddVarBool8("Debug", "Show Ped Road Groups", (int8*)&gbShowPedRoadGroups, nil);
- DebugMenuAddVarBool8("Debug", "Show Car Road Groups", (int8*)&gbShowCarRoadGroups, nil);
- DebugMenuAddVarBool8("Debug", "Show Collision Lines", (int8*)&gbShowCollisionLines, nil);
- DebugMenuAddVarBool8("Debug", "Show Collision Polys", (int8*)&gbShowCollisionPolys, nil);
- DebugMenuAddVarBool8("Debug", "Don't render Buildings", (int8*)&gbDontRenderBuildings, nil);
- DebugMenuAddVarBool8("Debug", "Don't render Big Buildings", (int8*)&gbDontRenderBigBuildings, nil);
- DebugMenuAddVarBool8("Debug", "Don't render Peds", (int8*)&gbDontRenderPeds, nil);
- DebugMenuAddVarBool8("Debug", "Don't render Vehicles", (int8*)&gbDontRenderVehicles, nil);
- DebugMenuAddVarBool8("Debug", "Don't render Objects", (int8*)&gbDontRenderObjects, nil);
+ DebugMenuAddVarBool8("Debug", "Script Heli On", &CHeli::ScriptHeliOn, nil);
+
+ DebugMenuAddVarBool8("Debug", "Show Ped Paths", &gbShowPedPaths, nil);
+ DebugMenuAddVarBool8("Debug", "Show Car Paths", &gbShowCarPaths, nil);
+ DebugMenuAddVarBool8("Debug", "Show Car Path Links", &gbShowCarPathsLinks, nil);
+ DebugMenuAddVarBool8("Debug", "Show Ped Road Groups", &gbShowPedRoadGroups, nil);
+ DebugMenuAddVarBool8("Debug", "Show Car Road Groups", &gbShowCarRoadGroups, nil);
+ DebugMenuAddVarBool8("Debug", "Show Collision Lines", &gbShowCollisionLines, nil);
+ DebugMenuAddVarBool8("Debug", "Show Collision Polys", &gbShowCollisionPolys, nil);
+ DebugMenuAddVarBool8("Debug", "Don't render Buildings", &gbDontRenderBuildings, nil);
+ DebugMenuAddVarBool8("Debug", "Don't render Big Buildings", &gbDontRenderBigBuildings, nil);
+ DebugMenuAddVarBool8("Debug", "Don't render Peds", &gbDontRenderPeds, nil);
+ DebugMenuAddVarBool8("Debug", "Don't render Vehicles", &gbDontRenderVehicles, nil);
+ DebugMenuAddVarBool8("Debug", "Don't render Objects", &gbDontRenderObjects, nil);
#ifdef TOGGLEABLE_BETA_FEATURES
- DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", (int8*)&CPed::bPopHeadsOnHeadshot, nil);
- DebugMenuAddVarBool8("Debug", "Toggle peds running to phones to report crimes", (int8*)&CPed::bMakePedsRunToPhonesToReportCrimes, nil);
+ DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", &CPed::bPopHeadsOnHeadshot, nil);
+ DebugMenuAddVarBool8("Debug", "Toggle peds running to phones to report crimes", &CPed::bMakePedsRunToPhonesToReportCrimes, nil);
#endif
DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);
@@ -361,11 +365,11 @@ DebugMenuPopulate(void)
extern bool PrintDebugCode;
extern int16 DebugCamMode;
- DebugMenuAddVarBool8("Cam", "Use mouse Cam", (int8*)&CCamera::m_bUseMouse3rdPerson, nil);
+ DebugMenuAddVarBool8("Cam", "Use mouse Cam", &CCamera::m_bUseMouse3rdPerson, nil);
#ifdef FREE_CAM
- DebugMenuAddVarBool8("Cam", "Free Cam", (int8*)&CCamera::bFreeCam, nil);
+ DebugMenuAddVarBool8("Cam", "Free Cam", &CCamera::bFreeCam, nil);
#endif
- DebugMenuAddVarBool8("Cam", "Print Debug Code", (int8*)&PrintDebugCode, nil);
+ DebugMenuAddVarBool8("Cam", "Print Debug Code", &PrintDebugCode, nil);
DebugMenuAddVar("Cam", "Cam Mode", &DebugCamMode, nil, 1, 0, CCam::MODE_EDITOR, nil);
DebugMenuAddCmd("Cam", "Normal", []() { DebugCamMode = 0; });
DebugMenuAddCmd("Cam", "Follow Ped With Bind", []() { DebugCamMode = CCam::MODE_FOLLOW_PED_WITH_BIND; });
diff --git a/src/extras/debugmenu.h b/src/extras/debugmenu.h
index 3ef8c742..462b59c4 100644
--- a/src/extras/debugmenu.h
+++ b/src/extras/debugmenu.h
@@ -80,3 +80,7 @@ inline DebugMenuEntry *DebugMenuAddVarBool8(const char *path, const char *name,
DebugMenuEntrySetWrap(e, true);
return e;
}
+inline DebugMenuEntry *DebugMenuAddVarBool8(const char *path, const char *name, bool *ptr, TriggerFunc triggerFunc)
+{
+ return DebugMenuAddVarBool8(path, name, (int8_t*)ptr, triggerFunc);
+}
diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp
index 42e62105..707f1b44 100644
--- a/src/rw/RwHelper.cpp
+++ b/src/rw/RwHelper.cpp
@@ -9,6 +9,8 @@
RtCharset *debugCharset;
#endif
+bool gPS2alphaTest = 1;
+
static bool charsetOpen;
void OpenCharsetSafe()
{
@@ -101,6 +103,8 @@ DefinedState(void)
#ifdef LIBRW
rw::SetRenderState(rw::ALPHATESTFUNC, rw::ALPHAGREATEREQUAL);
rw::SetRenderState(rw::ALPHATESTREF, 3);
+
+ rw::SetRenderState(rw::GSALPHATEST, gPS2alphaTest);
#else
// D3D stuff
RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER);
diff --git a/src/rw/RwHelper.h b/src/rw/RwHelper.h
index 8a55a832..a751ee39 100644
--- a/src/rw/RwHelper.h
+++ b/src/rw/RwHelper.h
@@ -1,5 +1,7 @@
#pragma once
+extern bool gPS2alphaTest;
+
void *RwMallocAlign(RwUInt32 size, RwUInt32 align);
void RwFreeAlign(void *mem);
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp
index 54e73a41..a3d52f69 100644
--- a/src/weapons/Weapon.cpp
+++ b/src/weapons/Weapon.cpp
@@ -600,8 +600,8 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
rotOffset.Normalise();
target = *fireSource;
- target.x = rotOffset.x * info->m_fRange;
- target.y = rotOffset.y * info->m_fRange;
+ target.x += rotOffset.x * info->m_fRange;
+ target.y += rotOffset.y * info->m_fRange;
if ( shooter->IsPed() )
DoDoomAiming(shooter, fireSource, &target);