1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 17:40:00 +00:00

script coronas

This commit is contained in:
Nikolay Korolev 2021-01-23 02:36:13 +03:00
parent bdb216bf7c
commit 917cf44def
5 changed files with 99 additions and 12 deletions

View file

@ -11,6 +11,7 @@
#include "CivilianPed.h" #include "CivilianPed.h"
#include "Clock.h" #include "Clock.h"
#include "CopPed.h" #include "CopPed.h"
#include "Coronas.h"
#include "Debug.h" #include "Debug.h"
#include "DMAudio.h" #include "DMAudio.h"
#include "EmergencyPed.h" #include "EmergencyPed.h"
@ -98,7 +99,7 @@ uint16 CTheScripts::NumberOfExclusiveMissionScripts;
bool CTheScripts::bPlayerHasMetDebbieHarry; bool CTheScripts::bPlayerHasMetDebbieHarry;
bool CTheScripts::bPlayerIsInTheStatium; bool CTheScripts::bPlayerIsInTheStatium;
int CTheScripts::AllowedCollision[MAX_ALLOWED_COLLISIONS]; int CTheScripts::AllowedCollision[MAX_ALLOWED_COLLISIONS];
bool CTheScripts::FSDestroyedFlag; int CTheScripts::FSDestroyedFlag;
short* CTheScripts::SavedVarIndices; short* CTheScripts::SavedVarIndices;
int CTheScripts::NumSaveVars; int CTheScripts::NumSaveVars;
int gScriptsFile = -1; int gScriptsFile = -1;
@ -107,6 +108,9 @@ bool CTheScripts::InTheScripts;
CRunningScript* pCurrent; CRunningScript* pCurrent;
uint16 CTheScripts::NumTrueGlobals; uint16 CTheScripts::NumTrueGlobals;
uint16 CTheScripts::MostGlobals; uint16 CTheScripts::MostGlobals;
CVector gVectorSetInLua;
int CTheScripts::NextScriptCoronaID;
base::cSList<script_corona> CTheScripts::mCoronas;
#ifdef MISSION_REPLAY #ifdef MISSION_REPLAY
@ -2620,6 +2624,14 @@ bool CTheScripts::Init(bool loaddata)
memset(&UsedObjectArray[i].name, 0, sizeof(UsedObjectArray[i].name)); memset(&UsedObjectArray[i].name, 0, sizeof(UsedObjectArray[i].name));
UsedObjectArray[i].index = 0; UsedObjectArray[i].index = 0;
} }
#if defined FIX_BUGS || (!defined GTA_PS2 && !defined GTA_PSP)
for (base::cSList<script_corona>::tSItem* i = CTheScripts::mCoronas.first; i;) {
base::cSList<script_corona>::tSItem* next = i->next;
delete i;
i = next;
}
CTheScripts::mCoronas.first = nil;
#endif
NumberOfUsedObjects = 0; NumberOfUsedObjects = 0;
if (ScriptSpace) if (ScriptSpace)
Shutdown(); Shutdown();
@ -2772,8 +2784,6 @@ void CTheScripts::Process()
UseTextCommands = 0; UseTextCommands = 0;
} }
// TODO: mCoronas
#ifdef MISSION_REPLAY #ifdef MISSION_REPLAY
static uint32 TimeToWaitTill; static uint32 TimeToWaitTill;
switch (AllowMissionReplay) { switch (AllowMissionReplay) {
@ -2833,6 +2843,11 @@ void CTheScripts::Process()
if (script && !script->m_bIsActive) if (script && !script->m_bIsActive)
script = nil; script = nil;
} }
InTheScripts = false;
for (base::cSList<script_corona>::tSItem* i = CTheScripts::mCoronas.first; i; i = i->next) {
CCoronas::RegisterCorona((uint32)(uintptr)i, i->item.r, i->item.g, i->item.b, 255, CVector(i->item.x, i->item.y, i->item.z),
-i->item.size, 450.0f, i->item.type, i->item.flareType, 1, 0, 0, 0.0f);
}
DbgFlag = false; DbgFlag = false;
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
PrintToLog("Script processing done, ScriptsUpdated: %d, CommandsExecuted: %d\n", ScriptsUpdated, CommandsExecuted); PrintToLog("Script processing done, ScriptsUpdated: %d, CommandsExecuted: %d\n", ScriptsUpdated, CommandsExecuted);

View file

