Hmm I checked and this seems to be a problem of recent AGS versions. There is another struct that has the same function but those should not clash. Hmm I guess I'm going to write a bug report on this. Which AGS version are you using?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
enum TimerEventType
{
eEvtGunBlast1,
eEvtGunBlast2,
eEvtExplosion,
// ...
}
struct TimerEvent
{
int delay;
TimerEventType type;
};
#define MAX_EVENTS 100
TimerEvent events[MAX_EVENTS];
int event_count;
int last_event;
int time_elapsed;
void OnEvent(TimerEventType event)
{
if (event == eEvtGunBlast1)
{
// Do something
}
else if (event == eEvtGunBlast2)
{
// Do something else
}
// ...
}
void CheckEvents()
{
if (last_event == event_count - 1) // Last event already happened
return;
if (time_elapsed >= events[last_event].delay) // Next event should happen
{
OnEvent(events[last_event].type);
last_event++;
time_elapsed = 0; // Reset timer
}
else
time_elapsed++; // Update timer
}
void AddEvent(int delay, TimerEventType type)
{
if (event_count == MAX_EVENTS) return; // Error here, increase the maximum
events[event_count].delay = delay;
events[event_count].type = type;
event_count++;
}
void SetupEvents()
{
AddEvent(30, eEvtGunBlast1);
AddEvent(10, eEvtExplosion);
AddEvent(120, eEvtGunBlast2);
AddEvent(10, eEvtExplosion);
}
CDAudio(eCDEject, 0);
#define RETURN_AGS_FLOAT(x) return *((int32 *) &(x))
#define AGS_FLOAT(x) (*((float *) &(x)))
// Somewhere else:
int32 AGSFastSin(int32 x)
{
RETURN_ARGS_FLOAT(FastSin(AGS_FLOAT(x)));
}
Mystruct.Function1();
MyStruct foo;
foo.Function1();
struct MyPlugin {
/// Autocomplete text for Function 1
import static void Function1(); // $AUTOCOMPLETESTATICONLY$
/// Autocomplete text for Function 2
import static int Function2(int a, int b); // $AUTOCOMPLETESTATICONLY$
int dummy; // $AUTOCOMPLETEIGNORE$
};
engine->RegisterScriptFunction("MyPlugin::Function1^0", (void *) Function1);
engine->RegisterScriptFunction("MyPlugin::Function2^2", (void *) Function2);
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.044 seconds with 16 queries.