mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 14:37:29 +08:00
[saco] Update scriping.cpp/.h
* Implements ExecuteScriptBuf * Implements InitScripting * Adds ScriptCommand stub
This commit is contained in:
parent
6437517d1f
commit
57d7aa1e22
@ -4,6 +4,7 @@
|
||||
#include "address.h"
|
||||
#include "audio.h"
|
||||
#include "camera.h"
|
||||
#include "scripting.h"
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
|
@ -1,5 +1,43 @@
|
||||
|
||||
#include "../main.h"
|
||||
|
||||
GAME_SCRIPT_THREAD* gst;
|
||||
FARPROC ProcessOneCommand = (FARPROC)0x469EB0;
|
||||
BYTE ScriptBuf[255];
|
||||
|
||||
DWORD dwScmOpcodeDebug=0;
|
||||
BOOL bScmLocalDebug=FALSE;
|
||||
|
||||
int __declspec(naked) ExecuteScriptBuf()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov bScmLocalDebug, 1;
|
||||
|
||||
mov eax, OFFSET ScriptBuf // Move our script buffer base into eax.
|
||||
|
||||
mov ecx, gst // Move GAME_SCRIPT_THREAD structure into ecx.
|
||||
mov [ecx+0x14], eax // Move eax into the gst->dwScriptIP.
|
||||
|
||||
call ProcessOneCommand // Call the game's script opcode processor.
|
||||
|
||||
mov ecx, gst // Move game script thread into ecx again.
|
||||
mov eax, [ecx+0xC5] // Move the dwIfFlag into eax (return value).
|
||||
|
||||
mov bScmLocalDebug, 0;
|
||||
|
||||
ret // return.
|
||||
}
|
||||
}
|
||||
|
||||
int ScriptCommand(const SCRIPT_COMMAND* pScriptCommand, ...)
|
||||
{
|
||||
// TODO: ScriptCommand
|
||||
return 0;
|
||||
}
|
||||
|
||||
void InitScripting()
|
||||
{
|
||||
gst = new GAME_SCRIPT_THREAD;
|
||||
ZeroMemory(gst, sizeof(GAME_SCRIPT_THREAD));
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define MAX_SCRIPT_VARS 16 // Size of our variable saving array
|
||||
|
||||
// Super Simplified SA Version
|
||||
struct GAME_SCRIPT_THREAD // 0xE0 bytes total.
|
||||
{
|
||||
BYTE _gap0[224];
|
||||
};
|
||||
|
||||
struct SCRIPT_COMMAND // Params
|
||||
{ // i = integer
|
||||
WORD OpCode; // f = float
|
||||
char Params[MAX_SCRIPT_VARS]; // v = variable
|
||||
}; // s = string
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user