Add opReadByte

See #200
This commit is contained in:
Alexander Batalov 2022-11-09 13:09:56 +03:00
parent 5e9cf96106
commit fa475c754e
3 changed files with 27 additions and 0 deletions

View File

@ -6002,6 +6002,11 @@ void _combatKillCritterOutsideCombat(Object* critter_obj, char* msg)
}
}
int combatGetTargetHighlight()
{
return _combat_highlight;
}
static void criticalsInit()
{
int mode = 2;

View File

@ -58,6 +58,7 @@ int _combat_explode_scenery(Object* a1, Object* a2);
void _combat_delete_critter(Object* obj);
void _combatKillCritterOutsideCombat(Object* critter_obj, char* msg);
int combatGetTargetHighlight();
int criticalsGetValue(int killType, int hitLocation, int effect, int dataMember);
void criticalsSetValue(int killType, int hitLocation, int effect, int dataMember, int value);
void criticalsResetValue(int killType, int hitLocation, int effect, int dataMember);

View File

@ -1,6 +1,8 @@
#include "sfall_opcodes.h"
#include "art.h"
#include "combat.h"
#include "debug.h"
#include "interface.h"
#include "interpreter.h"
#include "item.h"
@ -13,6 +15,24 @@
namespace fallout {
// read_byte
static void opReadByte(Program* program)
{
int addr = programStackPopInteger(program);
int value = 0;
switch (addr) {
case 0x56D38C:
value = combatGetTargetHighlight();
break;
default:
debugPrint("%s: attempt to 'read_byte' at 0x%x", program->name, addr);
break;
}
programStackPushInteger(program, value);
}
// set_pc_extra_stat
static void opSetPcBonusStat(Program* program)
{
@ -224,6 +244,7 @@ static void opArtExists(Program* program)
void sfallOpcodesInit()
{
interpreterRegisterOpcode(0x8156, opReadByte);
interpreterRegisterOpcode(0x815B, opSetPcBonusStat);
interpreterRegisterOpcode(0x815D, opGetPcBonusStat);
interpreterRegisterOpcode(0x8193, opGetCurrentHand);