use num_derive::FromPrimitive;

#[derive(FromPrimitive, Clone, Copy)]
enum Opcode {
  Nop = 0,
  
  // control flow
  Delete = 1,
  Ret = 10,
  Call = 11,
  Jump = 12,
  JumpEq = 13,
  JumpNeq = 14,
  CallAsync = 15,
  CallAsyncById = 16,
  KillAsync = 17,
  KillAllAsync = 21,

  // stack math
  StackAlloc = 40,
  PushInt = 42,
  SetInt = 43,
  PushFloat = 44,
  SetFloat = 45,
  AddInt = 50,
  AddFloat = 51,
  SubInt = 52,
  SubFloat = 53,
  MulInt = 54,
  MulFloat = 55,
  DivInt = 56,
  DivFloat = 57,
  ModInt = 58,
  EqualInt = 59,
  EqualFloat = 60,
  NotEqualInt = 61,
  NotEqualFloat = 62,
  LessInt = 63,
  LessFloat = 64,
  LessEqualInt = 65,
  LessEqualFloat = 66,
  GreaterInt = 67,
  GreaterFloat = 68,
  GreaterEqualInt = 69,
  GreaterEqualFloat = 70,
  NotInt = 71,
  NotFloat = 72,
  LogicalOr = 73,
  LogicalAnd = 74,
  BitwiseXor = 75,
  BitwiseOr = 76,
  BitwiseAnd = 77,
  DecrementInt = 78,
  Sin = 79,
  Cos = 80,
  CirclePos = 81,
  ValidRad = 82,
  Wait = 83,
  NegateInt = 84,
  NegateFloat = 85 ,
  SquareSum = 86,
  GetAngle = 87,
  SquareRoot = 88,
  Linear = 89,
  PointRotate = 90,
  FloatTime = 91,
  Math92 = 92,
  Math93 = 93,

  EnemyCreate = 256,
  EnemyCreateAbsolute = 257,
  EnemySelectAnm = 258,
  EnemySetAnmSprite = 259,
  EnemyCreateMirrored = 260,
  EnemyCreateMirroredAbsolute = 261,
  EnemySetMainAnm = 262,
  EnemyPlayAnm = 263,
  EnemyPlayAnmAbsolute = 264,
  EnemyCreateFiller = 265,
  EnemyCreateFillerAbsolute = 266,
  EnemyCreateFillerMirrored = 267,
  EnemyCreateFillerMirroredAbsolute = 268,
  EnemyPlaySelected = 269,
  EnemySwitchAnm = 275,
  EnemyResetAnm = 276,
  EnemyInst277 = 277,
  EnemyInst278 = 278,

  MovePos = 280,
  MovePosTime = 281,
  MovePosRel = 282,
  MovePosRelTime = 283,
  MoveVel = 284,
  MoveVelTime = 285,
  MoveVelRel = 286,
  MoveVelRelTime = 287,
  MoveCircle = 288,
  MoveCircleTime = 289,
  MoveCircleRel = 290,
  MoveCircleRelTime = 291,
  MoveRand = 292,
  MoveRandRel = 293,
  MoveAdd = 294,
  MoveAddRel = 295,
  MoveEllipse = 300,
  MoveEllipseRel = 301,
  MoveBezier = 305,
  MoveReset = 307,
  
  SetHurtbox = 320,
  SetHitbox = 321,
  FlagSet = 322,
  FlagClear = 323,
  Movelimit = 324,
  MoveLimitReset = 325,
  ClearExtraDrops = 326,
  AddExtraDrops = 327,
  SetDropArea = 328,
  DropItems = 329,
  SetMainDrop = 330,
  SetHealth = 331,
  SetBoss = 332,
  TimerReset = 333,
  SetInterrupt = 334,
  SetInvulnerable = 335,
  PlaySound = 336,
  ShakeScreen = 337,
  StartDialogue = 338,
  WaitForDialogue = 339,
  WaitForDeath = 340,
  SetTimeout = 341,
  SpellById,
  EndSpell,
  SetChapter,
  KillAllEnemies,
  ProtectPlayer,
  LifeMarker,
  SetByDifficultyInt,
  SetByDifficultyFloat,
  SpellDifficulty,
  SpellDifficultyM1,
  
}
