Documentation ¶
Index ¶
Constants ¶
View Source
const ( OpLoadVarInt = Op(0x00) OpLoadVarFloat = Op(0x01) OpLoadVarPtr = Op(0x02) OpLoadVarString = Op(0x03) OpPushInt = Op(0x04) OpPushFloat = Op(0x05) OpPushString = Op(0x06) OpIntAdd = Op(0x07) OpFloatAdd = Op(0x08) OpIntSub = Op(0x09) OpFloatSub = Op(0x0A) OpIntMul = Op(0x0B) OpFloatMul = Op(0x0C) OpIntDiv = Op(0x0D) OpFloatDiv = Op(0x0E) OpIntMod = Op(0x0F) OpIntAnd = Op(0x10) OpIntOr = Op(0x11) OpIntXOr = Op(0x12) OpJump = Op(0x13) OpJumpIf = Op(0x14) OpJumpIfNot = Op(0x15) OpStoreInt = Op(0x16) OpStoreFloat = Op(0x17) OpStoreString = Op(0x18) OpStoreIntMul = Op(0x19) OpStoreFloatMul = Op(0x1A) OpStoreIntDiv = Op(0x1B) OpStoreFloatDiv = Op(0x1C) OpStoreIntAdd = Op(0x1D) OpStoreFloatAdd = Op(0x1E) OpStoreStringAdd = Op(0x1F) OpStoreIntSub = Op(0x20) OpStoreFloatSub = Op(0x21) OpStoreIntMod = Op(0x22) OpIntEq = Op(0x23) OpFloatEq = Op(0x24) OpStringEq = Op(0x25) OpIntLSh = Op(0x26) OpIntRSh = Op(0x27) OpIntLt = Op(0x28) OpFloatLt = Op(0x29) OpStringLt = Op(0x2A) OpIntGt = Op(0x2B) OpFloatGt = Op(0x2C) OpStringGt = Op(0x2D) OpIntLte = Op(0x2E) OpFloatLte = Op(0x2F) OpStringLte = Op(0x30) OpIntGte = Op(0x31) OpFloatGte = Op(0x32) OpStringGte = Op(0x33) OpIntNeq = Op(0x34) OpFloatNeq = Op(0x35) OpStringNeq = Op(0x36) OpBoolAnd = Op(0x37) OpBoolOr = Op(0x38) OpStoreIntLSh = Op(0x39) OpStoreIntRSh = Op(0x3A) OpStoreIntAnd = Op(0x3B) OpStoreIntOr = Op(0x3C) OpStoreIntXOr = Op(0x3D) OpBoolNot = Op(0x3E) OpIntNot = Op(0x3F) OpIntNeg = Op(0x40) OpFloatNeg = Op(0x41) OpIndexInt = Op(0x42) OpIndexFloat = Op(0x43) OpIndexPtr = Op(0x44) OpCallBuiltin = Op(0x45) OpCallScript = Op(0x46) OpReturn0 = Op(0x47) OpReturn = Op(0x48) OpStringAdd = Op(0x49) )
View Source
const ( BuiltinWall = Builtin(0) BuiltinWallOpen = Builtin(1) BuiltinWallGroupOpen = Builtin(2) BuiltinWallClose = Builtin(3) BuiltinWallGroupClose = Builtin(4) BuiltinWallToggle = Builtin(5) BuiltinWallGroupToggle = Builtin(6) BuiltinWallBreak = Builtin(7) BuiltinWallGroupBreak = Builtin(8) BuiltinSecondTimer = Builtin(9) BuiltinFrameTimer = Builtin(10) BuiltinMove = Builtin(11) BuiltinGroupMove = Builtin(12) BuiltinLookAtDirection = Builtin(13) BuiltinGroupLookAtDirection = Builtin(14) BuiltinObjectOn = Builtin(15) BuiltinObjectGroupOn = Builtin(16) BuiltinWaypointOn = Builtin(17) BuiltinWaypointGroupOn = Builtin(18) BuiltinObjectOff = Builtin(19) BuiltinObjectGroupOff = Builtin(20) BuiltinWaypointOff = Builtin(21) BuiltinWaypointGroupOff = Builtin(22) BuiltinObjectToggle = Builtin(23) BuiltinObjectGroupToggle = Builtin(24) BuiltinWaypointToggle = Builtin(25) BuiltinWaypointGroupToggle = Builtin(26) BuiltinDelete = Builtin(27) BuiltinGroupDelete = Builtin(28) BuiltinWander = Builtin(29) BuiltinGroupWander = Builtin(30) BuiltinUnused1f = Builtin(31) BuiltinUnused20 = Builtin(32) BuiltinGoBackHome = Builtin(33) BuiltinAudioEvent = Builtin(34) BuiltinPrint = Builtin(35) BuiltinPrintToAll = Builtin(36) BuiltinChat = Builtin(37) BuiltinStopScript = Builtin(38) BuiltinUnlockDoor = Builtin(39) BuiltinLockDoor = Builtin(40) BuiltinIsObjectOn = Builtin(41) BuiltinIsWaypointOn = Builtin(42) BuiltinIsLocked = Builtin(43) BuiltinRandomFloat = Builtin(44) BuiltinRandom = Builtin(45) BuiltinSecondTimerWithArg = Builtin(46) BuiltinFrameTimerWithArg = Builtin(47) BuiltinIntToString = Builtin(48) BuiltinFloatToString = Builtin(49) BuiltinCreateObject = Builtin(50) BuiltinDamage = Builtin(51) BuiltinGroupDamage = Builtin(52) BuiltinCreateMover = Builtin(53) BuiltinGroupCreateMover = Builtin(54) BuiltinAwardSpell = Builtin(55) BuiltinGroupAwardSpell = Builtin(56) BuiltinEnchant = Builtin(57) BuiltinGroupEnchant = Builtin(58) BuiltinGetHost = Builtin(59) BuiltinObject = Builtin(60) BuiltinGetObjectX = Builtin(61) BuiltinGetWaypointX = Builtin(62) BuiltinGetObjectY = Builtin(63) BuiltinGetWaypointY = Builtin(64) BuiltinGetObjectZ = Builtin(65) BuiltinGetDirection = Builtin(66) BuiltinMoveObject = Builtin(67) BuiltinMoveWaypoint = Builtin(68) BuiltinRaise = Builtin(69) BuiltinLookWithAngle = Builtin(70) BuiltinPushObjectTo = Builtin(71) BuiltinPushObject = Builtin(72) BuiltinGetLastItem = Builtin(73) BuiltinGetPreviousItem = Builtin(74) BuiltinHasItem = Builtin(75) BuiltinGetHolder = Builtin(76) BuiltinPickup = Builtin(77) BuiltinDrop = Builtin(78) BuiltinHasClass = Builtin(79) BuiltinUnused50 = Builtin(80) BuiltinHasEnchant = Builtin(81) BuiltinEnchantOff = Builtin(82) BuiltinCurrentHealth = Builtin(83) BuiltinMaxHealth = Builtin(84) BuiltinRestoreHealth = Builtin(85) BuiltinDistance = Builtin(86) BuiltinIsVisibleTo = Builtin(87) BuiltinUnused58 = Builtin(88) BuiltinUnused59 = Builtin(89) BuiltinUnused5a = Builtin(90) BuiltinUnused5b = Builtin(91) BuiltinUnused5c = Builtin(92) BuiltinUnused5d = Builtin(93) BuiltinUnused5e = Builtin(94) BuiltinGetCharacterData = Builtin(95) BuiltinLookAtObject = Builtin(96) BuiltinWalk = Builtin(97) BuiltinGroupWalk = Builtin(98) BuiltinCancelTimer = Builtin(99) BuiltinEffect = Builtin(100) BuiltinSetOwner = Builtin(101) BuiltinGroupSetOwner = Builtin(102) BuiltinSetOwners = Builtin(103) BuiltinGroupSetOwners = Builtin(104) BuiltinIsOwnedBy = Builtin(105) BuiltinGroupIsOwnedBy = Builtin(106) BuiltinIsOwnedByAny = Builtin(107) BuiltinGroupIsOwnedByAny = Builtin(108) BuiltinClearOwner = Builtin(109) BuiltinWaypoint = Builtin(110) BuiltinWaypointGroup = Builtin(111) BuiltinObjectGroup = Builtin(112) BuiltinWallGroup = Builtin(113) BuiltinChatTimerSeconds = Builtin(114) BuiltinChatTimer = Builtin(115) BuiltinUnused74 = Builtin(116) BuiltinDestroyChat = Builtin(117) BuiltinDestroyEveryChat = Builtin(118) BuiltinSetQuestStatus = Builtin(119) BuiltinSetQuestStatusFloat = Builtin(120) BuiltinGetQuestStatus = Builtin(121) BuiltinGetQuestStatusFloat = Builtin(122) BuiltinResetQuestStatus = Builtin(123) BuiltinIsTrigger = Builtin(124) BuiltinIsCaller = Builtin(125) BuiltinSetDialog = Builtin(126) BuiltinCancelDialog = Builtin(127) BuiltinStoryPic = Builtin(128) BuiltinTellStory = Builtin(129) BuiltinStartDialog = Builtin(130) BuiltinCastSpellObjectObject = Builtin(131) BuiltinCastSpellObjectLocation = Builtin(132) BuiltinCastSpellLocationObject = Builtin(133) BuiltinCastSpellLocationLocation = Builtin(134) BuiltinUnBlind = Builtin(135) BuiltinBlind = Builtin(136) BuiltinWideScreen = Builtin(137) BuiltinGetElevatorStatus = Builtin(138) BuiltinCreatureGuard = Builtin(139) BuiltinCreatureGroupGuard = Builtin(140) BuiltinCreatureHunt = Builtin(141) BuiltinCreatureGroupHunt = Builtin(142) BuiltinCreatureIdle = Builtin(143) BuiltinCreatureGroupIdle = Builtin(144) BuiltinCreatureFollow = Builtin(145) BuiltinCreatureGroupFollow = Builtin(146) BuiltinAggressionLevel = Builtin(147) BuiltinGroupAggressionLevel = Builtin(148) BuiltinHitLocation = Builtin(149) BuiltinGroupHitLocation = Builtin(150) BuiltinHitFarLocation = Builtin(151) BuiltinGroupHitFarLocation = Builtin(152) BuiltinSetRoamFlag = Builtin(153) BuiltinGroupSetRoamFlag = Builtin(154) BuiltinAttack = Builtin(155) BuiltinGroupAttack = Builtin(156) BuiltinJournalEntry = Builtin(157) BuiltinJournalDelete = Builtin(158) BuiltinJournalEdit = Builtin(159) BuiltinRetreatLevel = Builtin(160) BuiltinGroupRetreatLevel = Builtin(161) BuiltinResumeLevel = Builtin(162) BuiltinGroupResumeLevel = Builtin(163) BuiltinRunAway = Builtin(164) BuiltinGroupRunAway = Builtin(165) BuiltinPauseObject = Builtin(166) BuiltinGroupPauseObject = Builtin(167) BuiltinIsAttackedBy = Builtin(168) BuiltinGetGold = Builtin(169) BuiltinChangeGold = Builtin(170) BuiltinGetAnswer = Builtin(171) BuiltinGiveXp = Builtin(172) BuiltinHasSubclass = Builtin(173) BuiltinAutoSave = Builtin(174) BuiltinMusic = Builtin(175) BuiltinStartupScreen = Builtin(176) BuiltinIsTalking = Builtin(177) BuiltinGetTrigger = Builtin(178) BuiltinGetCaller = Builtin(179) BuiltinMakeFriendly = Builtin(180) BuiltinMakeEnemy = Builtin(181) BuiltinBecomePet = Builtin(182) BuiltinBecomeEnemy = Builtin(183) BuiltinUnknownb8 = Builtin(184) BuiltinUnknownb9 = Builtin(185) BuiltinSetHalberd = Builtin(186) BuiltinDeathScreen = Builtin(187) BuiltinFrozen = Builtin(188) BuiltinNoWallSound = Builtin(189) BuiltinSetCallback = Builtin(190) BuiltinDeleteObjectTimer = Builtin(191) BuiltinTrapSpells = Builtin(192) BuiltinIsTrading = Builtin(193) BuiltinClearMessages = Builtin(194) BuiltinSetShopkeeperText = Builtin(195) BuiltinUnknownc4 = Builtin(196) BuiltinIsSummoned = Builtin(197) BuiltinZombieStayDown = Builtin(198) BuiltinZombieGroupStayDown = Builtin(199) BuiltinRaiseZombie = Builtin(200) BuiltinRaiseZombieGroup = Builtin(201) BuiltinMusicPushEvent = Builtin(202) BuiltinMusicPopEvent = Builtin(203) BuiltinMusicEvent = Builtin(204) BuiltinIsGameBall = Builtin(205) BuiltinIsCrown = Builtin(206) BuiltinEndGame = Builtin(207) BuiltinImmediateBlind = Builtin(208) BuiltinChangeScore = Builtin(209) BuiltinGetScore = Builtin(210) )
View Source
const NCobjName = "nc.obj"
NCobjName is a name of a temporary file with script section, created by Nox when decoding the map.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CallBuiltin ¶
type CallBuiltin struct {
Index Builtin
}
func (CallBuiltin) EncodeTo ¶
func (v CallBuiltin) EncodeTo(out []uint32) []uint32
func (CallBuiltin) Len ¶
func (v CallBuiltin) Len() int
func (CallBuiltin) OpCode ¶
func (v CallBuiltin) OpCode() Op
func (CallBuiltin) String ¶
func (v CallBuiltin) String() string
type CallScript ¶
type CallScript struct {
Index int32
}
func (CallScript) EncodeTo ¶
func (v CallScript) EncodeTo(out []uint32) []uint32
func (CallScript) Len ¶
func (v CallScript) Len() int
func (CallScript) OpCode ¶
func (v CallScript) OpCode() Op
func (CallScript) String ¶
func (v CallScript) String() string
type FuncDef ¶
type FuncDef struct { // Name of the function. Name string // Args is the number of arguments. Args int // Return is the number of returns. Only 1 return max is supported. Return int // Unused stores some unused values in script encoding. // It will be written back during encoding. Unused int // Vars is a list of variable definitions. Vars []VarDef // VarsSz is a total size of memory required for all variables. VarsSz int // Code of the function. See Disasm. Code []uint32 // Rest is a trailing bytes after a Code section. // It will be written back during encoding. Rest []byte // NamePref is prepended to all object name lookups during script runtime. NamePref string // PosOff is added to all position-related operations during script runtime. PosOff image.Point }
FuncDef is a NoxScript function definition.
type Instr ¶
Instr is an instruction for NoxScript assembly.
func DecodeNext ¶
DecodeNext decodes one instruction from a binary form and returns it's length. It returns nil, 1 if instruction was not recognized.
type Script ¶
type Script struct { // Strings table. Used by all string-related instructions. Strings []string // Funcs is a list of function definitions. // // First two functions are usually called GLOBAL and only define and initialize global variables. Funcs []FuncDef }
Script is a decoded NoxScript.
Click to show internal directories.
Click to hide internal directories.