void ANimModPlayerCameraManager::UpdateCamera(float DeltaTime) { ANimModCharacter* MyPawn = PCOwner ? Cast<ANimModCharacter>(PCOwner->GetPawn()) : NULL; if (MyPawn && MyPawn->IsFirstPerson()) { //const float TargetFOV = MyPawn->IsTargeting() ? TargetingFOV : NormalFOV; DefaultFOV = CurrentFOV;//FMath::FInterpTo(DefaultFOV, TargetFOV, DeltaTime, 20.0f); } FVector previousLocation = GetCameraLocation(); Super::UpdateCamera(DeltaTime); if (MyPawn && MyPawn->IsFirstPerson()) { MyPawn->OnCameraUpdate(previousLocation, GetCameraLocation(), GetCameraRotation()); } }
uint16 GameMapGump::TraceCoordinates(int mx, int my, sint32 coords[3], int offsetx, int offsety, Item* item) { sint32 dxd = 0,dyd = 0,dzd = 0; if (item) item->getFootpadWorld(dxd,dyd,dzd); sint32 cx, cy, cz; GetCameraLocation(cx, cy, cz); ItemSorter::HitFace face; ObjId trace = display_list->Trace(mx,my,&face); Item* hit = getItem(trace); if (!hit) // strange... return 0; sint32 hx,hy,hz; sint32 hxd,hyd,hzd; hit->getLocation(hx,hy,hz); hit->getFootpadWorld(hxd,hyd,hzd); // adjust mx (if dragged item wasn't 'picked up' at its origin) mx -= offsetx; my -= offsety; // mx = (coords[0]-cx-coords[1]+cy)/4 // my = (coords[0]-cx+coords[1]-cy)/8 - coords[2] + cz // the below expressions solve these two equations to two of the coords, // while fixing the other coord switch (face) { case ItemSorter::Z_FACE: coords[0] = 2*mx + 4*(my+hz+hzd) + cx - 4*cz; coords[1] = -2*mx + 4*(my+hz+hzd) + cy - 4*cz; coords[2] = hz+hzd; break; case ItemSorter::X_FACE: coords[0] = hx+dxd; coords[1] = -4*mx + hx+dxd - cx + cy; coords[2] = -my + (hx+dxd)/4 - mx/2 - cx/4 + cz; break; case ItemSorter::Y_FACE: coords[0] = 4*mx + hy+dyd + cx - cy; coords[1] = hy+dyd; coords[2] = -my + mx/2 + (hy+dyd)/4 - cy/4 + cz; break; } return trace; }
void GameMapGump::PaintThis(RenderSurface *surf, sint32 lerp_factor, bool scaled) { World *world = World::get_instance(); if (!world) return; // Is it possible the world doesn't exist? CurrentMap *map = world->getCurrentMap(); if (!map) return; // Is it possible the map doesn't exist? // Get the camera location int lx, ly, lz; GetCameraLocation(lx, ly, lz, lerp_factor); CameraProcess *camera = CameraProcess::GetCameraProcess(); uint16 roofid = 0; int zlimit = 1 << 16; // should be high enough if (!camera) { // Check roof //!! This is _not_ the right place for this... sint32 ax, ay, az, axd, ayd, azd; Actor* av = getMainActor(); av->getLocation(ax, ay, az); av->getFootpadWorld(axd, ayd, azd); map->isValidPosition(ax, ay, az, 32, 32, 8, 0, 1, 0, &roofid); } else roofid = camera->FindRoof(lerp_factor); Item* roof = getItem(roofid); if (roof) { zlimit = roof->getZ(); } display_list->BeginDisplayList(surf, lx, ly, lz); uint32 gametick = Kernel::get_instance()->getFrameNum(); bool paintEditorItems = GUIApp::get_instance()->isPaintEditorItems(); // Get all the required items for (int cy = 0; cy < MAP_NUM_CHUNKS; cy++) { for (int cx = 0; cx < MAP_NUM_CHUNKS; cx++) { // Not fast, ignore if (!map->isChunkFast(cx,cy)) continue; const std::list<Item*>* items = map->getItemList(cx,cy); if (!items) continue; std::list<Item*>::const_iterator it = items->begin(); std::list<Item*>::const_iterator end = items->end(); for (; it != end; ++it) { Item *item = *it; if (!item) continue; item->setupLerp(gametick); item->doLerp(lerp_factor); if (item->getZ() >= zlimit && !item->getShapeInfo()->is_draw()) continue; if (!paintEditorItems && item->getShapeInfo()->is_editor()) continue; if (item->getFlags() & Item::FLG_INVISIBLE) { // special case: invisible avatar _is_ drawn // HACK: unless EXT_TRANSPARENT is also set. // (Used for hiding the avatar when drawing a full area map) if (item->getObjId() == 1) { if (item->getExtFlags() & Item::EXT_TRANSPARENT) continue; sint32 x, y, z; item->getLerped(x, y, z); display_list->AddItem(x,y,z,item->getShape(),item->getFrame(), item->getFlags() & ~Item::FLG_INVISIBLE, item->getExtFlags() | Item::EXT_TRANSPARENT, 1); } continue; } display_list->AddItem(item); } } } // Dragging: if (display_dragging) { display_list->AddItem(dragging_pos[0],dragging_pos[1],dragging_pos[2], dragging_shape, dragging_frame, dragging_flags, Item::EXT_TRANSPARENT); } display_list->PaintDisplayList(highlightItems); }