mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Add ChangeFloor/Ceiling, fix Random
This commit is contained in:
parent
6a743db1eb
commit
1d373d2c81
6 changed files with 97 additions and 9 deletions
|
|
@ -300,6 +300,15 @@ bool ACSVM_MapScope_ScriptStop(ACSVM_MapScope *scope,
|
||||||
->scriptStop(name, {id.global, id.hub, id.map});
|
->scriptStop(name, {id.global, id.hub, id.map});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// ACSVM_MapScope_GetString
|
||||||
|
//
|
||||||
|
ACSVM_String *ACSVM_MapScope_GetString(ACSVM_MapScope *scope, ACSVM::Word idx)
|
||||||
|
{
|
||||||
|
return reinterpret_cast<ACSVM_String *>(
|
||||||
|
reinterpret_cast<ACSVM::MapScope *>(scope)->getString(idx));
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// ACSVM_MapScope_SetActive
|
// ACSVM_MapScope_SetActive
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,8 @@ ACSVM_Word ACSVM_MapScope_ScriptStartTypeForced(ACSVM_MapScope *scope,
|
||||||
bool ACSVM_MapScope_ScriptStop(ACSVM_MapScope *scope,
|
bool ACSVM_MapScope_ScriptStop(ACSVM_MapScope *scope,
|
||||||
ACSVM_ScriptName name, ACSVM_ScopeID id);
|
ACSVM_ScriptName name, ACSVM_ScopeID id);
|
||||||
|
|
||||||
|
ACSVM_String *ACSVM_MapScope_GetString(ACSVM_MapScope *scope, ACSVM_Word idx);
|
||||||
|
|
||||||
void ACSVM_MapScope_SetActive(ACSVM_MapScope *scope, bool active);
|
void ACSVM_MapScope_SetActive(ACSVM_MapScope *scope, bool active);
|
||||||
|
|
||||||
ACSVM_Array *ACSVM_ModuleScope_GetModArr (ACSVM_ModuleScope *scope, ACSVM_Word idx);
|
ACSVM_Array *ACSVM_ModuleScope_GetModArr (ACSVM_ModuleScope *scope, ACSVM_Word idx);
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -23,6 +23,10 @@
|
||||||
#include "m_random.h"
|
#include "m_random.h"
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
#include "d_player.h"
|
#include "d_player.h"
|
||||||
|
#include "r_defs.h"
|
||||||
|
#include "r_state.h"
|
||||||
|
#include "p_polyobj.h"
|
||||||
|
#include "taglist.h"
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
bool ACS_CF_Random(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC)
|
bool ACS_CF_Random(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC)
|
||||||
|
|
@ -31,10 +35,15 @@
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
bool ACS_CF_Random(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC)
|
bool ACS_CF_Random(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC)
|
||||||
{
|
{
|
||||||
|
INT32 low = 0;
|
||||||
|
INT32 high = 0;
|
||||||
|
|
||||||
(void)argC;
|
(void)argC;
|
||||||
|
|
||||||
CONS_Printf("RANDOM %d thru %d\n", argV[0], argV[1]);
|
low = (INT32)argV[0];
|
||||||
ACSVM_Thread_DataStk_Push(thread, P_RandomRange(PR_ACS, argV[0], argV[1]));
|
high = (INT32)argV[1];
|
||||||
|
|
||||||
|
ACSVM_Thread_DataStk_Push(thread, P_RandomRange(PR_ACS, low, high));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -78,6 +87,68 @@ bool ACS_CF_PolyWait(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word ar
|
||||||
return true; // Execution interrupted
|
return true; // Execution interrupted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------
|
||||||
|
bool ACS_CF_ChangeFloor(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC)
|
||||||
|
|
||||||
|
Changes a floor texture.
|
||||||
|
--------------------------------------------------*/
|
||||||
|
bool ACS_CF_ChangeFloor(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC)
|
||||||
|
{
|
||||||
|
ACSVM_MapScope *map = NULL;
|
||||||
|
ACSVM_String *str = NULL;
|
||||||
|
const char *texName = NULL;
|
||||||
|
|
||||||
|
INT32 secnum = -1;
|
||||||
|
INT32 tag = 0;
|
||||||
|
|
||||||
|
(void)argC;
|
||||||
|
|
||||||
|
tag = argV[0];
|
||||||
|
|
||||||
|
map = ACSVM_Thread_GetScopeMap(thread);
|
||||||
|
str = ACSVM_MapScope_GetString(map, argV[1]);
|
||||||
|
texName = ACSVM_String_GetStr(str);
|
||||||
|
|
||||||
|
TAG_ITER_SECTORS(tag, secnum)
|
||||||
|
{
|
||||||
|
sector_t *sec = §ors[secnum];
|
||||||
|
sec->floorpic = P_AddLevelFlatRuntime(texName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------
|
||||||
|
bool ACS_CF_ChangeCeiling(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC)
|
||||||
|
|
||||||
|
Changes a ceiling texture.
|
||||||
|
--------------------------------------------------*/
|
||||||
|
bool ACS_CF_ChangeCeiling(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC)
|
||||||
|
{
|
||||||
|
ACSVM_MapScope *map = NULL;
|
||||||
|
ACSVM_String *str = NULL;
|
||||||
|
const char *texName = NULL;
|
||||||
|
|
||||||
|
INT32 secnum = -1;
|
||||||
|
INT32 tag = 0;
|
||||||
|
|
||||||
|
(void)argC;
|
||||||
|
|
||||||
|
tag = argV[0];
|
||||||
|
|
||||||
|
map = ACSVM_Thread_GetScopeMap(thread);
|
||||||
|
str = ACSVM_MapScope_GetString(map, argV[1]);
|
||||||
|
texName = ACSVM_String_GetStr(str);
|
||||||
|
|
||||||
|
TAG_ITER_SECTORS(tag, secnum)
|
||||||
|
{
|
||||||
|
sector_t *sec = §ors[secnum];
|
||||||
|
sec->ceilingpic = P_AddLevelFlatRuntime(texName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
bool ACS_CF_EndPrint(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC)
|
bool ACS_CF_EndPrint(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC)
|
||||||
|
|
||||||
|
|
|
||||||
18
src/k_acs.c
18
src/k_acs.c
|
|
@ -151,7 +151,7 @@ static void ACS_EnvThreadKilled(ACSVM_Environment const *env, ACSVM_Thread *thre
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
static void ACS_AddCodeDataCallFunc(
|
static void ACS_AddCodeDataCallFunc(
|
||||||
ACSVM_Environment *env, ACSVM_Word code,
|
ACSVM_Environment *env, ACSVM_Word code,
|
||||||
char const *args, ACSVM_Word stack, ACSVM_Word func)
|
char const *args, ACSVM_Word argc, ACSVM_CallFunc func)
|
||||||
|
|
||||||
Shortcut function to simplify adding
|
Shortcut function to simplify adding
|
||||||
CallFuncs. These are for code data ones;
|
CallFuncs. These are for code data ones;
|
||||||
|
|
@ -172,13 +172,13 @@ static void ACS_EnvThreadKilled(ACSVM_Environment const *env, ACSVM_Thread *thre
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static inline void ACS_AddCodeDataCallFunc(ACSVM_Environment *env, ACSVM_Word code, char const *args, ACSVM_Word argc, ACSVM_CallFunc func)
|
static inline void ACS_AddCodeDataCallFunc(ACSVM_Environment *env, ACSVM_Word code, char const *args, ACSVM_Word argc, ACSVM_CallFunc func)
|
||||||
{
|
{
|
||||||
|
ACSVM_Word funcId = ACSVM_Environment_AddCallFunc(env, func);
|
||||||
|
ACSVM_Code tCode = (argc != 0 ? ACSVM_Code_CallFunc : ACSVM_Code_CallFunc_Lit);
|
||||||
|
|
||||||
ACSVM_Environment_AddCodeDataACS0(
|
ACSVM_Environment_AddCodeDataACS0(
|
||||||
env,
|
env, code,
|
||||||
code,
|
args, tCode, argc,
|
||||||
args,
|
funcId
|
||||||
((argc > 0) ? ACSVM_Code_CallFunc_Lit : ACSVM_Code_CallFunc),
|
|
||||||
argc,
|
|
||||||
ACSVM_Environment_AddCallFunc(env, func)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -216,6 +216,10 @@ static void ACS_EnvConstruct(ACSVM_Environment *env)
|
||||||
ACS_AddCodeDataCallFunc(env, 62, "W", 0, ACS_CF_TagWait);
|
ACS_AddCodeDataCallFunc(env, 62, "W", 0, ACS_CF_TagWait);
|
||||||
ACS_AddCodeDataCallFunc(env, 63, "", 1, ACS_CF_PolyWait);
|
ACS_AddCodeDataCallFunc(env, 63, "", 1, ACS_CF_PolyWait);
|
||||||
ACS_AddCodeDataCallFunc(env, 64, "W", 0, ACS_CF_PolyWait);
|
ACS_AddCodeDataCallFunc(env, 64, "W", 0, ACS_CF_PolyWait);
|
||||||
|
ACS_AddCodeDataCallFunc(env, 65, "", 2, ACS_CF_ChangeFloor);
|
||||||
|
ACS_AddCodeDataCallFunc(env, 66, "WWS", 0, ACS_CF_ChangeFloor);
|
||||||
|
ACS_AddCodeDataCallFunc(env, 67, "", 2, ACS_CF_ChangeCeiling);
|
||||||
|
ACS_AddCodeDataCallFunc(env, 68, "WWS", 0, ACS_CF_ChangeCeiling);
|
||||||
// 69 to 79: Implemented by ACSVM
|
// 69 to 79: Implemented by ACSVM
|
||||||
|
|
||||||
// 81 to 82: Implemented by ACSVM
|
// 81 to 82: Implemented by ACSVM
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,8 @@ void ACS_Tick(void);
|
||||||
bool ACS_CF_Random(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC);
|
bool ACS_CF_Random(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC);
|
||||||
bool ACS_CF_TagWait(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC);
|
bool ACS_CF_TagWait(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC);
|
||||||
bool ACS_CF_PolyWait(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC);
|
bool ACS_CF_PolyWait(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC);
|
||||||
|
bool ACS_CF_ChangeFloor(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC);
|
||||||
|
bool ACS_CF_ChangeCeiling(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC);
|
||||||
bool ACS_CF_EndPrint(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC);
|
bool ACS_CF_EndPrint(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC);
|
||||||
bool ACS_CF_PlayerCount(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC);
|
bool ACS_CF_PlayerCount(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC);
|
||||||
bool ACS_CF_GameType(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC);
|
bool ACS_CF_GameType(ACSVM_Thread *thread, ACSVM_Word const *argV, ACSVM_Word argC);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue