m32script: stuff for fiddling with polymer lights

git-svn-id: https://svn.eduke32.com/eduke32@1521 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2009-10-03 13:20:31 +00:00
parent 540962f35c
commit 40d655100c
5 changed files with 39 additions and 3 deletions

View file

@ -94,6 +94,7 @@ enum GameEvent_t {
EVENT_KEYS2D,
EVENT_KEYS3D,
EVENT_OVERHEADEDITOR,
EVENT_PREKEYS3D,
MAXEVENTS
};

View file

@ -4504,6 +4504,8 @@ static void Keys3d(void)
enddrawing();
}
X_OnEvent(EVENT_PREKEYS3D, -1);
if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_V]) // ' V
{
keystatus[KEYSC_V] = 0;

View file

@ -246,6 +246,7 @@ const char *keyw[] =
"displayrand",
"clamp",
"inv", // inversion function.. not internal
"sqrt",
"mulscale",
@ -306,6 +307,7 @@ const char *keyw[] =
"ifoutside",
// BUILD functions
"resetkey",
"insertsprite",
"dupsprite",
"deletesprite",
@ -342,6 +344,7 @@ const char *keyw[] =
"definequote",
"redefinequote",
"print",
"quote",
"error",
"printmessage16",
@ -2516,6 +2519,11 @@ repeatcase:
break;
// *** other math
case CON_CLAMP:
C_GetNextVarType(GAMEVAR_READONLY);
C_GetManyVars(2);
return 0;
case CON_INV:
C_GetNextVarType(GAMEVAR_READONLY);
return 0;
@ -2699,6 +2707,7 @@ repeatcase:
}
// *** BUILD functions
case CON_RESETKEY:
case CON_INSERTSPRITE:
case CON_DUPSPRITE:
case CON_DELETESPRITE:
@ -2876,6 +2885,7 @@ repeatcase:
}
return 0;
case CON_PRINT:
case CON_QUOTE:
case CON_ERRORINS:
case CON_PRINTMESSAGE16:
@ -3079,6 +3089,7 @@ static void C_AddDefaultDefinitions(void)
C_AddDefinition("EVENT_KEYS2D", EVENT_KEYS2D, LABEL_EVENT);
C_AddDefinition("EVENT_KEYS3D", EVENT_KEYS3D, LABEL_EVENT);
C_AddDefinition("EVENT_OVERHEADEDITOR", EVENT_OVERHEADEDITOR, LABEL_EVENT);
C_AddDefinition("EVENT_PREKEYS3D", EVENT_PREKEYS3D, LABEL_EVENT);
C_AddDefinition("CLIPMASK0", CLIPMASK0, LABEL_DEFINE);
C_AddDefinition("CLIPMASK1", CLIPMASK1, LABEL_DEFINE);

View file

@ -308,6 +308,7 @@ enum ScriptKeywords_t
CON_DISPLAYRAND,
// other math
CON_CLAMP,
CON_INV,
CON_SQRT,
CON_MULSCALE,
@ -382,6 +383,7 @@ enum ScriptKeywords_t
/// CON_IFNOSOUNDS,
// BUILD functions
CON_RESETKEY,
CON_INSERTSPRITE,
CON_DUPSPRITE,
CON_DELETESPRITE,
@ -420,6 +422,7 @@ enum ScriptKeywords_t
// strings
CON_DEFINEQUOTE,
CON_REDEFINEQUOTE,
CON_PRINT,
CON_QUOTE,
CON_ERRORINS,
CON_PRINTMESSAGE16,

View file

@ -823,6 +823,17 @@ skip_check:
continue;
// *** other math
case CON_CLAMP:
insptr++;
{
int32_t var=*insptr++, min=Gv_GetVarX(*insptr++), max=Gv_GetVarX(*insptr++);
int32_t val=Gv_GetVarX(var);
if (val<min) Gv_SetVarX(var, min);
else if (val>max) Gv_SetVarX(var, max);
}
continue;
case CON_INV:
Gv_SetVarX(*(insptr+1), -Gv_GetVarX(*(insptr+1)));
insptr += 2;
@ -1334,6 +1345,7 @@ badindex:
case CON_IFHITKEY:
case CON_IFHOLDKEY:
case CON_RESETKEY:
insptr++;
{
int32_t key=Gv_GetVarX(*insptr);
@ -1343,9 +1355,13 @@ badindex:
vm.g_errorFlag = 1;
continue;
}
X_DoConditional(keystatus[key]);
if (tw==CON_IFHITKEY)
if (tw != CON_RESETKEY)
X_DoConditional(keystatus[key]);
else
insptr++;
if (tw != CON_IFHOLDKEY)
{
if (!(key==0 || key==KEYSC_ESC || key==KEYSC_TILDE || key==KEYSC_gENTER ||
key==KEYSC_LALT || key==KEYSC_RALT || key==KEYSC_LCTRL || key==KEYSC_RCTRL ||
@ -2027,6 +2043,7 @@ badindex:
}
continue;
case CON_PRINT:
case CON_QUOTE:
case CON_ERRORINS:
case CON_PRINTMESSAGE16:
@ -2046,6 +2063,8 @@ badindex:
X_ERROR_INVALIDQUOTE(i, ScriptQuotes);
if (tw==CON_PRINT)
OSD_Printf("%s\n", ScriptQuotes[i]);
if (tw==CON_QUOTE)
message("%s", ScriptQuotes[i]);
else if (tw==CON_PRINTMESSAGE16)