void ClientThread::stop() { if(ClientThread::isRunning()) { stopTalk(); sendto(sock, "exit"+id.toUtf8(), id.toUtf8().length()+4, 0, (struct sockaddr*)&server, sizeof(struct sockaddr)); close(sock); ClientThread::terminate(); } }
void ScummEngine::setCameraAt(int pos_x, int pos_y) { if (camera._mode != kFollowActorCameraMode || ABS(pos_x - camera._cur.x) > (_screenWidth / 2)) { camera._cur.x = pos_x; } camera._dest.x = pos_x; if (VAR_CAMERA_MIN_X != 0xFF && camera._cur.x < VAR(VAR_CAMERA_MIN_X)) camera._cur.x = (short) VAR(VAR_CAMERA_MIN_X); if (VAR_CAMERA_MAX_X != 0xFF && camera._cur.x > VAR(VAR_CAMERA_MAX_X)) camera._cur.x = (short) VAR(VAR_CAMERA_MAX_X); if (VAR_SCROLL_SCRIPT != 0xFF && VAR(VAR_SCROLL_SCRIPT)) { VAR(VAR_CAMERA_POS_X) = camera._cur.x; runScript(VAR(VAR_SCROLL_SCRIPT), 0, 0, 0); } // If the camera moved and text is visible, remove it if (camera._cur.x != camera._last.x && _charset->_hasMask && _game.version > 3) stopTalk(); }
/** * Start a 'scene' by loading the specified room with the given main actor. * The actor is placed next to the object indicated by objectNr. */ void startScene(int room, Actor* a, int objectNr) { int i, where; printf("Loading room %d\n", room); stopTalk(); //fadeOut(_switchRoomEffect2); //_newEffect = _switchRoomEffect; ScriptSlot *ss = &vm.slot[_currentScript]; if (_currentScript != 0xFF) { if (ss->where == WIO_ROOM || ss->where == WIO_FLOBJECT) { if (ss->cutsceneOverride) printf("Error: Object %d stopped with active cutscene/override in exit\n", ss->number); //nukeArrays(_currentScript); _currentScript = 0xFF; } else if (ss->where == WIO_LOCAL) { if (ss->cutsceneOverride) printf("Error: Script %d stopped with active cutscene/override in exit\n", ss->number); //nukeArrays(_currentScript); _currentScript = 0xFF; } } VAR(VAR_NEW_ROOM) = room; runExitScript(); killScriptsAndResources(); InitFrameBuffers(); // For HE80+ games for (i = 0; i < 4096; i++) _roomVars[i] = 0; //nukeArrays(0xFF); for (i = 1; i < _numActors; i++) { hideActor(&_actors[i]); } /*for (i = 0; i < 256; i++) { _roomPalette[i] = i; if (_shadowPalette) _shadowPalette[i] = i; }*/ VAR(VAR_ROOM) = room; //_fullRedraw = true; //_res->increaseResourceCounters(); _currentRoom = room; VAR(VAR_ROOM) = room; //if (room >= 0x80 && _game.version < 7 && _game.heversion <= 71) // _roomResource = _resourceMapper[room & 0x7F]; //else _roomResource = room; VAR(VAR_ROOM_RESOURCE) = _roomResource; //if (room != 0) // ensureResourceLoaded(rtRoom, room); //clearRoomObjects(); ClearObjectFrameBuffer(); clearDrawObjectQueue(); if(RoomResource != NULL) freeLFLF(RoomResource); if (_currentRoom == 0) { RoomResource = NULL; //_ENCD_offs = _EXCD_offs = 0; //_numObjectsInRoom = 0; return; } else { readRoom(HE1_File, &Room, getLFLFOffset(HE0_File, &HE0_Data, room)); RoomResource = &Room; ConvertRoomBackground(HE1_File, RoomResource); } //setupRoomSubBlocks(); //resetRoomSubBlocks(); //initBGBuffers(_roomHeight); //resetRoomObjects(); VAR(VAR_ROOM_WIDTH) = 640;//_roomWidth; VAR(VAR_ROOM_HEIGHT) = 480;//_roomHeight; /*if (VAR_CAMERA_MIN_X != 0xFF) VAR(VAR_CAMERA_MIN_X) = _screenWidth / 2; if (VAR_CAMERA_MAX_X != 0xFF) VAR(VAR_CAMERA_MAX_X) = _roomWidth - (_screenWidth / 2); camera._mode = kNormalCameraMode; if (_game.version > 2) camera._cur.x = camera._dest.x = _screenWidth / 2; camera._cur.y = camera._dest.y = _screenHeight / 2;*/ if (_roomResource == 0) return; //memset(gfxUsageBits, 0, sizeof(gfxUsageBits)); if (a) { //where = whereIsObject(objectNr); //if (where != WIO_ROOM && where != WIO_FLOBJECT) // printf("Error: startScene: Object %d is not in room %d\n", objectNr, // _currentRoom); /*int x, y, dir; getObjectXYPos(objectNr, x, y, dir); a->putActor(x, y, _currentRoom); a->setDirection(dir + 180); a->stopActorMoving(); */ } showActors(); _egoPositioned = false; runEntryScript(); /*if (a && !_egoPositioned) { int x, y; getObjectXYPos(objectNr, x, y); a->putActor(x, y, _currentRoom); a->_moving = 0; }*/ //_doEffect = true; }