Skip to content

Commit

Permalink
fix(zscript): various symbols with broken compiler output
Browse files Browse the repository at this point in the history
* npc->Attack()
* npc->CanSlide()
* npc->ConstantWalk(int[])
* npc->ConstantWalk8(int[])
* npc->FloatingWalk(int[])
* npc->HaltingWalk(int[])
* npc->HaltingWalk8(int[])
* npc->isDead()
* npc->NewDir8(int[])
* npc->Remove()
* npc->Slide()
* npc->StopBGSFX()
* npc->VariableWalk(int[])
* npc->VariableWalk8(int[])
* Trace(char32[])
  • Loading branch information
connorjclark committed Apr 17, 2024
1 parent 0483daf commit 982ec4d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/parser/ByteCode.cpp
Expand Up @@ -6073,7 +6073,7 @@ string ONPCNewDir8::toString() const
}
string ONPCRemove::toString() const
{
return "NPCKICKBUCKET " + getArgument()->toString();
return "NPCKICKBUCKET";
}
string OLWpnRemove::toString() const
{
Expand All @@ -6089,11 +6089,11 @@ string OItemRemove::toString() const
}
string ONPCStopSFX::toString() const
{
return "NPCSTOPBGSFX " + getArgument()->toString();
return "NPCSTOPBGSFX";
}
string ONPCAttack::toString() const
{
return "NPCATTACK " + getArgument()->toString();
return "NPCATTACK";
}
string ONPCNewDir::toString() const
{
Expand Down
18 changes: 9 additions & 9 deletions src/parser/ByteCode.h
Expand Up @@ -10124,14 +10124,14 @@ namespace ZScript
return new ONPCSlide(a->clone());
}
};
class ONPCRemove : public UnaryOpcode
class ONPCRemove : public Opcode
{
public:
ONPCRemove(Argument *A) : UnaryOpcode(A) {}
ONPCRemove() : Opcode() {}
std::string toString() const;
Opcode* clone() const
{
return new ONPCRemove(a->clone());
return new ONPCRemove();
}
};

Expand Down Expand Up @@ -10165,24 +10165,24 @@ namespace ZScript
return new OItemRemove();
}
};
class ONPCStopSFX : public UnaryOpcode
class ONPCStopSFX : public Opcode
{
public:
ONPCStopSFX(Argument *A) : UnaryOpcode(A) {}
ONPCStopSFX() : Opcode() {}
std::string toString() const;
Opcode* clone() const
{
return new ONPCStopSFX(a->clone());
return new ONPCStopSFX();
}
};
class ONPCAttack : public UnaryOpcode
class ONPCAttack : public Opcode
{
public:
ONPCAttack(Argument *A) : UnaryOpcode(A) {}
ONPCAttack() : Opcode() {}
std::string toString() const;
Opcode* clone() const
{
return new ONPCAttack(a->clone());
return new ONPCAttack();
}
};
class ONPCNewDir : public UnaryOpcode
Expand Down
16 changes: 8 additions & 8 deletions src/parser/symbols/NPCSymbols.cpp
Expand Up @@ -330,7 +330,7 @@ void NPCSymbols::generateCode()
int32_t label = function->getLabel();
vector<shared_ptr<Opcode>> code;
//pop off the pointer
addOpcode2 (code, new OPopRegister(new VarArgument(EXP1)));
POPREF();
LABELBACK(label);
//Check validity
addOpcode2 (code, new ONPCDead(new VarArgument(EXP1)));
Expand All @@ -343,7 +343,7 @@ void NPCSymbols::generateCode()
int32_t label = function->getLabel();
vector<shared_ptr<Opcode>> code;
//pop off the pointer
addOpcode2 (code, new OPopRegister(new VarArgument(EXP1)));
POPREF();
LABELBACK(label);
//Check validity
addOpcode2 (code, new ONPCCanSlide(new VarArgument(EXP1)));
Expand All @@ -356,7 +356,7 @@ void NPCSymbols::generateCode()
int32_t label = function->getLabel();
vector<shared_ptr<Opcode>> code;
//pop off the pointer
addOpcode2 (code, new OPopRegister(new VarArgument(EXP1)));
POPREF();
LABELBACK(label);
//Check validity
addOpcode2 (code, new ONPCSlide(new VarArgument(EXP1)));
Expand All @@ -372,7 +372,7 @@ void NPCSymbols::generateCode()
POPREF();
LABELBACK(label);
//Break shield
addOpcode2 (code, new ONPCRemove(new VarArgument(EXP1)));
addOpcode2 (code, new ONPCRemove());
RETURN();
function->giveCode(code);
}
Expand All @@ -382,10 +382,10 @@ void NPCSymbols::generateCode()
int32_t label = function->getLabel();
vector<shared_ptr<Opcode>> code;
//pop off the pointer
addOpcode2 (code, new OPopRegister(new VarArgument(EXP1)));
POPREF();
LABELBACK(label);
//Break shield
addOpcode2 (code, new ONPCStopSFX(new VarArgument(EXP1)));
addOpcode2 (code, new ONPCStopSFX());
RETURN();
function->giveCode(code);
}
Expand All @@ -395,10 +395,10 @@ void NPCSymbols::generateCode()
int32_t label = function->getLabel();
vector<shared_ptr<Opcode>> code;
//pop off the pointer
addOpcode2 (code, new OPopRegister(new VarArgument(EXP1)));
POPREF();
LABELBACK(label);
//Break shield
addOpcode2 (code, new ONPCAttack(new VarArgument(EXP1)));
addOpcode2 (code, new ONPCAttack());
RETURN();
function->giveCode(code);
}
Expand Down

0 comments on commit 982ec4d

Please sign in to comment.