mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-22 18:32:44 +01:00
Script: 01FB (Sqrt) and 0209 (Random Int in Range)
This commit is contained in:
parent
bb3b879848
commit
6491acf035
@ -217,6 +217,18 @@ void vm_mission_over(const ScriptArguments& args)
|
||||
*args.getState()->scriptOnMissionFlag = 0;
|
||||
}
|
||||
|
||||
void vm_sqrt(const ScriptArguments& args)
|
||||
{
|
||||
*args[1].globalReal -= std::sqrt(args[0].real);
|
||||
}
|
||||
|
||||
void vm_random_int_in_range(const ScriptArguments& args)
|
||||
{
|
||||
auto min = args[0].integerValue();
|
||||
auto max = args[1].integerValue();
|
||||
*args[2].globalInteger = std::rand() % (max - min) + min;
|
||||
}
|
||||
|
||||
void vm_name_thread(const ScriptArguments& args)
|
||||
{
|
||||
strncpy(args.getThread()->name, args[0].string, 16);
|
||||
@ -300,6 +312,10 @@ VMModule::VMModule()
|
||||
|
||||
bindFunction(0x0D8, vm_mission_over, 0, "Set Mission Finished");
|
||||
|
||||
bindFunction(0x1FB, vm_sqrt, 2, "Sqrt");
|
||||
|
||||
bindFunction(0x209, vm_random_int_in_range, 3, "Random Int in Range");
|
||||
|
||||
bindFunction(0x2CD, vm_call, 2, "Call");
|
||||
|
||||
bindFunction(0x3A4, vm_name_thread, 1, "Name Thread");
|
||||
|
Loading…
Reference in New Issue
Block a user