void plNetLinkingMgr::LeaveAge (bool quitting) { // Queue leave op NlmLeaveAgeOp * leaveAgeOp = new NlmLeaveAgeOp; leaveAgeOp->quitting = quitting; QueueOp(leaveAgeOp); }
uint32_t Surface::AddDrawingOp(gds_DrawingOp op){ Select(); if(queued){ QueueOp(op); return 0; } else return GDS_AddDrawingOp(op); }
uint32_t Surface::Text(const Point &p, const std::string &text, const Font &font, uint32_t size, const Colour &c, uint8_t style){ Select(); if(queued){ auto op = GDS_Text_Op(p.x, p.y, font.id, size, c.id, style); auto params = GDS_Text_Params(0, text.c_str()); QueueOp(op, params); }else return GDS_Text(p.x, p.y, text.c_str(), font.id, size, c.id, style); return 0; }
uint32_t Surface::Polygon(const std::vector<Point> &points, bool closed, const Colour &lineColour, const Colour &fillColour, uint8_t lineWidth, uint32_t lineStyle, uint32_t fillStyle){ Select(); if(queued){ auto op = GDS_Polygon_Op(closed, lineColour.id, fillColour.id, lineWidth, lineStyle, fillStyle); auto params = GDS_Polygon_Params(0, points.size(), const_cast<Point*>(points.data())); QueueOp(op, params); }else return GDS_Polygon(points.size(), const_cast<Point*>(points.data()), closed, lineColour.id, fillColour.id, lineWidth, lineStyle, fillStyle); return 0; }
vector<uint32_t> Surface::AddDrawingOps(const vector<gds_DrawingOp> &ops){ Select(); if(queued){ for(auto &o : ops){ QueueOp(o); } return {}; }else{ vector<uint32_t> ret(ops.size()); GDS_MultiDrawingOps(ops.size(), const_cast<gds_DrawingOp*>(ops.data()), ret.data()); return ret; } }
void plNetLinkingMgr::IDoLink(plLinkToAgeMsg* msg) { plNetClientMgr* nc = plNetClientMgr::GetInstance(); GetAgeLink()->SetSpawnPoint(msg->GetAgeLink()->SpawnPoint()); if (fLinkedIn) { // Set the link out animation we should use if (plSceneObject *localSO = plSceneObject::ConvertNoRef(nc->GetLocalPlayer())) { plArmatureMod *avMod = const_cast<plArmatureMod*>(plArmatureMod::ConvertNoRef(localSO->GetModifierByType(plArmatureMod::Index()))); avMod->SetLinkInAnim(msg->GetLinkInAnimName()); } // Queue leave op NlmLeaveAgeOp * leaveAgeOp = new NlmLeaveAgeOp; leaveAgeOp->muteSfx = !msg->PlayLinkOutSfx(); QueueOp(leaveAgeOp); } // Queue join op NlmJoinAgeOp * joinAgeOp = new NlmJoinAgeOp; joinAgeOp->age.ageInstId = *GetAgeLink()->GetAgeInfo()->GetAgeInstanceGuid(); joinAgeOp->muteSfx = !msg->PlayLinkInSfx(); StrCopy( joinAgeOp->age.ageDatasetName, GetAgeLink()->GetAgeInfo()->GetAgeFilename().c_str(), arrsize(joinAgeOp->age.ageDatasetName) ); StrCopy( joinAgeOp->age.spawnPtName, GetAgeLink()->SpawnPoint().GetName().c_str(), arrsize(joinAgeOp->age.spawnPtName) ); QueueOp(joinAgeOp); // UnRef msg->UnRef(); }
//============================================================================ void plNetLinkingMgr::ExecNextOp () { plNetLinkingMgr * lm = plNetLinkingMgr::GetInstance(); if (!s_opqueue.size()) return; NlmOp* op = s_opqueue.front(); switch (op->opcode) { case kNlmOpNoOp: break; case kNlmOpWaitOp: return; // don't allow wait op to be unlinked/deleted from list case kNlmOpJoinAgeOp: { ASSERT(!s_ageJoiner); ASSERT(!s_ageLeaver); // Insert a wait operation into the exec queue NlmOpWaitOp * waitOp = new NlmOpWaitOp; QueueOp(waitOp, true); NlmJoinAgeOp * joinAgeOp = (NlmJoinAgeOp *)op; NCAgeJoinerCreate( &s_ageJoiner, joinAgeOp->age, joinAgeOp->muteSfx, NCAgeJoinerCallback, waitOp ); } break; case kNlmOpLeaveAgeOp: { ASSERT(!s_ageJoiner); ASSERT(!s_ageLeaver); // Insert a wait operation into the exec queue NlmOpWaitOp * waitOp = new NlmOpWaitOp; QueueOp(waitOp, true); lm->SetEnabled(false); lm->fLinkedIn = false; NlmLeaveAgeOp * leaveAgeOp = (NlmLeaveAgeOp *)op; NCAgeLeaverCreate( &s_ageLeaver, leaveAgeOp->quitting, leaveAgeOp->muteSfx, NCAgeLeaverCallback, waitOp ); } break; default: break; } s_opqueue.remove(op); delete op; }
uint32_t Surface::Blit(const Surface &src, const Rect &srcRect, const Rect &dstRect, uint32_t scale, uint32_t flags){ Select(); if(queued) QueueOp(GDS_Blit_Op(src.gds_id, srcRect.x, srcRect.y, srcRect.w, srcRect.h, dstRect.x, dstRect.y, dstRect.w, dstRect.h, scale, flags)); else return GDS_Blit(src.gds_id, srcRect.x, srcRect.y, srcRect.w, srcRect.h, dstRect.x, dstRect.y, dstRect.w, dstRect.h, scale, flags); return 0; }
uint32_t Surface::TextChar(const Point &p, char c, const Font &font, uint32_t size, const Colour &col, uint8_t style){ Select(); if(queued) QueueOp(GDS_TextChar_Op(p.x, p.y, c, font.id, size, col.id, style)); else return GDS_TextChar(p.x, p.y, c, font.id, size, col.id, style); return 0; }
uint32_t Surface::Arc(const Rect &r, uint32_t a1, uint32_t a2, const Colour &lineColour, const Colour &fillColour, uint8_t lineWidth, uint32_t lineStyle, uint32_t fillStyle){ Select(); if(queued) QueueOp(GDS_Arc_Op(r.x, r.y, r.w, r.h, a1, a2, lineColour.id, fillColour.id, lineWidth, lineStyle, fillStyle)); else return GDS_Arc(r.x, r.y, r.w, r.h, a1, a2, lineColour.id, fillColour.id, lineWidth, lineStyle, fillStyle); return 0; }
uint32_t Surface::Line(const Point &p1, const Point &p2, const Colour &c, uint8_t width, uint32_t style){ Select(); if(queued) QueueOp(GDS_Line_Op(p1.x, p1.y, p2.x, p2.y, c.id, width, style)); else return GDS_Line(p1.x, p1.y, p2.x, p2.y, c.id, width, style); return 0; }
uint32_t Surface::Dot(const Point &p, const Colour &c, uint8_t size){ Select(); if(queued) QueueOp(GDS_Dot_Op(p.x, p.y, c.id, size)); else return GDS_Dot(p.x, p.y, c.id, size); return 0; }