Add op_tile_under_cursor

This commit is contained in:
Alexander Batalov 2023-04-20 10:25:13 +03:00
parent ecc6a8679b
commit cf4921de1e
1 changed files with 13 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#include "sfall_lists.h" #include "sfall_lists.h"
#include "stat.h" #include "stat.h"
#include "svga.h" #include "svga.h"
#include "tile.h"
#include "worldmap.h" #include "worldmap.h"
namespace fallout { namespace fallout {
@ -421,6 +422,17 @@ static void op_atof(Program* program)
programStackPushFloat(program, static_cast<float>(atof(string))); programStackPushFloat(program, static_cast<float>(atof(string)));
} }
// tile_under_cursor
static void op_tile_under_cursor(Program* program)
{
int x;
int y;
mouseGetPosition(&x, &y);
int tile = tileFromScreenXY(x, y, gElevation);
programStackPushInteger(program, tile);
}
// strlen // strlen
static void opGetStringLength(Program* program) static void opGetStringLength(Program* program)
{ {
@ -532,6 +544,7 @@ void sfallOpcodesInit()
interpreterRegisterOpcode(0x8221, opGetScreenHeight); interpreterRegisterOpcode(0x8221, opGetScreenHeight);
interpreterRegisterOpcode(0x8237, opParseInt); interpreterRegisterOpcode(0x8237, opParseInt);
interpreterRegisterOpcode(0x8238, op_atof); interpreterRegisterOpcode(0x8238, op_atof);
interpreterRegisterOpcode(0x824B, op_tile_under_cursor);
interpreterRegisterOpcode(0x824F, opGetStringLength); interpreterRegisterOpcode(0x824F, opGetStringLength);
interpreterRegisterOpcode(0x8263, op_power); interpreterRegisterOpcode(0x8263, op_power);
interpreterRegisterOpcode(0x826B, opGetMessage); interpreterRegisterOpcode(0x826B, opGetMessage);