void NaGeVector3D::operator /= (const double &scalar) { if(!IsNull()) { SetX(GetX()/scalar); SetY(GetY()/scalar); SetZ(GetZ()/scalar); } else { SetX(0); SetY(0); SetZ(0); } }
bool ThreeSliceAttributes::CopyAttributes(const AttributeGroup *atts) { if(atts->TypeName() == "PointAttributes") { if (interactive) { const PointAttributes *tmp = (const PointAttributes *)atts; const double *xyz = tmp->GetPoint(); SetX(xyz[0]); SetY(xyz[1]); SetZ(xyz[2]); return true; } } if(TypeName() != atts->TypeName()) return false; // Call assignment operator. const ThreeSliceAttributes *tmp = (const ThreeSliceAttributes *)atts; *this = *tmp; return true; }
void Sprite_Battler::CreateSprite() { sprite_name = battler->GetSpriteName(); hue = battler->GetHue(); SetX(battler->GetBattleX()); SetY(battler->GetBattleY()); SetZ(battler->GetBattleY()); // Not a typo // Not animated -> Monster if (battler->GetBattleAnimationId() == 0) { if (sprite_name.empty()) { graphic = Bitmap::Create(0, 0); SetOx(graphic->GetWidth() / 2); SetOy(graphic->GetHeight() / 2); SetBitmap(graphic); } else { FileRequestAsync* request = AsyncHandler::RequestFile("Monster", sprite_name); request_id = request->Bind(&Sprite_Battler::OnMonsterSpriteReady, this); request->Start(); } } else { // animated SetOx(24); SetOy(24); SetAnimationState(anim_state); idling = true; } SetVisible(!battler->IsHidden()); }
void KVPulseHeightDefect::init() { //default initialisations SetType("Pulse Height Defect"); SetZ(1); fMoulton = fDeltaEphd = 0; }
Character::Character(std::string fromString) { std::vector<std::string> tokens = utils::Tokenfy(fromString, '|'); if (tokens[0] == "PLAYER_OBJECT") { SetName(tokens[57]); SetLastname(tokens[58]); SetRace(tokens[59]); SetGender(tokens[60]); SetFace(tokens[61]); SetSkin(tokens[62]); SetZone(tokens[63]); SetLevel(std::stoi(tokens[64])); SetHp(std::stoi(tokens[65])); SetMaxHp(std::stoi(tokens[66])); SetBp(std::stoi(tokens[67])); SetMaxBp(std::stoi(tokens[68])); SetMp(std::stoi(tokens[69])); SetMaxMp(std::stoi(tokens[70])); SetEp(std::stoi(tokens[71])); SetMaxEp(std::stoi(tokens[72])); SetStrength(std::stoi(tokens[73])); SetConstitution(std::stoi(tokens[74])); SetIntelligence(std::stoi(tokens[75])); SetDexterity(std::stoi(tokens[76])); SetX(std::stof(tokens[77])); SetY(std::stof(tokens[78])); SetZ(std::stof(tokens[79])); SetPitch(std::stof(tokens[80])); SetYaw(std::stof(tokens[81])); } // if (tokens[0] == "NPC_OBJECT") { // // } }
BattleAnimation::BattleAnimation(const RPG::Animation& anim) : animation(anim), frame(0), frame_update(false), large(false) { SetZ(Player::IsMajorUpdatedVersion() ? 2400 : 1040); const std::string& name = animation.animation_name; BitmapRef graphic; if (name.empty()) return; // Emscripten handled special here because of the FileFinder checks // Filefinder is not reliable for Emscripten because the files must be // downloaded first. // And we can't rely on "success" state of FileRequest because it's always // true on desktop. #ifdef EMSCRIPTEN FileRequestAsync* request = AsyncHandler::RequestFile("Battle", animation.animation_name); request_id = request->Bind(&BattleAnimation::OnBattleSpriteReady, this); request->Start(); #else if (!FileFinder::FindImage("Battle", name).empty()) { FileRequestAsync* request = AsyncHandler::RequestFile("Battle", animation.animation_name); request_id = request->Bind(&BattleAnimation::OnBattleSpriteReady, this); request->Start(); } else if (!FileFinder::FindImage("Battle2", name).empty()) { FileRequestAsync* request = AsyncHandler::RequestFile("Battle2", animation.animation_name); request_id = request->Bind(&BattleAnimation::OnBattle2SpriteReady, this); request->Start(); } else { Output::Warning("Couldn't find animation: %s", name.c_str()); } #endif }
Window_Message::Window_Message(int ix, int iy, int iwidth, int iheight) : Window_Selectable(ix, iy, iwidth, iheight), contents_x(0), contents_y(0), line_count(0), kill_message(false), speed_modifier(0), speed_frame_counter(0), new_page_after_pause(false), number_input_window(new Window_NumberInput(0, 0)), gold_window(new Window_Gold(232, 0, 88, 32)) { SetContents(Bitmap::Create(width - 16, height - 16)); if (Data::battlecommands.battle_type != RPG::BattleCommands::BattleType_traditional && Data::battlecommands.transparency == RPG::BattleCommands::Transparency_transparent) { SetBackOpacity(128); } visible = false; SetZ(10000); escape_char = Utils::DecodeUTF32(Player::escape_symbol).front(); active = false; index = -1; text_color = Font::ColorDefault; number_input_window->SetVisible(false); gold_window->SetVisible(false); Game_Message::Init(); }
SimplifySketchTool::SortPoint & SimplifySketchTool::SortPoint::operator+= ( const SortPoint & rhs ) { SetX( X() + rhs.X() ); SetY( Y() + rhs.Y() ); SetZ( Z() + rhs.Z() ); return(*this); }
CNCPoint & CNCPoint::operator+= ( const CNCPoint & rhs ) { SetX( X() + rhs.X() ); SetY( Y() + rhs.Y() ); SetZ( Z() + rhs.Z() ); return(*this); }
void Sprite_Character::Update() { Sprite::Update(); Rect r; if (tile_id != character->GetTileId() || character_name != character->GetCharacterName() || character_index != character->GetCharacterIndex()) { tile_id = character->GetTileId(); character_name = character->GetCharacterName(); character_index = character->GetCharacterIndex(); if (tile_id > 0) { BitmapRef tile = Cache::Tile(Game_Map::GetChipsetName(), tile_id); SetBitmap(tile); r.Set(0, 0, 16, 16); SetSrcRect(r); SetOx(8); SetOy(16); } else { if (character_name.empty()) { SetBitmap(BitmapRef()); } else { SetBitmap(Cache::Charset(character_name)); chara_width = GetBitmap()->GetWidth() / 4 / 3; chara_height = GetBitmap()->GetHeight() / 2 / 4; SetOx(chara_width / 2); SetOy(chara_height); int sx = (character_index % 4) * chara_width * 3; int sy = (character_index / 4) * chara_height * 4; r.Set(sx, sy, chara_width * 3, chara_height * 4); SetSpriteRect(r); } } } if (tile_id == 0) { int row = character->GetDirection(); r.Set(character->GetPattern() * chara_width, row * chara_height, chara_width, chara_height); SetSrcRect(r); } if (character->IsFlashPending()) { Color col; int dur; character->GetFlashParameters(col, dur); Flash(col, dur); } SetVisible(character->GetVisible()); if (GetVisible()) { SetOpacity(character->GetOpacity()); } SetX(character->GetScreenX()); SetY(character->GetScreenY()); SetZ(character->GetScreenZ(chara_height)); //SetBlendType(character->GetBlendType()); //SetBushDepth(character->GetBushDepth()); }
void Sprite_Character::Update() { Sprite::Update(); Rect r; if (tile_id != character->GetTileId() || character_name != character->GetSpriteName() || character_index != character->GetSpriteIndex()) { tile_id = character->GetTileId(); character_name = character->GetSpriteName(); character_index = character->GetSpriteIndex(); if (tile_id > 0) { if (tile_request) { tile_request->Unbind(tile_request_id); } tile_request = AsyncHandler::RequestFile("ChipSet", Game_Map::GetChipsetName()); tile_request_id = tile_request->Bind(&Sprite_Character::OnTileSpriteReady, this); tile_request->Start(); } else { if (character_name.empty()) { SetBitmap(BitmapRef()); } else { if (char_request) { char_request->Unbind(char_request_id); } char_request = AsyncHandler::RequestFile("CharSet", character_name); char_request_id = char_request->Bind(&Sprite_Character::OnCharSpriteReady, this); char_request->Start(); } } } if (tile_id == 0) { int row = character->GetSpriteDirection(); r.Set(character->GetPattern() * chara_width, row * chara_height, chara_width, chara_height); SetSrcRect(r); } if (character->IsFlashPending()) { Color col = character->GetFlashColor(); int dur = character->GetFlashTimeLeft(); Flash(col, dur); // TODO: Gradual decrease of Flash Time Left character->SetFlashTimeLeft(0); } SetVisible(character->GetVisible()); if (GetVisible()) { SetOpacity(character->GetOpacity()); } SetX(character->GetScreenX()); SetY(character->GetScreenY()); SetZ(character->GetScreenZ()); //SetBlendType(character->GetBlendType()); int bush_split = 4 - character->GetBushDepth(); SetBushDepth(bush_split > 3 ? 0 : GetHeight() / bush_split); }
void Sprite_Character::Update() { Sprite::Update(); Rect r; if (tile_id != character->GetTileId() || character_name != character->GetSpriteName() || character_index != character->GetSpriteIndex()) { tile_id = character->GetTileId(); character_name = character->GetSpriteName(); character_index = character->GetSpriteIndex(); if (tile_id > 0) { BitmapRef tile = Cache::Tile(Game_Map::GetChipsetName(), tile_id); SetBitmap(tile); r.Set(0, 0, TILE_SIZE, TILE_SIZE); SetSrcRect(r); SetOx(8); SetOy(16); } else { if (character_name.empty()) { SetBitmap(BitmapRef()); } else { SetBitmap(Cache::Charset(character_name)); SetOx(chara_width / 2); SetOy(chara_height); int sx = (character_index % 4) * chara_width * 3; int sy = (character_index / 4) * chara_height * 4; r.Set(sx, sy, chara_width * 3, chara_height * 4); SetSpriteRect(r); } } } if (tile_id == 0) { int row = (character->IsSpinning() ? character->GetPrelockDirection() : character->GetDirection()); r.Set(character->GetPattern() * chara_width, row * chara_height, chara_width, chara_height); SetSrcRect(r); } if (character->IsFlashPending()) { Color col = character->GetFlashColor(); int dur = character->GetFlashTimeLeft(); Flash(col, dur); // TODO: Gradual decrease of Flash Time Left character->SetFlashTimeLeft(0); } SetVisible(character->GetVisible()); if (GetVisible()) { SetOpacity(character->GetOpacity()); } SetX(character->GetScreenX()); SetY(character->GetScreenY()); SetZ(character->GetScreenZ(chara_height)); //SetBlendType(character->GetBlendType()); //SetBushDepth(character->GetBushDepth()); }
void Engine::Mesh::Update() { if (Engine::UserInput::IsKeyPressed(VK_LEFT)) { SetX(GetX() - 0.1f); } if (Engine::UserInput::IsKeyPressed(VK_RIGHT)) { SetX(GetX() + 0.1f); } if (Engine::UserInput::IsKeyPressed(VK_UP)) { SetZ(GetZ() + 0.1f); } if (Engine::UserInput::IsKeyPressed(VK_DOWN)) { SetZ(GetZ() - 0.1f); } }
Window_SaveFile::Window_SaveFile(int ix, int iy, int iwidth, int iheight) : Window_Base(ix, iy, iwidth, iheight), index(0), hero_hp(0), hero_level(0), corrupted(false) { SetContents(Bitmap::Create(width - 8, height - 16)); contents->SetTransparentColor(windowskin->GetTransparentColor()); SetZ(9999); Refresh(); UpdateCursorRect(); }
SimpleScene::SimpleScene() { _camera = new SimpleCamera2D(); //Create a default layer at z = 0 auto layer = new SimpleLayer(); layer->SetZ(0); AddLayer(layer); //Initialize spatial query auxiliaries _queryResults.reserve(_maxQueryResults); }
void NetworkAvatar::HandleNetworkMessage ( BYTE* Message ) { M3DPacketHeader *Packet; Packet = (M3DPacketHeader*)Message; if( Packet->MessageType == MSG_MOVEENTITY ) { //Get the current position and the target position M3DMoveEnt* MovPacket = (M3DMoveEnt*) Message; Vector3D v; Pos1 = Location; Pos2.x = MovPacket->x; Pos2.y = MovPacket->y; Pos2.z = MovPacket->z; Pos2.Yaw = MovPacket->Yaw; Pos2.Pitch = MovPacket->Pitch; LerpVector.x = (Pos2.x - Pos1.x) ; LerpVector.y = (Pos2.y - Pos1.y) ; LerpVector.z = (Pos2.z - Pos1.z) ; LerpDistance = LerpVector.Mag(); StartTime = WMPtr->GTPtr->GetTime(); time = 0; //set the movement such and such CurrentVelocity.x = MovPacket->vx; CurrentVelocity.y = MovPacket->vy; CurrentVelocity.z = MovPacket->vz; Lerping = true; if(LerpDistance > 50) { SetX( MovPacket->x ); SetY( MovPacket->y ); SetZ( MovPacket->z ); Pos1 = Location; } LerpVector.x += MovPacket->vx ; LerpVector.y += MovPacket->vy ; LerpVector.z += MovPacket->vz; SetYaw ( MovPacket->Yaw ); AdjustBoundingVolume(); } }
void Sprite_Character::Update() { Sprite::Update(); Rect r; if (tile_id != character->GetTileId() || character_name != character->GetCharacterName() || character_index != character->GetCharacterIndex()) { tile_id = character->GetTileId(); character_name = character->GetCharacterName(); character_index = character->GetCharacterIndex(); if (tile_id > 0) { BitmapRef tile = Cache::Tile(Game_Map::GetChipsetName(), tile_id); SetBitmap(tile); r.Set(0, 0, 16, 16); SetSrcRect(r); SetOx(8); SetOy(16); } else { if (character_name.empty()) { SetBitmap(BitmapRef()); } else { SetBitmap(Cache::Charset(character_name)); chara_width = GetBitmap()->GetWidth() / 4 / 3; chara_height = GetBitmap()->GetHeight() / 2 / 4; SetOx(chara_width / 2); SetOy(chara_height); int sx = (character_index % 4) * chara_width * 3; int sy = (character_index / 4) * chara_height * 4; r.Set(sx, sy, chara_width * 3, chara_height * 4); SetSpriteRect(r); } } } //SetVisible(character->GetVisible()); if (tile_id == 0) { int row = character->GetDirection(); r.Set(character->GetPattern() * chara_width, row * chara_height, chara_width, chara_height); SetSrcRect(r); } SetX(character->GetScreenX()); SetY(character->GetScreenY()); SetZ(character->GetScreenZ(chara_height)); //SetOpacity(character->GetOpacity()); //SetBlendType(character->GetBlendType()); //SetBushDepth(character->GetBushDepth()); /*if (character->GetAnimationId() != 0) { RPG::Animation animation = Data::animations[character->GetAnimationId()] this->Animation(animation, true); character->SetAnimationId(0); }*/ }
Window_SaveFile::Window_SaveFile(int ix, int iy, int iwidth, int iheight) : Window_Base(ix, iy, iwidth, iheight) { index = 0; hero_hp = 0; hero_level = 0; SetContents(Surface::CreateSurface(width - 8, height - 16)); contents->SetTransparentColor(windowskin->GetTransparentColor()); SetZ(9999); Refresh(); UpdateCursorRect(); }
void Triple::Absolute() { if (GetX() < 0) { SetX(-GetX()); } if (GetY() < 0) { SetY(-GetY()); } if (GetZ() < 0) { SetZ(-GetZ()); } }
void NaGeVector3D::Normalize() { double x, y, z; if(!IsNull()) { x = GetX()/Magnitude(); y = GetY()/Magnitude(); z = GetZ()/Magnitude(); SetX(x); SetY(y); SetZ(z); } else return; }
Window_Base::Window_Base(int x, int y, int width, int height) { windowskin_name = Game_System::GetSystemName(); if (!windowskin_name.empty()) { SetWindowskin(Cache::System(windowskin_name)); } else { SetWindowskin(Bitmap::Create(160, 80, false)); } SetX(x); SetY(y); SetWidth(width); SetHeight(height); SetStretch(Game_System::GetMessageStretch() == RPG::System::Stretch_stretch); SetZ(3000); }
Window_NumberInput::Window_NumberInput(int ix, int iy, int iwidth, int iheight) : Window_Selectable(ix, iy, iwidth, iheight), digits_max(6) { number = 0; SetContents(Bitmap::Create(width - 16, height - 16)); contents->SetTransparentColor(windowskin->GetTransparentColor()); cursor_width = 14; SetZ(10001); opacity = 0; index = 0; active = false; Refresh(); UpdateCursorRect(); }
bool AInventory::DoRespawn () { if (SpawnPointClass != NULL) { AActor *spot = NULL; DSpotState *state = DSpotState::GetSpotState(); if (state != NULL) spot = state->GetRandomSpot(SpawnPointClass); if (spot != NULL) { SetOrigin (spot->Pos(), false); SetZ(floorz); } } return true; }
void Enemy::SetAll( float x, float y, float z, int life, int timer, int shotpattern, int movepattern , int Itemflag){ SetX(x); SetY(y); SetZ(z); SetLife(life); SetTimer(timer); this->Itemflag = Itemflag; this->shotpattern = shotpattern; this->movepattern = movepattern; for(int i = 0; i < ESNUM; i++){ es[i].graph = MV1LoadModel("aaaa.mqo"); es[i].flag = 0; MV1SetScale(es[i].graph, VGet(0.01f, 0.01f, 0.01f)); } score = life * 100; DeathTimer = 120; }
Window_NumberInput::Window_NumberInput(int ix, int iy, int iwidth, int iheight) : Window_Selectable(ix, iy, iwidth, iheight), digits_max(Player::IsRPG2k() ? 6 : 7) { number = 0; plus = true; SetContents(Bitmap::Create(width - 16, height - 16)); cursor_width = 14; // Above the message window SetZ(Priority_Window + 150); opacity = 0; ResetIndex(); active = false; show_operator = false; Refresh(); UpdateCursorRect(); }
Character::Character(std::string name, std::string lastname, std::string race, std::string gender, std::string face, std::string skin, std::string zone, int level, int hp, int maxHp, int bp, int maxBp, int mp, int maxMp, int ep, int maxEp, int strength, int constitution, int intelligence, int dexterity, float x, float y, float z, float pitch, float yaw) { SetName(name); SetLastname(lastname); SetRace(race); SetGender(gender); SetFace(face); SetSkin(skin); SetZone(zone); SetHead("head"); SetChest("chest"); SetArms("arms"); SetHands("hands"); SetLegs("legs"); SetFeet("feet"); SetCloak("cloak"); SetNecklace("necklace"); SetRingOne("ringOne"); SetRingTwo("ringTwo"); SetRightHand("rightHand"); SetLeftHand("leftHand"); SetLevel(level); SetHp(hp); SetMaxHp(maxHp); SetBp(bp); SetMaxBp(maxBp); SetMp(mp); SetMaxMp(maxMp); SetEp(ep); SetMaxEp(maxEp); SetStrength(strength); SetConstitution(constitution); SetIntelligence(intelligence); SetDexterity(dexterity); SetX(x); SetY(y); SetZ(z); SetPitch(pitch); SetYaw(yaw); }
Window_Keyboard::Window_Keyboard(int ix, int iy, int iwidth, int iheight) : Window_Base(ix, iy, iwidth, iheight) , play_cursor(false) { row = 0; col = 0; SetContents(Bitmap::Create(width - 16, height - 16)); contents->SetTransparentColor(windowskin->GetTransparentColor()); SetZ(9999); row_spacing = 16; col_spacing = (contents->GetWidth() - 2 * border_x) / col_max; mode = Letter; Refresh(); UpdateCursorRect(); }
void ThreeSliceAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("ThreeSliceAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("x")) != 0) SetX(node->AsDouble()); if((node = searchNode->GetNode("y")) != 0) SetY(node->AsDouble()); if((node = searchNode->GetNode("z")) != 0) SetZ(node->AsDouble()); if((node = searchNode->GetNode("interactive")) != 0) SetInteractive(node->AsBool()); }
void Sprite_AirshipShadow::Update() { Sprite::Update(); if (!Main_Data::game_player->InAirship()) { SetVisible(false); return; } SetVisible(true); Game_Vehicle* airship = Game_Map::GetVehicle(Game_Vehicle::Airship); const int altitude = airship->GetAltitude(); const int max_altitude = TILE_SIZE; const double opacity = (double)altitude / max_altitude; SetOpacity(opacity * 255); SetX(Main_Data::game_player->GetScreenX()); SetY(Main_Data::game_player->GetScreenY()); // Higher than the events in the upper layer SetZ(151); }
std::vector<boost::shared_ptr<ribi::trim::Point>> ribi::trim::CellsCreator::CreatePoints( const boost::shared_ptr<const Template> t, const int n_face_layers, const boost::units::quantity<boost::units::si::length> layer_height ) { std::vector<boost::shared_ptr<Point>> v; for (int i=0; i!=n_face_layers; ++i) { for (const boost::shared_ptr<const Point> point: t->GetPoints()) { const PointFactory point_factory; const auto new_point(point_factory.Create(point->GetCoordinat())); new_point->SetZ(static_cast<double>(i) * layer_height ); v.push_back(new_point); } } assert(static_cast<int>(v.size()) == static_cast<int>(t->GetPoints().size()) * n_face_layers); return v; }