本文整理汇总了C++中CORO_BEGIN_CODE函数的典型用法代码示例。如果您正苦于以下问题:C++ CORO_BEGIN_CODE函数的具体用法?C++ CORO_BEGIN_CODE怎么用?C++ CORO_BEGIN_CODE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CORO_BEGIN_CODE函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CORO_END_CONTEXT
void RMTony::endStatic(CORO_PARAM, CharacterTalkType nTalk) {
CORO_BEGIN_CONTEXT;
int bodyEndPat;
int finalPat;
int headEndPat;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
_ctx->bodyEndPat = 0;
_ctx->finalPat = 0;
_ctx->headEndPat = 0;
endStaticCalculate(nTalk, _ctx->bodyEndPat, _ctx->finalPat, _ctx->headEndPat);
if (_ctx->headEndPat != 0) {
setPattern(_ctx->headEndPat);
CORO_INVOKE_0(waitForEndPattern);
} else {
// Play please
_body.setPattern(_ctx->bodyEndPat);
CORO_INVOKE_0(_body.waitForEndPattern);
}
setPattern(_ctx->finalPat);
_body.setPattern(0);
_bIsStaticTalk = false;
CORO_END_CODE;
}
示例2: PolygonEvent
/**
* Run the Polygon process with the given event
*/
void PolygonEvent(CORO_PARAM, HPOLYGON hPoly, TINSEL_EVENT tEvent, int actor, bool bWait,
int myEscape, bool *result) {
CORO_BEGIN_CONTEXT;
Common::PPROCESS pProc;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
PTP_INIT to;
if (result)
*result = false;
to.hPoly = -1;
to.event = tEvent;
to.pic = InitInterpretContext(GS_POLYGON,
GetPolyScript(hPoly),
tEvent,
hPoly, // Polygon
actor, // Actor
NULL, // No Object
myEscape);
if (to.pic != NULL) {
_ctx->pProc = CoroScheduler.createProcess(PID_TCODE, PolyTinselProcess, &to, sizeof(to));
AttachInterpret(to.pic, _ctx->pProc);
if (bWait)
CORO_INVOKE_2(WaitInterpret, _ctx->pProc, result);
}
CORO_END_CODE;
}
示例3: ActorEvent
/**
* Starts up process to run actor's glitter code.
*/
void ActorEvent(CORO_PARAM, int ano, TINSEL_EVENT tEvent, bool bWait, int myEscape, bool *result) {
ATP_INIT atp;
int index;
CORO_BEGIN_CONTEXT;
PPROCESS pProc;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
index = TaggedActorIndex(ano);
assert(taggedActors[index].hActorCode);
if (result) *result = false;
atp.id = 0;
atp.event = tEvent;
atp.pic = InitInterpretContext(GS_ACTOR,
taggedActors[index].hActorCode,
tEvent,
NOPOLY, // No polygon
ano, // Actor
NULL, // No object
myEscape);
if (atp.pic != NULL) {
_ctx->pProc = g_scheduler->createProcess(PID_TCODE, ActorTinselProcess, &atp, sizeof(atp));
AttachInterpret(atp.pic, _ctx->pProc);
if (bWait)
CORO_INVOKE_2(WaitInterpret,_ctx->pProc, result);
}
CORO_END_CODE;
}
示例4: T1MoverProcess
/**
* Moving actor process - 1 per moving actor in current scene.
*/
void T1MoverProcess(CORO_PARAM, const void *param) {
// COROUTINE
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
const PMOVER pActor = *(const PMOVER *)param;
CORO_BEGIN_CODE(_ctx);
while (1) {
if (pActor->bSpecReel) {
if (!pActor->bHidden)
#ifdef DEBUG
assert(StepAnimScript(&pActor->actorAnim) != ScriptFinished); // Actor reel has finished!
#else
StepAnimScript(&pActor->actorAnim);
#endif
} else
DoMoveActor(pActor);
CORO_SLEEP(1); // allow rescheduling
}
CORO_END_CODE;
}
示例5: CORO_END_CONTEXT
void TonyEngine::doNextMusic(CORO_PARAM, const void *param) {
CORO_BEGIN_CONTEXT;
Common::String fn;
CORO_END_CONTEXT(_ctx);
FPStream **streams = g_vm->_stream;
CORO_BEGIN_CODE(_ctx);
if (!g_vm->getIsDemo()) {
if (!streams[GLOBALS._nextChannel]->loadFile(GLOBALS._nextMusic, GLOBALS._nextSync))
error("failed to open next music file '%s'", GLOBALS._nextMusic.c_str());
} else {
streams[GLOBALS._nextChannel]->loadFile(GLOBALS._nextMusic, GLOBALS._nextSync);
}
streams[GLOBALS._nextChannel]->setLoop(GLOBALS._nextLoop);
//streams[GLOBALS._nextChannel]->prefetch();
streams[GLOBALS._curChannel]->waitForSync(streams[GLOBALS._nextChannel]);
streams[GLOBALS._curChannel]->unloadFile();
GLOBALS._flipflop = 1 - GLOBALS._flipflop;
CORO_END_CODE;
}
示例6: CORO_END_CONTEXT
void RMDialogChoice::prepare(CORO_PARAM) {
CORO_BEGIN_CONTEXT;
int i;
RMPoint ptPos;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
addPrim(new RMGfxPrimitive(&_dlgText, RMPoint(0, 0)));
addPrim(new RMGfxPrimitive(&_dlgTextLine, RMPoint(0, 155)));
addPrim(new RMGfxPrimitive(&_dlgTextLine, RMPoint(0, 155 + 83)));
addPrim(new RMGfxPrimitive(&_dlgTextLine, RMPoint(0, 155 + 83 + 83)));
addPrim(new RMGfxPrimitive(&_dlgTextLine, RMPoint(0, 155 + 83 + 83 + 83)));
_ctx->ptPos.set(20, 90);
for (_ctx->i = 0; _ctx->i < _numChoices; _ctx->i++) {
addPrim(new RMGfxPrimitive(&_drawedStrings[_ctx->i], _ctx->ptPos));
_ptDrawStrings[_ctx->i] = _ctx->ptPos;
_ctx->ptPos.offset(0, _drawedStrings[_ctx->i].getDimy() + 15);
}
CORO_INVOKE_0(drawOT);
clearOT();
_ptDrawPos.set(0, 480 - _ctx->ptPos._y);
CORO_END_CODE;
}
示例7: ActorRestoredProcess
static void ActorRestoredProcess(CORO_PARAM, const void *param) {
// COROUTINE
CORO_BEGIN_CONTEXT;
INT_CONTEXT *pic;
CORO_END_CONTEXT(_ctx);
// get the stuff copied to process when it was created
const RATP_INIT *r = (const RATP_INIT *)param;
bool isSavegame = r->pic->resumeState == RES_SAVEGAME;
CORO_BEGIN_CODE(_ctx);
_ctx->pic = RestoreInterpretContext(r->pic);
// The newly added check here specially sets the process to RES_NOT when loading a savegame.
// This is needed particularly for the Psychiatrist scene in Discworld 1 - otherwise Rincewind
// can't go upstairs without leaving the building and returning. If this patch causes problems
// in other scenes, an added check for the hCode == 1174490602 could be added.
if (isSavegame && TinselV1)
_ctx->pic->resumeState = RES_NOT;
CORO_INVOKE_1(Interpret, _ctx->pic);
// If it gets here, actor's code has run to completion
actorInfo[r->id - 1].completed = true;
CORO_END_CODE;
}
示例8: HideActor
/**
* Set actor hidden status to true.
* For a moving actor, actually hide it.
* @param ano Actor Id
*/
void HideActor(CORO_PARAM, int ano) {
PMOVER pMover;
assert((ano > 0 && ano <= NumActors) || ano == LEAD_ACTOR); // illegal actor
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
if (TinselV2) {
actorInfo[ano - 1].bHidden = true;
// Send event to tagged actors
// (this is duplicated in HideMover())
if (IsTaggedActor(ano)) {
CORO_INVOKE_ARGS(ActorEvent, (CORO_SUBCTX, ano, HIDEEVENT, true, 0));
// It may be pointed to
SetActorPointedTo(ano, false);
SetActorTagWanted(ano, false, false, 0);
}
}
// Get moving actor involved
pMover = GetMover(ano);
if (pMover)
HideMover(pMover, 0);
else if (!TinselV2)
actorInfo[ano - 1].bHidden = true;
CORO_END_CODE;
}
示例9: MasterScriptProcess
/**
* Run the master script.
* Continues between scenes, or until Interpret() returns.
*/
static void MasterScriptProcess(CORO_PARAM, const void *) {
// COROUTINE
CORO_BEGIN_CONTEXT;
INT_CONTEXT *pic;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
_ctx->pic = InitInterpretContext(GS_MASTER, 0, NOEVENT, NOPOLY, 0, NULL);
CORO_INVOKE_1(Interpret, _ctx->pic);
CORO_END_CODE;
}
示例10: ActorTinselProcess
/**
* Runs actor's glitter code.
*/
static void ActorTinselProcess(CORO_PARAM, const void *param) {
// COROUTINE
CORO_BEGIN_CONTEXT;
INT_CONTEXT *pic;
bool bTookControl;
CORO_END_CONTEXT(_ctx);
// get the stuff copied to process when it was created
const ATP_INIT *atp = (const ATP_INIT *)param;
CORO_BEGIN_CODE(_ctx);
if (TinselV2) {
// Take control for CONVERSE events
if (atp->event == CONVERSE) {
_ctx->bTookControl = GetControl();
HideConversation(true);
} else
_ctx->bTookControl = false;
// Run the Glitter code
CORO_INVOKE_1(Interpret, atp->pic);
// Restore conv window if applicable
if (atp->event == CONVERSE) {
// Free control if we took it
if (_ctx->bTookControl)
ControlOn();
HideConversation(false);
}
} else {
CORO_INVOKE_1(AllowDclick, atp->bev); // May kill us if single click
// Run the Glitter code
assert(actorInfo[atp->id - 1].actorCode); // no code to run
_ctx->pic = InitInterpretContext(GS_ACTOR, actorInfo[atp->id - 1].actorCode,
atp->event, NOPOLY, atp->id, NULL);
CORO_INVOKE_1(Interpret, _ctx->pic);
// If it gets here, actor's code has run to completion
actorInfo[atp->id - 1].completed = true;
}
CORO_END_CODE;
}