implemented long-time-awaited feature: it is now possible to chat through windows and bar walls. in the future we might have bars with bartenders, for example.
arr := { … }the difference is `:=`, and you don't need any counter, the game is able to count items on its own.
Extend owterrain { Config ASLONA_CASTLE; { Probability = 100; CanBeSkipped = false; //NameSingular = "Alien Vessel"; BitmapPos = 96, 128; NameStem = "mighty seaside castle"; UsesLongArticle = false; AttachedDungeon = ASLONA_CASTLE; CanBeGenerated = true; NativeGTerrainType = LEAFY_FOREST; WantContinentWith = ATTNAM; RevealEnvironmentInitially = true; //for debug } Config REBEL_CAMP; { Probability = 100; BitmapPos = 16, 64; NameStem = "hidden camp"; UsesLongArticle = false; AttachedDungeon = REBEL_CAMP; CanBeGenerated = true; NativeGTerrainType = STEPPE; WantContinentWith = ATTNAM; RevealEnvironmentInitially = true; //for debug } }this creates two new POIs for Alsona and Rebels. you still need C++ code to actually implement quests, but the dungeons are accessible with wizard mode.
Extend smith { Config ASLONA_CASTLE; { DefaultName = "Khalybs"; TorsoBitmapPos = 48, 192; HeadBitmapPos = 112, 480; ArmBitmapPos = 64, 64; LegBitmapPos = 0, 96; HairColor = rgb16(44, 34, 43); ClothColor = rgb16(100, 100, 100); TotalVolume = 90000; TotalSize = 200; Cloak = SELKIE_SKIN cloak(CLOAK_OF_FIRE_RESISTANCE) { Enchantment = 1; } RightGauntlet = SELKIE_SKIN gauntlet(GAUNTLET_OF_DEXTERITY) { Enchantment = 4; } RightWielded = CHROME MAHOGANY_WOOD meleeweapon(HAMMER); LeftWielded = CHROME MAHOGANY_WOOD meleeweapon(HAMMER); Sex = FEMALE; } }
character *character::CheckWindowInDir (int dir) const { if (dir < 0 || dir >= 8) return 0; v2 pos = GetPos() + game::GetMoveVector(dir); if (!GetLevel()->IsValidPos(pos)) return 0; lsquare *lsq = GetNaturalNeighbourLSquare(dir); if (!lsq) return 0; if (!lsq->IsTransparent()) return 0; // if it is a window, check if there is somebody over there pos += game::GetMoveVector(dir); if (!GetLevel()->IsValidPos(pos)) return 0; lsq = GetLevel()->GetLSquare(pos); if (!lsq) return 0; return lsq->GetCharacter(); }what this does is check if the square in the given direction is transparent (i.e. the player can see through it), and if it is, then check next square in the same direction to find a char. and Talk command becomes:
COMMAND(Talk) { if (!Char->CheckTalk()) return false; character *ToTalk = 0; int Characters = 0; for (int d = 0; d < 8; ++d) { lsquare *Square = Char->GetNaturalNeighbourLSquare(d); if (Square) { character *Dude = Square->GetCharacter(); if (!Dude) Dude = Char->CheckWindowInDir(d); if (Dude) { ToTalk = Dude; ++Characters; } } } if (!Characters) { ADD_MESSAGE("Find yourself someone to talk to first!"); return false; } if (Characters == 1) { return ToTalk->ChatMenu(); } int Dir = game::DirectionQuestion(CONST_S("To whom do you wish to talk to? [press a direction key]"), false, true); if (Dir == DIR_ERROR || !Char->GetArea()->IsValidPos(Char->GetPos()+game::GetMoveVector(Dir))) { return false; } character *Dude = Char->GetNearSquare(Char->GetPos()+game::GetMoveVector(Dir))->GetCharacter(); if (!Dude) Dude = Char->CheckWindowInDir(Dir); if (Dude == Char) { ADD_MESSAGE("You talk to yourself for some time."); Char->EditExperience(WISDOM, -50, 1<<7); Char->EditAP(-1000); return true; } if (Dude) return Dude->ChatMenu(); ADD_MESSAGE("You get no response."); return false; }i just added two calls to the new method. that's it.
character *character::CheckWindowInDir (int dir) const { if (dir < 0 || dir >= 8) return 0; v2 pos = GetPos() + game::GetMoveVector(dir); if (!GetLevel()->IsValidPos(pos)) return 0; lsquare *lsq = GetNaturalNeighbourLSquare(dir); if (!lsq) return 0; if (!lsq->IsTransparent()) return 0; // if it is a window, check if there is somebody over there // >>>HERE<<< olterrain *terra = lsq->GetOLTerrain(); if (!terra) return 0; if (!(terra->GetConfig() & WINDOW)) return 0; pos += game::GetMoveVector(dir); if (!GetLevel()->IsValidPos(pos)) return 0; lsq = GetLevel()->GetLSquare(pos); if (!lsq) return 0; return lsq->GetCharacter(); }