//------------------------------------------------------------------------ bool CItem::ReadActions(const IItemParamsNode *actions) { if(!m_sharedparams->Valid()) { m_sharedparams->actions.clear(); int n = actions->GetChildCount(); for(int i=0; i<n; i++) { const IItemParamsNode *actionparams = actions->GetChild(i); if(actionparams) { SAction action; if(ReadAction(actionparams, &action)) { const char *name = actionparams->GetAttribute("name"); m_sharedparams->actions.insert(TActionMap::value_type(name, action)); } } } } return true; }
bool GmExe::ReadTimelines() { GmkStream* stream; Timeline* timeline; exeHandle->SkipDwords(1); unsigned int count = exeHandle->ReadDword(); for(size_t a = 0; a < count; a++) { stream = new GmkStream(); exeHandle->Deserialize(stream,true); if (!stream->ReadBool()) { gmkHandle->timelines.push_back(0); delete stream; continue; } timeline = new Timeline(); timeline->name = stream->ReadString(); stream->SkipDwords(1); unsigned int i = stream->ReadDword(); for(; i; i--) { TimelineMoment* moment = new TimelineMoment(); moment->moment = stream->ReadDword(); stream->SkipDwords(1); unsigned int ii = stream->ReadDword(); for(; ii; ii--) { ObjectAction* action = new ObjectAction(); ReadAction(stream,action); moment->actions.push_back(action); } timeline->moments.push_back(moment); } RTAddItem(timeline->name,RCT_ID_TIMELINES,a); gmkHandle->timelines.push_back(timeline); delete stream; } return true; }
static ACTION PromptAction( void ) /********************************/ /* The user didn't specify an action on the command line, * so prompt for it. */ { ACTION act; for( ;; ) { printf( "\nEnter an action:\n" ); act = ReadAction(); if( act != INVALID ) { return( act ); } printf( "\nThat selection was not valid.\n" ); Help(); } }
bool GmExe::ReadObjects() { GmkStream* stream; Object* object; exeHandle->SkipDwords(1); unsigned int count = exeHandle->ReadDword(); for(size_t a = 0; a < count; a++) { stream = new GmkStream(); exeHandle->Deserialize(stream,true); if (!stream->ReadBool()) { gmkHandle->objects.push_back(0); delete stream; continue; } object = new Object(); object->name = stream->ReadString(); stream->SkipDwords(1); object->spriteIndex = stream->ReadDword(); object->solid = stream->ReadBool(); object->visible = stream->ReadBool(); object->depth = stream->ReadDword(); object->persistent = stream->ReadBool(); object->parentIndex = stream->ReadDword(); object->maskIndex = stream->ReadDword(); unsigned int i = stream->ReadDword() + 1; for(unsigned int ii = 0; ii < i; ii++) { for(;;) { int first = stream->ReadDword(); if (first == -1) break; ObjectEvent* objEvent = new ObjectEvent(); objEvent->eventType = ii; objEvent->eventKind = first; stream->SkipDwords(1); unsigned int iii = stream->ReadDword(); for(; iii; iii--) { ObjectAction* action = new ObjectAction(); ReadAction(stream,action); objEvent->actions.push_back(action); } object->events.push_back(objEvent); } } RTAddItem(object->name,RCT_ID_OBJECTS,a); gmkHandle->objects.push_back(object); delete stream; } return true; }