Files
Webcam/include/engine/core/ace_unit.cpp

64 lines
1.4 KiB
C++

/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#include "core/ace.h"
#include "log/log.h"
using namespace GS::ACE;
//------------------------------------------------------------------------------
void Unit::ResetCommandList()
{
list.Clear();
loop_pc = NULL;
pc = NULL;
is_done = true;
}
void Unit::DumpCommandList()
{
for (uint n = 0; n < list.GetCount(); ++n)
{
Command &cmd = list.ObjectAt(n);
__LOG__ << "Command [" << cmd.code << "] : " << cmd.duration << "s, parm = {" << cmd.parm[0] << ", " << cmd.parm[1] << ", " << cmd.parm[2] << "}.\n";
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool Unit::ExecCommand(Command *cmd, float dt)
{
if (!cmd || !dt)
return false;
switch (cmd->code)
{
case AceCommandNop:
break;
case AceCommandExec:
__LOG_W__ << "ACE unit is executing exec opcode (?!).\n";
break;
case AceCommandLoop:
cmd->SetDone();
loop_pc = pc;
break;
case AceCommandNext:
cmd->SetDone();
pc = loop_pc;
break;
}
return true;
}
//------------------------------------------------------------------------------
Unit::Unit()
{
ResetCommandList();
}