@ -4,6 +4,7 @@
#include "Ped.h" #include "Ped.h"
#include "PedType.h" #include "PedType.h"
#include "Text.h" #include "Text.h"
#include "sList.h"
#include "Sprite2d.h" #include "Sprite2d.h"
class CEntity; class CEntity;
@ -273,6 +274,20 @@ struct tBuildingSwap
int32 m_nOldModel; int32 m_nOldModel;
}; };
struct script_corona
{
int id;
float x;
float y;
float z;
float size;
uint8 r;
uint8 g;
uint8 b;
int type;
int flareType;
};
enum { enum {
VAR_LOCAL = 1, VAR_LOCAL = 1,
@ -343,12 +358,14 @@ public:
static int AllowedCollision[MAX_ALLOWED_COLLISIONS]; static int AllowedCollision[MAX_ALLOWED_COLLISIONS];
static short* SavedVarIndices; static short* SavedVarIndices;
static int NumSaveVars; static int NumSaveVars;
static bool FSDestroyedFlag; static int FSDestroyedFlag;
static int NextProcessId; static int NextProcessId;
static bool InTheScripts; static bool InTheScripts;
static CRunningScript* pCurrent; static CRunningScript* pCurrent;
static uint16 NumTrueGlobals; static uint16 NumTrueGlobals;
static uint16 MostGlobals; static uint16 MostGlobals;
static base::cSList<script_corona> mCoronas;
static int NextScriptCoronaID;
static bool Init(bool loaddata = false); static bool Init(bool loaddata = false);
static void Process(); static void Process();
@ -468,6 +485,8 @@ public:
static void SetObjectiveForAllPedsInCollective(int, eObjective); static void SetObjectiveForAllPedsInCollective(int, eObjective);
#endif #endif
bool IsFortStauntonDestroyed() { return *(int32*)&ScriptSpace[FSDestroyedFlag] == 1; }
}; };
extern int ScriptParams[32]; extern int ScriptParams[32];
@ -665,4 +684,5 @@ extern int scriptToLoad;
#endif #endif
extern int gScriptsFile; extern int gScriptsFile;
extern CVector gVectorSetInLua;

View file

@ -601,19 +601,36 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
case COMMAND_CREATE_SCRIPT_CORONA: case COMMAND_CREATE_SCRIPT_CORONA:
{ {
CollectParameters(&m_nIp, 9); CollectParameters(&m_nIp, 9);
static bool bShowed = false; base::cSList<script_corona>::tSItem* pCorona = new base::cSList<script_corona>::tSItem();
if (!bShowed) { pCorona->item.x = GET_FLOAT_PARAM(0);
debug("CREATE_SCRIPT_CORONA not implemented"); pCorona->item.y = GET_FLOAT_PARAM(1);
bShowed = true; pCorona->item.z = GET_FLOAT_PARAM(2);
} pCorona->item.id = CTheScripts::NextScriptCoronaID++;
SET_INTEGER_PARAM(0, -1); if (pCorona->item.z <= MAP_Z_LOW_LIMIT)
pCorona->item.z = CWorld::FindGroundZForCoord(pCorona->item.x, pCorona->item.y);
pCorona->item.size = GET_FLOAT_PARAM(3);
pCorona->item.r = GET_INTEGER_PARAM(6);
pCorona->item.g = GET_INTEGER_PARAM(7);
pCorona->item.b = GET_INTEGER_PARAM(8);
pCorona->item.type = GET_INTEGER_PARAM(4);
pCorona->item.flareType = GET_INTEGER_PARAM(5);
SET_INTEGER_PARAM(0, pCorona->item.id);
CTheScripts::mCoronas.Insert(pCorona);
StoreParameters(&m_nIp, 1); StoreParameters(&m_nIp, 1);
return 0; return 0;
} }
case COMMAND_REMOVE_SCRIPT_CORONA: case COMMAND_REMOVE_SCRIPT_CORONA:
{
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
// TODO for (base::cSList<script_corona>::tSItem* i = CTheScripts::mCoronas.first; i; i = i->next) {
if (i->item.id == GET_INTEGER_PARAM(0)) {
CTheScripts::mCoronas.Remove(i);
delete i;
break;
}
}
return 0; return 0;
}
case COMMAND_IS_BOAT_IN_WATER: case COMMAND_IS_BOAT_IN_WATER:
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);

View file

@ -651,7 +651,7 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
return 0; return 0;
} }
case COMMAND_GET_VECTOR_FROM_MULTIPLAYER: case COMMAND_GET_VECTOR_FROM_MULTIPLAYER:
// SET_VECTOR_PARAM(0, gVectorSetInLua); SET_VECTOR_PARAM(0, gVectorSetInLua);
StoreParameters(&m_nIp, 3); StoreParameters(&m_nIp, 3);
return 0; return 0;
case COMMAND_PRINT_HELP_ALWAYS: case COMMAND_PRINT_HELP_ALWAYS:

35
src/leeds/base/sList.h Normal file
View file

@ -0,0 +1,35 @@
#pragma once
namespace base
{
template<typename T>
class cSList
{
public:
struct tSItem
{
tSItem* next;
T item;
};
// extra field on PS2
tSItem* first;
cSList() { first = nil; }
void Insert(tSItem* item) { tSItem* n = first; first = item; item->next = n; }
void Remove(tSItem* item) {
if (first == item) {
first = item->next;
return;
}
tSItem* i = first;
while (i && i->next != item)
i = i->next;
assert(i);
i->next = item->next;
}
};
}