characterDesigner::characterDesigner () : y(0), lastD(false), lastSpace(false), done(false) { cr = NULL; data.push_back(0); data.push_back(0); data.push_back(0); data.push_back(0); data.push_back(0); data.push_back(0); genC(); }
void compPhasePutC(EmitInfo finfo, Foam foam) { String id = emitGetFileIdName(finfo); phStart(PH_PutC); if (emitIsOutputNeededOrWarn(finfo, FTYPENO_C)) { /* Should do what emitGetFileId does */ #if 0 FileName fname = emitSrcFile(finfo); CCodeList ccodel = genC(foam, strCopy(fnameName(fname))); #else CCodeList ccodel = genC(foam, id); #endif emitTheC(finfo, ccodel); listFreeDeeply(CCode)(ccodel, ccoFree); } phEnd((PhPrFun) 0, (PhPrFun) 0, (Pointer) NULL); }
void characterDesigner::update(float elapsed) { if (done) return; cr->updateAnimOnly(elapsed); int xA = 0; int yA = 0; if (*global_hasFocus && sf::Keyboard::isKeyPressed(sf::Keyboard::W)) yA -= 1; if (*global_hasFocus && sf::Keyboard::isKeyPressed(sf::Keyboard::S)) yA += 1; if (*global_hasFocus && sf::Keyboard::isKeyPressed(sf::Keyboard::A)) xA -= 1; if (*global_hasFocus && sf::Keyboard::isKeyPressed(sf::Keyboard::D)) xA += 1; if (*global_hasFocus && sf::Keyboard::isKeyPressed(sf::Keyboard::Space)) { if (!lastSpace) { lastSpace = true; if (y == data.size()) { global_sound->play(5); done = true; //give it it's inventory at the last moment cr->givePlayerInventory(data[0]); } } } else lastSpace = false; if (xA != 0 || yA != 0) { if (!lastD) { lastD = true; if (yA != 0) global_sound->play(4); if (yA == -1 && y == 0) y = data.size(); else if (yA == 1 && y == data.size()) y = 0; else if (yA != 0) y += yA; else if (y < data.size()) { global_sound->play(5); //handle adding, hoo boy unsigned int max; unsigned int race = global_data->getValue(DATA_CTYPE, data[0], 0); unsigned int numParts = global_data->getValue(DATA_RACE, race, DATA_RACE_PARTNUM); unsigned int colors = global_data->getValue(DATA_CTYPE, data[0], 1); switch(y) { case 0: //ctyp max = global_data->getEntrySize(DATA_LIST, 1); break; case 1: //gender max = 2; break; case 2: //hat max = global_data->getEntrySize(DATA_LIST, 2) / 2; break; case 3: //skinC max = global_data->getEntrySize(DATA_COLORLIST, global_data->getValue(DATA_COLORLIST, colors, 0)); break; case 4: //hair max = global_data->getEntrySize(DATA_LIST, global_data->getValue(DATA_RACE, race, DATA_RACE_PARTNUM + 2 * numParts)); break; case 5: //hairC max = global_data->getEntrySize(DATA_COLORLIST, global_data->getValue(DATA_COLORLIST, colors, 2)); break; } if (max != 1) { if (data[y] == 0 && xA == -1) data[y] = max - 1; else if (data[y] == max - 1 && xA == 1) data[y] = 0; else data[y] += xA; if (y == 0) { data[3] = 0; data[4] = 0; data[5] = 0; } genC(); } } } } else lastD = false; }