// Writes the scene. void CScreenIO::IOWriteScene() { CWindow* pw; CList* pl; CEdit* pe; char info[100]; pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); if ( pw == nullptr ) return; pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_IOLIST)); if ( pl == nullptr ) return; pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_IONAME)); if ( pe == nullptr ) return; int sel = pl->GetSelect(); if ( sel == -1 ) return; pe->GetText(info, 100); m_interface->DeleteControl(EVENT_WINDOW5); std::string dir; if (static_cast<unsigned int>(sel) >= m_saveList.size()) { dir = m_main->GetPlayerProfile()->GetSaveFile("save"+clearName(info)); } else { dir = m_saveList.at(sel); } m_main->GetPlayerProfile()->SaveScene(dir, info); }
//--------------------------------------------------------------- //--- rFile Constructors //--------------------------------------------------------------- rFile::rFile(void) { init(); typeSize = 0; dataLen = 0; clearPath(); clearName(); }
void AGOSEngine::undefineBox(uint hitarea) { HitArea *ha = findBox(hitarea); if (ha != NULL) { ha->flags = 0; if (ha == _lastNameOn) clearName(); _needHitAreaRecalc++; } }
void WAV::fillHeaderData() { // RIFF chunk this->header_data["chunkID"] = clearName(p_header->RIFF.chunkID,4); this->header_data["chunkSize"] = int2str (p_header->RIFF.chunkSize); this->header_data["format"] = clearName(p_header->RIFF.format,4); // WAVE_FORMAT chunk this->header_data["audioFormat"] = int2str(p_header->WAVE_F.audioFormat); this->header_data["bitsPerSample"] = int2str(p_header->WAVE_F.bitsPerSample); this->header_data["blockAlign"] = int2str(p_header->WAVE_F.blockAlign); this->header_data["byteRate"] = int2str(p_header->WAVE_F.byteRate); this->header_data["numChannels"] = int2str(p_header->WAVE_F.numChannels); this->header_data["sampleRate"] = int2str(p_header->WAVE_F.sampleRate); this->header_data["f_subChunkID"] = clearName(p_header->WAVE_F.subChunkID,4); this->header_data["subChunkSize"] = int2str (p_header->WAVE_F.subChunkSize); // WAVE_DATA chunk this->header_data["subChunk2Size"] = int2str (p_header->WAVE_D.subChunk2Size ); this->header_data["d_subChunkID"] = clearName(p_header->WAVE_D.subChunkID,4); }
// reset the parser JSONStreamingParser &JSONStreamingParser::reset(void) { state = PARSER_IDLE; flags = 0; level = 0; levels = 0; // clear stored name and value clearName(); clearValue(); return *this; }
// execute callback and clear name/value void JSONStreamingParser::doCallback(const char *val) { if(callback) { const char *nam = name; if(!nam) nam = ""; if(!val) val = value; if(!val) val = ""; callback(0, level, nam, val, callbackObject); } clearName(); clearValue(); }
void AGOSEngine_Waxworks::boxController(uint x, uint y, uint mode) { HitArea *best_ha; HitArea *ha = _hitAreas; uint count = ARRAYSIZE(_hitAreas); uint16 priority = 0; uint16 x_ = x; uint16 y_ = y; if (getGameType() == GType_FF || getGameType() == GType_PP) { x_ += _scrollX; y_ += _scrollY; } else if (getGameType() == GType_SIMON2) { if (getBitFlag(79) || y < 134) { x_ += _scrollX * 8; } } best_ha = NULL; do { if (ha->flags & kBFBoxInUse) { if (!(ha->flags & kBFBoxDead)) { if (x_ >= ha->x && y_ >= ha->y && x_ - ha->x < ha->width && y_ - ha->y < ha->height && priority <= ha->priority) { priority = ha->priority; best_ha = ha; } else { if (ha->flags & kBFBoxSelected) { hitarea_leave(ha , true); ha->flags &= ~kBFBoxSelected; } } } else { ha->flags &= ~kBFBoxSelected; } } } while (ha++, --count); _currentBoxNum = 0; _currentBox = best_ha; if (best_ha == NULL) { clearName(); if (getGameType() == GType_WW && _mouseCursor >= 4) { _mouseCursor = 0; _needHitAreaRecalc++; } return; } _currentBoxNum = best_ha->id; if (mode != 0) { if (mode == 3) { if (best_ha->flags & kBFDragBox) { _lastClickRem = best_ha; } } else { _lastHitArea = best_ha; if (getGameType() == GType_PP) { _variableArray[400] = x; _variableArray[401] = y; } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2 || getGameType() == GType_FF) { _variableArray[1] = x; _variableArray[2] = y; } } } if ((getGameType() == GType_WW) && (_mouseCursor == 0 || _mouseCursor >= 4)) { uint verb = best_ha->verb & 0x3FFF; if (verb >= 239 && verb <= 242) { uint cursor = verb - 235; if (_mouseCursor != cursor) { _mouseCursor = cursor; _needHitAreaRecalc++; } } } if (getGameType() != GType_WW || !_nameLocked) { if (best_ha->flags & kBFNoTouchName) { clearName(); } else if (best_ha != _lastNameOn) { displayName(best_ha); } } if (best_ha->flags & kBFInvertTouch && !(best_ha->flags & kBFBoxSelected)) { hitarea_leave(best_ha, false); best_ha->flags |= kBFBoxSelected; } }
void AGOSEngine_Feeble::off_mouseOff() { // 181: force mouseOff scriptMouseOff(); clearName(); }
void Vertex::clear() { clearName(); clearDebugName(); clearStreamIndices(); }
// feed the parser with a char // return value: // 1 if needs more chars // 0 if finished // -1 if error uint8_t JSONStreamingParser::feed(char c) { switch(state) { // on error, just drop chars and return state case PARSER_ERROR: case PARSER_FINISHED: return state; // on idle, espect { opening character, skipping blanks case PARSER_IDLE: if(isspace(c)) return state; if(c != '{') { state = PARSER_ERROR; return state; } state = PARSER_WAIT_NAME; flags = 0; return state; case PARSER_WAIT_NAME: // skip spaces if(isspace(c)) return state; // we can have quotes or double quotes here if(c != '"' && c != '\'') { state = PARSER_ERROR; return state; } if(c == '"') flags = IN_DQUOTES; else flags = IN_QUOTES; // switch to reading name clearName(); state = PARSER_NAME; return state; case PARSER_NAME: // first, look at special state after a backslash if(flags & IN_BACKSLASH) { appendName(c); flags &= ~IN_BACKSLASH; return state; } else if(c == '\\') { flags |= IN_BACKSLASH; return state; } switch(c) { case '"': if((flags & IN_QUOTES)) { appendName(c); return state; } // switch to semicolon state state = PARSER_WAIT_SEMICOLON; flags = 0; return state; case '\'': if((flags & IN_DQUOTES)) { appendName(c); return state; } // switch to semicolon state state = PARSER_WAIT_SEMICOLON; flags = 0; return state; case ':': if( (flags & IN_QUOTES) || (flags & IN_DQUOTES)) { appendName(c); return state; } state = PARSER_WAIT_VALUE; flags = 0; return state; case 0: state = PARSER_ERROR; return state; default: appendName(c); return state; } // switch(c) case PARSER_WAIT_SEMICOLON: if(isspace(c)) return state; if(c != ':') { state = PARSER_ERROR; return state; } state = PARSER_WAIT_VALUE; flags = 0; return state; case PARSER_WAIT_VALUE: if(isspace(c)) return state; // value can be a simple type, a list or an array // check latter 2 before if(c == '{') { doCallback("<LIST>"); level++; // mark current level as list levels = levels << 1; clearName(); state = PARSER_WAIT_NAME; flags = 0; return state; } else if(c == '[') { doCallback("<ARRAY>"); level++; // mark current level as array levels = (levels << 1) | 0x01; clearName(); state = PARSER_WAIT_VALUE; flags = 0; return state; } else if(c == '"') { flags = IN_DQUOTES; clearValue(); appendValue(c); state = PARSER_VALUE; return state; } else if(c == '\'') { flags = IN_QUOTES; clearValue(); appendValue(c); state = PARSER_VALUE; return state; } else if(c == '}' || c == ']') { if(level <= 0) { if(c == '}') state = PARSER_FINISHED; else state = PARSER_ERROR; return state; } level--; levels >>= 1; state = PARSER_WAIT_SEPARATOR; return state; } else { flags = 0; clearValue(); appendValue(c); state = PARSER_VALUE; return state; } case PARSER_VALUE: if(flags & IN_BACKSLASH) { flags &= ~IN_BACKSLASH; appendValue(c); return state; } else if(c == '\\') { flags |= IN_BACKSLASH; return state; } else if( ((c == '"') && (flags & IN_DQUOTES)) || ((c == '\'') && (flags & IN_QUOTES))) { flags = 0; appendValue(c); doCallback(); state = PARSER_WAIT_SEPARATOR; return state; } else if( (flags & IN_QUOTES) || (flags & IN_DQUOTES)) { appendValue(c); return state; } else if(isalnum(c) || c == '_' || c == '.' || c == '-') { appendValue(c); return state; } else if(c == ',') { flags = 0; doCallback(); if(levels &0x01) state = PARSER_WAIT_VALUE; else state = PARSER_WAIT_NAME; return state; } else if(isspace(c)) { flags = 0; doCallback(); state = PARSER_WAIT_SEPARATOR; return state; } else if(c == '}' || c == ']') { if(level <= 0) { if(c == '}') state = PARSER_FINISHED; else state = PARSER_ERROR; return state; } doCallback(); level--; levels = levels >> 1; state = PARSER_WAIT_SEPARATOR; return state; } else {
void ShaderAttribute::clear() { clearName(); clearAttributeType(); clearAttributeIndex(); }