AGS: Suppress endless "unused param" warnings in script api

From upstream b4a5ec72c059bc3c65e89a45a8b1218068a2015a
This commit is contained in:
Paul Gilbert 2022-04-24 12:48:32 -07:00
parent 043f80a237
commit 67628b9c6a
7 changed files with 24 additions and 9 deletions

View File

@ -3546,7 +3546,7 @@ void ScPl_Character_Think(CharacterInfo *chaa, const char *texx, ...) {
Character_Think(chaa, scsf_buffer);
}
void RegisterCharacterAPI(ScriptAPIVersion base_api, ScriptAPIVersion compat_api) {
void RegisterCharacterAPI(ScriptAPIVersion base_api, ScriptAPIVersion /* compat_api */) {
ccAddExternalObjectFunction("Character::AddInventory^2", Sc_Character_AddInventory);
ccAddExternalObjectFunction("Character::AddWaypoint^2", Sc_Character_AddWaypoint);
ccAddExternalObjectFunction("Character::Animate^5", Sc_Character_Animate);

View File

@ -550,7 +550,7 @@ RuntimeScriptValue Sc_DrawingSurface_GetWidth(void *self, const RuntimeScriptVal
//
//=============================================================================
void RegisterDrawingSurfaceAPI(ScriptAPIVersion base_api, ScriptAPIVersion compat_api) {
void RegisterDrawingSurfaceAPI(ScriptAPIVersion base_api, ScriptAPIVersion /*compat_api */) {
ccAddExternalObjectFunction("DrawingSurface::Clear^1", Sc_DrawingSurface_Clear);
ccAddExternalObjectFunction("DrawingSurface::CreateCopy^0", Sc_DrawingSurface_CreateCopy);
ccAddExternalObjectFunction("DrawingSurface::DrawCircle^3", Sc_DrawingSurface_DrawCircle);

View File

@ -717,11 +717,13 @@ RuntimeScriptValue Sc_GetWalkableAreaAtScreen(const RuntimeScriptValue *params,
}
RuntimeScriptValue Sc_GetDrawingSurfaceForWalkableArea(const RuntimeScriptValue *params, int32_t param_count) {
(void)params; (void)param_count;
ScriptDrawingSurface *ret_obj = Room_GetDrawingSurfaceForMask(kRoomAreaWalkable);
return RuntimeScriptValue().SetDynamicObject(ret_obj, ret_obj);
}
RuntimeScriptValue Sc_GetDrawingSurfaceForWalkbehind(const RuntimeScriptValue *params, int32_t param_count) {
(void)params; (void)param_count;
ScriptDrawingSurface *ret_obj = Room_GetDrawingSurfaceForMask(kRoomAreaWalkBehind);
return RuntimeScriptValue().SetDynamicObject(ret_obj, ret_obj);
}

View File

@ -147,6 +147,7 @@ RuntimeScriptValue Sc_GetHotspotAtScreen(const RuntimeScriptValue *params, int32
}
RuntimeScriptValue Sc_Hotspot_GetDrawingSurface(const RuntimeScriptValue *params, int32_t param_count) {
(void)params; (void)param_count;
ScriptDrawingSurface *ret_obj = Room_GetDrawingSurfaceForMask(kRoomAreaHotspot);
return RuntimeScriptValue().SetDynamicObject(ret_obj, ret_obj);
}

View File

@ -140,6 +140,7 @@ RuntimeScriptValue Sc_GetRegionAtScreen(const RuntimeScriptValue *params, int32_
}
RuntimeScriptValue Sc_Region_GetDrawingSurface(const RuntimeScriptValue *params, int32_t param_count) {
(void)params; (void)param_count;
ScriptDrawingSurface *ret_obj = Room_GetDrawingSurfaceForMask(kRoomAreaRegion);
return RuntimeScriptValue().SetDynamicObject(ret_obj, ret_obj);
}

View File

@ -266,7 +266,7 @@ RuntimeScriptValue Sc_Speech_GetPortraitOverlay(const RuntimeScriptValue *params
extern RuntimeScriptValue Sc_SetVoiceMode(const RuntimeScriptValue *params, int32_t param_count);
void RegisterSpeechAPI(ScriptAPIVersion base_api, ScriptAPIVersion compat_api) {
void RegisterSpeechAPI(ScriptAPIVersion base_api, ScriptAPIVersion /*compat_api*/) {
ccAddExternalStaticFunction("Speech::get_AnimationStopTimeMargin", Sc_Speech_GetAnimationStopTimeMargin);
ccAddExternalStaticFunction("Speech::set_AnimationStopTimeMargin", Sc_Speech_SetAnimationStopTimeMargin);
ccAddExternalStaticFunction("Speech::get_CustomPortraitPlacement", Sc_Speech_GetCustomPortraitPlacement);

View File

@ -58,21 +58,26 @@ inline const char *ScriptVSprintf(char *buffer, size_t buf_length, const char *f
return ScriptSprintf(buffer, buf_length, format, nullptr, 0, &arg_ptr);
}
// Helper macros for script functions
// Helper macros for script functions;
// asserting for internal mistakes; supressing "unused param" warnings
#define ASSERT_SELF(METHOD) \
assert((self != NULL) && "Object pointer is null in call to API function")
(void)params; (void)param_count; \
assert((self != NULL) && "Object pointer is null in call to API function")
#define ASSERT_PARAM_COUNT(FUNCTION, X) \
assert((params != NULL && param_count >= X) && "Not enough parameters in call to API function")
(void)params; (void)param_count; \
assert((params != NULL && param_count >= X) && "Not enough parameters in call to API function")
#define ASSERT_VARIABLE_VALUE(VARIABLE) \
assert((params != NULL && param_count >= 1) && "Not enough parameters to set API property")
(void)params; (void)param_count; \
assert((params != NULL && param_count >= 1) && "Not enough parameters to set API property")
#define ASSERT_OBJ_PARAM_COUNT(METHOD, X) \
ASSERT_SELF(METHOD); \
ASSERT_PARAM_COUNT(METHOD, X)
ASSERT_SELF(METHOD); \
ASSERT_PARAM_COUNT(METHOD, X)
//-----------------------------------------------------------------------------
// Get/set variables
#define API_VARGET_INT(VARIABLE) \
(void)params; (void)param_count; \
return RuntimeScriptValue().SetInt32(VARIABLE)
#define API_VARSET_PINT(VARIABLE) \
@ -123,6 +128,7 @@ inline const char *ScriptVSprintf(char *buffer, size_t buf_length, const char *f
//
#define API_SCALL_VOID(FUNCTION) \
(void)params; (void)param_count; \
FUNCTION(); \
return RuntimeScriptValue((int32_t)0)
@ -212,6 +218,7 @@ inline const char *ScriptVSprintf(char *buffer, size_t buf_length, const char *f
return RuntimeScriptValue((int32_t)0)
#define API_SCALL_INT(FUNCTION) \
(void)params; (void)param_count; \
return RuntimeScriptValue().SetInt32(FUNCTION())
#define API_SCALL_INT_PINT(FUNCTION) \
@ -263,6 +270,7 @@ inline const char *ScriptVSprintf(char *buffer, size_t buf_length, const char *f
return RuntimeScriptValue().SetInt32(FUNCTION(params[0].IValue, (P1CLASS*)params[1].Ptr))
#define API_SCALL_FLOAT(FUNCTION) \
(void)params; (void)param_count; \
return RuntimeScriptValue().SetFloat(FUNCTION())
#define API_SCALL_FLOAT_PINT(FUNCTION) \
@ -278,6 +286,7 @@ inline const char *ScriptVSprintf(char *buffer, size_t buf_length, const char *f
return RuntimeScriptValue().SetFloat(FUNCTION(params[0].FValue, params[1].FValue))
#define API_SCALL_BOOL(FUNCTION) \
(void)params; (void)param_count; \
return RuntimeScriptValue().SetInt32AsBool(FUNCTION())
#define API_SCALL_BOOL_POBJ(FUNCTION, P1CLASS) \
@ -297,6 +306,7 @@ inline const char *ScriptVSprintf(char *buffer, size_t buf_length, const char *f
return RuntimeScriptValue().SetInt32AsBool(FUNCTION((P1CLASS*)params[0].Ptr, (P2CLASS*)params[1].Ptr))
#define API_SCALL_OBJ(RET_CLASS, RET_MGR, FUNCTION) \
(void)params; (void)param_count; \
return RuntimeScriptValue().SetDynamicObject((void*)(RET_CLASS*)FUNCTION(), &RET_MGR)
#define API_CONST_SCALL_OBJ(RET_CLASS, RET_MGR, FUNCTION) \
@ -335,6 +345,7 @@ inline const char *ScriptVSprintf(char *buffer, size_t buf_length, const char *f
return RuntimeScriptValue().SetDynamicObject(const_cast<void *>((const void *)(RET_CLASS*)FUNCTION((P1CLASS*)params[0].Ptr)), &RET_MGR)
#define API_SCALL_OBJAUTO(RET_CLASS, FUNCTION) \
(void)params; (void)param_count; \
RET_CLASS* ret_obj = FUNCTION(); \
return RuntimeScriptValue().SetDynamicObject(ret_obj, ret_obj)