diff --git a/scripts/entity/entity_functions.lua b/scripts/entity/entity_functions.lua index f673769ab..cbb044933 100644 --- a/scripts/entity/entity_functions.lua +++ b/scripts/entity/entity_functions.lua @@ -56,7 +56,7 @@ function door_init(id) -- NORMAL doors only! if(tickEntity(object_id) == TICK_STOPPED) then setEntityState(object_id, 0) end; end - door_activate(id); + prepareEntity(id); end function keyhole_init(id) -- Key and puzzle holes @@ -137,7 +137,7 @@ function venicebird_init(id) -- Venice singing birds (TR2) end; end - activateEntity(id); + prepareEntity(id); end function doorbell_init(id) -- Lara's Home doorbell (TR2) @@ -186,6 +186,31 @@ function alarm_TR2_init(id) -- Offshore Rig alarm (TR2) end end +function alarmbell_init(id) -- Home Sweet Home alarm (TR2) + + setEntityTypeFlag(id, ENTITY_TYPE_DECORATION); + setEntityActivity(id, 0); + + entity_funcs[id].onActivate = function(object_id, activator_id) + if(getEntityActivity(object_id) == 0) then setEntityActivity(object_id, 1) end; + end + + entity_funcs[id].onDeactivate = function(object_id, activator_id) + if(getEntityActivity(object_id) == 1) then + setEntityActivity(object_id, 0); + stopSound(335, object_id); + end; + end + + entity_funcs[id].onLoop = function(object_id) + playSound(335, object_id); + if(tickEntity(object_id) == TICK_STOPPED) then + setEntityActivity(object_id, 0) + stopSound(335, object_id); + end; + end +end + function heli_TR2_init(id) -- Helicopter (TR2) setEntityTypeFlag(id, ENTITY_TYPE_DECORATION); @@ -215,7 +240,7 @@ function heli_TR2_init(id) -- Helicopter (TR2) end; end - activateEntity(id); + prepareEntity(id); end function swingblade_init(id) -- Swinging blades (TR1) @@ -235,7 +260,7 @@ function swingblade_init(id) -- Swinging blades (TR1) if(tickEntity(object_id) == TICK_STOPPED) then setEntityState(object_id, 0) end; end - activateEntity(id); + prepareEntity(id); end function slamdoor_init(id) -- Slamming doors (TR1-TR2) @@ -255,13 +280,12 @@ function slamdoor_init(id) -- Slamming doors (TR1-TR2) if(tickEntity(object_id) == TICK_STOPPED) then setEntityState(object_id, 0) end; end - activateEntity(id); + prepareEntity(id); end function wallblade_init(id) -- Wall blade (TR1-TR3) setEntityTypeFlag(id, ENTITY_TYPE_DECORATION); - setEntityActivity(id, 0); entity_funcs[id].onActivate = function(object_id, activator_id) setEntityActivity(object_id, 1); @@ -273,15 +297,15 @@ function wallblade_init(id) -- Wall blade (TR1-TR3) entity_funcs[id].onLoop = function(object_id) if(tickEntity(object_id) == TICK_STOPPED) then setEntityActivity(object_id, 0) end; - local anim_number = getEntityAnim(object_id) + local anim_number = getEntityAnim(object_id); if(anim_number == 2) then - setEntityAnim(object_id, 3) + setEntityAnim(object_id, 3); elseif(anim_number == 1) then - setEntityAnim(object_id, 0) + setEntityAnim(object_id, 0); end; end - activateEntity(id); + prepareEntity(id); end function pickup_init(id, item_id) -- Pick-ups @@ -351,7 +375,20 @@ function pickup_init(id, item_id) -- Pick-ups return false; -- Item successfully picked up, kill the task. end); end; +end + +function crystal_TR3_init(id) -- "Savegame" crystal (TR3 version) + + setEntityTypeFlag(id, ENTITY_TYPE_DECORATION); + setEntityActivity(id, 1); + entity_funcs[id].onLoop = function(object_id) + if(getEntityDistance(player, object_id) < 512.0) then + playSound(SOUND_MEDIPACK); + changeCharacterParam(player, PARAM_HEALTH, 200); + disableEntity(object_id); + end; + end end function fallblock_init(id) -- Falling block (TR1-3) @@ -390,10 +427,10 @@ function fallblock_init(id) -- Falling block (TR1-3) end; end -function fallceiling_init(id) -- Falling ceiling (TR1-3) (INVALID) +function fallceiling_init(id) -- Falling ceiling (TR1-3) setEntitySpeed(id, 0.0, 0.0, 0.0); - + entity_funcs[id].onActivate = function(object_id, activator_id) if((object_id == nil) or (activator_id == nil)) then return; @@ -402,25 +439,18 @@ function fallceiling_init(id) -- Falling ceiling (TR1-3) (INVALID) local anim = getEntityAnim(object_id); if(anim == 0) then setEntityAnim(object_id, 1); - local once = true; addTask( function() - local anim = getEntityAnim(object_id); - if(anim == 1) then - return true; - end; - if(once) then - setEntityCollision(object_id, 0); - once = false; - end; if(dropEntity(object_id, frame_time)) then - setEntityAnim(object_id, 3); + setEntityAnim(object_id, 2); + setEntityCollision(object_id, 0); return false; end; return true; end); end; end; + end function pushdoor_init(id) -- Pushdoors (TR4) @@ -445,6 +475,9 @@ function pushdoor_init(id) -- Pushdoors (TR4) end; end +function midastouch_init(id) -- Midas gold touch + +end function oldspike_init(id) -- Teeth spikes (INVALID) diff --git a/scripts/entity/entity_properties.lua b/scripts/entity/entity_properties.lua index 831a08dbe..4382dd522 100644 --- a/scripts/entity/entity_properties.lua +++ b/scripts/entity/entity_properties.lua @@ -272,7 +272,7 @@ tr2_entity_tbl[60] = {coll = 0x01}; -- Boulder tr2_entity_tbl[61] = {coll = 0x02}; -- Disk (like dart) tr2_entity_tbl[62] = {coll = 0x00}; -- Wall-mounted disk shooter (like dartgun) tr2_entity_tbl[63] = {coll = 0x01}; -- Drawbridge -tr2_entity_tbl[64] = {coll = 0x02}; -- Slamming door +tr2_entity_tbl[64] = {coll = 0x02, func = "slamdoor"}; -- Slamming door tr2_entity_tbl[65] = {coll = 0x01}; -- Elevator tr2_entity_tbl[66] = {coll = 0x02}; -- Minisub tr2_entity_tbl[67] = {coll = 0x02, trav = 0x18}; -- Movable cubical block (pushable) @@ -285,7 +285,7 @@ tr2_entity_tbl[73] = {coll = 0x02}; -- Breakable window (mus tr2_entity_tbl[76] = {coll = 0x01}; -- Airplane propeller tr2_entity_tbl[77] = {coll = 0x02}; -- Power saw tr2_entity_tbl[78] = {coll = 0x02}; -- Overhead pulley hook -tr2_entity_tbl[79] = {coll = 0x02}; -- Sandbag / Ceiling fragments +tr2_entity_tbl[79] = {coll = 0x02, func = "fallceiling"}; -- Sandbag / Ceiling fragments tr2_entity_tbl[80] = {coll = 0x02}; -- Rolling spindle tr2_entity_tbl[81] = {coll = 0x02, func = "wallblade"}; -- Wall-mounted knife blade tr2_entity_tbl[82] = {coll = 0x02}; -- Statue with knife blade @@ -405,7 +405,7 @@ tr2_entity_tbl[253] = {coll = 0x00, hide = 0x01}; -- Fire tr2_entity_tbl[254] = {coll = 0x00}; -- Skybox tr2_entity_tbl[256] = {coll = 0x01}; -- Monk tr2_entity_tbl[257] = {coll = 0x00, hide = 0x01, func = "doorbell"} -- Door bell -tr2_entity_tbl[258] = {coll = 0x00, hide = 0x01} -- Alarm bell +tr2_entity_tbl[258] = {coll = 0x00, hide = 0x01, func = "alarmbell"} -- Alarm bell tr2_entity_tbl[259] = {coll = 0x01, func = "heli_TR2"}; -- Helicopter tr2_entity_tbl[260] = {coll = 0x02}; -- The butler tr2_entity_tbl[262] = {coll = 0x00, hide = 0x01}; -- Lara cutscene placement? @@ -500,14 +500,14 @@ tr3_entity_tbl[87] = {coll = 0x01, func = "oldspike"}; -- Spikes tr3_entity_tbl[88] = {coll = 0x01}; -- Boulder / Barrel tr3_entity_tbl[89] = {coll = 0x01}; -- Giant boulder (Temple of Puna) tr3_entity_tbl[90] = {coll = 0x01}; -- Disk (like dart) -tr3_entity_tbl[91] = {coll = 0x01}; -- Dart shooter -tr3_entity_tbl[94] = {coll = 0x01}; -- Spiked impaled skeleton / Slamming door +tr3_entity_tbl[91] = {coll = 0x01, hide = 0x01}; -- Dart shooter +tr3_entity_tbl[94] = {coll = 0x01, func = "slamdoor"}; -- Spiked impaled skeleton / Slamming door tr3_entity_tbl[97] = {coll = 0x01, trav = 0x18}; -- Movable cubical block (pushable) tr3_entity_tbl[98] = {coll = 0x01, trav = 0x18}; -- Movable cubical block (pushable) tr3_entity_tbl[101] = {coll = 0x01}; -- Destroyable boarded-up window tr3_entity_tbl[102] = {coll = 0x01}; -- Destroyable boarded-up window / wall tr3_entity_tbl[106] = {coll = 0x01}; -- Overhead pulley hook -tr3_entity_tbl[107] = {coll = 0x01}; -- Falling fragments +tr3_entity_tbl[107] = {coll = 0x01, func = "fallceiling"}; -- Falling fragments tr3_entity_tbl[108] = {coll = 0x01}; -- Rolling spindle tr3_entity_tbl[110] = {coll = 0x01}; -- Subway train tr3_entity_tbl[111] = {coll = 0x01, func = "wallblade"}; -- Wall-mounted knife blade / Knife disk @@ -568,7 +568,7 @@ tr3_entity_tbl[176] = {coll = 0x00}; -- Small medipack (pick-up) tr3_entity_tbl[177] = {coll = 0x00}; -- Large medipack (pick-up) tr3_entity_tbl[178] = {coll = 0x00}; -- Flares (pick-up) tr3_entity_tbl[179] = {coll = 0x00}; -- Flare (pick-up) -tr3_entity_tbl[180] = {coll = 0x00}; -- Savegame crystal (pick-up) +tr3_entity_tbl[180] = {coll = 0x00, func = "crystal_TR3"}; -- Savegame crystal (pick-up) -- MENU ITEMS -- diff --git a/scripts/gameflow/gameflow.lua b/scripts/gameflow/gameflow.lua index 001cbfae1..9ec9278c9 100644 --- a/scripts/gameflow/gameflow.lua +++ b/scripts/gameflow/gameflow.lua @@ -7,8 +7,6 @@ --------------------------------------------------------------------------------------------------------------------------------------- -- 1 - Define global constants --------------------------------------------------------------------------------------------------------------------------------------- -gameflow_lara_home_index = 99; -- used to load Lara's Home. - GAME_1 = 0; GAME_1_1 = 1; GAME_1_5 = 2; @@ -78,7 +76,7 @@ function getNextLevelNum(currentgame, currentlevel, operand) end; if(gameflow_paths[currentgame] ~= nil) then - if((nextlevel == gameflow_lara_home_index) and (gameflow_paths[currentgame].level[0] ~= nil)) then -- Load Lara's Home level, if exist. + if((nextlevel == 99) and (gameflow_paths[currentgame].level[0] ~= nil)) then -- Load Lara's Home level (99), if exist. nextlevel = 0; elseif(nextlevel > gameflow_paths[currentgame].numlevels) then -- No Lara's Home, load first level instead. nextlevel = 1; @@ -136,4 +134,6 @@ function setgamef(game_id, level_id) end; end; +SETGAMEF = setgamef; + print("Gameflow path script loaded"); diff --git a/scripts/trigger/trigger_functions.lua b/scripts/trigger/trigger_functions.lua index e16950d2a..cff8dda6c 100644 --- a/scripts/trigger/trigger_functions.lua +++ b/scripts/trigger/trigger_functions.lua @@ -65,6 +65,7 @@ function activateEntity(object_id, activator_id, trigger_mask, trigger_op, objec else object_mask = bit32.bor(object_mask, trigger_mask); -- Other cases end; + setEntityActivationMask(object_id, object_mask); -- Full entity mask (11111) is always a reason to activate an entity. @@ -170,4 +171,11 @@ end function playCutscene(cutscene_index) if(getLevelVersion() < TR_IV) then return 0 end; print("CUTSCENE: index = " .. cutscene_index); -end \ No newline at end of file +end + + +-- Special template which is called for specific entity types at level start-up. + +function prepareEntity(object_id) + activateEntity(object_id, 0, 0, 0, 0, 0); +end; \ No newline at end of file diff --git a/src/character_controller.cpp b/src/character_controller.cpp index 4435b89e5..ded18ee5e 100644 --- a/src/character_controller.cpp +++ b/src/character_controller.cpp @@ -233,7 +233,7 @@ int32_t Character_AddItem(struct entity_s *ent, uint32_t item_id, int32_t count) return 0; } - Gui_StartNotifier(item_id); + Gui_NotifierStart(item_id); base_item_p item = World_GetBaseItemByID(&engine_world, item_id); if(item == NULL) return 0; diff --git a/src/engine.cpp b/src/engine.cpp index 14a3738dd..d29289337 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -1408,15 +1408,7 @@ int lua_GetEntityDistance(lua_State * lua) return 0; } - btVector3 ent1_pos; ent1_pos.m_floats[0] = e1->transform[12+0]; - ent1_pos.m_floats[1] = e1->transform[12+1]; - ent1_pos.m_floats[2] = e1->transform[12+2]; - - btVector3 ent2_pos; ent2_pos.m_floats[0] = e2->transform[12+0]; - ent2_pos.m_floats[1] = e2->transform[12+1]; - ent2_pos.m_floats[2] = e2->transform[12+2]; - - lua_pushnumber(lua, btDistance(ent1_pos, ent2_pos)); + lua_pushnumber(lua, Entity_FindDistance(e1, e2)); return 1; } @@ -1599,7 +1591,10 @@ int lua_MoveEntityToSink(lua_State * lua) } entity_p ent = World_GetEntityByID(&engine_world, lua_tointeger(lua, 1)); - stat_camera_sink_p sink = &engine_world.cameras_sinks[lua_tointeger(lua, 2)]; + uint32_t sink_index = lua_tointeger(lua, 2); + + if(sink_index > engine_world.cameras_sinks_count) return 0; + stat_camera_sink_p sink = &engine_world.cameras_sinks[sink_index]; btVector3 ent_pos; ent_pos.m_floats[0] = ent->transform[12+0]; ent_pos.m_floats[1] = ent->transform[12+1]; @@ -1820,6 +1815,28 @@ int lua_CanTriggerEntity(lua_State * lua) } +int lua_GetEntityVisibility(lua_State * lua) +{ + if(lua_gettop(lua) < 1) + { + Con_Warning(SYSWARN_WRONG_ARGS, "[entity_id]"); + return 0; + } + + int id = lua_tointeger(lua, 1); + entity_p ent = World_GetEntityByID(&engine_world, id); + + if(ent == NULL) + { + Con_Warning(SYSWARN_NO_ENTITY, id); + return 0; + } + + lua_pushinteger(lua, (ent->state_flags & ENTITY_STATE_VISIBLE) != 0); + + return 1; +} + int lua_SetEntityVisibility(lua_State * lua) { if(lua_gettop(lua) < 2) @@ -1850,6 +1867,29 @@ int lua_SetEntityVisibility(lua_State * lua) } +int lua_GetEntityEnability(lua_State * lua) +{ + if(lua_gettop(lua) < 1) + { + Con_Warning(SYSWARN_WRONG_ARGS, "[entity_id]"); + return 0; + } + + int id = lua_tointeger(lua, 1); + entity_p ent = World_GetEntityByID(&engine_world, id); + + if(ent == NULL) + { + Con_Warning(SYSWARN_NO_ENTITY, id); + return 0; + } + + lua_pushinteger(lua, (ent->state_flags & ENTITY_STATE_ENABLED) != 0); + + return 1; +} + + int lua_GetEntityActivity(lua_State * lua) { if(lua_gettop(lua) < 1) @@ -2377,11 +2417,11 @@ int lua_FlashSetup(lua_State *lua) { if(lua_gettop(lua) != 6) return 0; - Gui_SetupFader(FADER_EFFECT, - (uint8_t)(lua_tointeger(lua, 1)), - (uint8_t)(lua_tointeger(lua, 2)), (uint8_t)(lua_tointeger(lua, 3)), (uint8_t)(lua_tointeger(lua, 4)), - BM_MULTIPLY, - (uint16_t)(lua_tointeger(lua, 5)), (uint16_t)(lua_tointeger(lua, 6))); + Gui_FadeSetup(FADER_EFFECT, + (uint8_t)(lua_tointeger(lua, 1)), + (uint8_t)(lua_tointeger(lua, 2)), (uint8_t)(lua_tointeger(lua, 3)), (uint8_t)(lua_tointeger(lua, 4)), + BM_MULTIPLY, + (uint16_t)(lua_tointeger(lua, 5)), (uint16_t)(lua_tointeger(lua, 6))); return 0; } @@ -2985,9 +3025,11 @@ void Engine_LuaRegisterFuncs(lua_State *lua) lua_register(lua, "setEntityCollision", lua_SetEntityCollision); lua_register(lua, "getEntityAnim", lua_GetEntityAnim); lua_register(lua, "setEntityAnim", lua_SetEntityAnim); + lua_register(lua, "getEntityVisibility", lua_GetEntityVisibility); lua_register(lua, "setEntityVisibility", lua_SetEntityVisibility); lua_register(lua, "getEntityActivity", lua_GetEntityActivity); lua_register(lua, "setEntityActivity", lua_SetEntityActivity); + lua_register(lua, "getEntityEnability", lua_GetEntityEnability); lua_register(lua, "getEntityActivityLock", lua_GetEntityActivityLock); lua_register(lua, "setEntityActivityLock", lua_SetEntityActivityLock); lua_register(lua, "getEntityOCB", lua_GetEntityOCB); @@ -3463,7 +3505,10 @@ int Engine_LoadMap(const char *name) Game_Prepare(); Render_SetWorld(&engine_world); - Fader[FADER_LOADSCREEN].Cut(); ///@FIXME: if I load custom levels with "loadMap("data/newlevel.tr4");" in autoexec.lua, load screen fader does not stop! + + Gui_FadeStart(FADER_LOADSCREEN, GUI_FADER_DIR_IN); + Gui_NotifierStop(); + return 1; } diff --git a/src/entity.cpp b/src/entity.cpp index a8de9b108..58baf14bf 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -868,6 +868,29 @@ void Entity_DoAnimCommands(entity_p entity, struct ss_animation_s *ss_anim, int } } + +room_sector_s* Entity_GetLowestSector(room_sector_s* sector) +{ + room_sector_p lowest_sector = sector; + + for(room_sector_p rs=sector;rs!=NULL;rs=rs->sector_below) + { lowest_sector = rs; } + + return lowest_sector; +} + + +room_sector_s* Entity_GetHighestSector(room_sector_s* sector) +{ + room_sector_p highest_sector = sector; + + for(room_sector_p rs=sector;rs!=NULL;rs=rs->sector_above) + { highest_sector = rs; } + + return highest_sector; +} + + void Entity_ProcessSector(struct entity_s *ent) { // Calculate both above and below sectors for further usage. @@ -876,35 +899,26 @@ void Entity_ProcessSector(struct entity_s *ent) // (e.g. first trapdoor in The Great Wall, etc.) // Sector above primarily needed for paranoid cases of monkeyswing. - room_sector_p abs_upper_sector = ent->current_sector; - room_sector_p abs_lower_sector = ent->current_sector; - - for(room_sector_p rs=ent->current_sector;rs!=NULL;rs=rs->sector_above) - { - abs_upper_sector = rs; - } - for(room_sector_p rs=ent->current_sector;rs!=NULL;rs=rs->sector_below) - { - abs_lower_sector = rs; - } + room_sector_p highest_sector = Entity_GetHighestSector(ent->current_sector); + room_sector_p lowest_sector = Entity_GetLowestSector(ent->current_sector); if(ent->character) { ent->character->height_info.walls_climb_dir = 0; - ent->character->height_info.walls_climb_dir |= abs_lower_sector->flags & (SECTOR_FLAG_CLIMB_WEST | - SECTOR_FLAG_CLIMB_EAST | - SECTOR_FLAG_CLIMB_NORTH | - SECTOR_FLAG_CLIMB_SOUTH ); + ent->character->height_info.walls_climb_dir |= lowest_sector->flags & (SECTOR_FLAG_CLIMB_WEST | + SECTOR_FLAG_CLIMB_EAST | + SECTOR_FLAG_CLIMB_NORTH | + SECTOR_FLAG_CLIMB_SOUTH ); ent->character->height_info.walls_climb = (ent->character->height_info.walls_climb_dir > 0); ent->character->height_info.ceiling_climb = 0x00; - if((abs_upper_sector->flags & SECTOR_FLAG_CLIMB_CEILING) || (abs_lower_sector->flags & SECTOR_FLAG_CLIMB_CEILING)) + if((highest_sector->flags & SECTOR_FLAG_CLIMB_CEILING) || (lowest_sector->flags & SECTOR_FLAG_CLIMB_CEILING)) { ent->character->height_info.ceiling_climb = 0x01; } - if(abs_lower_sector->flags & SECTOR_FLAG_DEATH) + if(lowest_sector->flags & SECTOR_FLAG_DEATH) { if((ent->move_type == MOVE_ON_FLOOR) || (ent->move_type == MOVE_UNDER_WATER) || @@ -924,7 +938,7 @@ void Entity_ProcessSector(struct entity_s *ent) if(lua_isfunction(engine_lua, -1)) { int top = lua_gettop(engine_lua); - lua_pushnumber(engine_lua, abs_lower_sector->trig_index); + lua_pushnumber(engine_lua, lowest_sector->trig_index); lua_pushnumber(engine_lua, ((ent->bf.animations.model->id == 0) ? TR_ACTIVATORTYPE_LARA : TR_ACTIVATORTYPE_MISC)); lua_pushnumber(engine_lua, ent->id); lua_pcall(engine_lua, 3, 1, 0); diff --git a/src/entity.h b/src/entity.h index 67a936308..de78ca849 100644 --- a/src/entity.h +++ b/src/entity.h @@ -142,4 +142,7 @@ void Entity_MoveVertical(struct entity_s *ent, btScalar dist); btScalar Entity_FindDistance(entity_p entity_1, entity_p entity_2); +room_sector_s* Entity_GetLowestSector(room_sector_s* sector); +room_sector_s* Entity_GetHighestSector(room_sector_s* sector); + #endif diff --git a/src/gui.cpp b/src/gui.cpp index d1dc4c5dc..3d9368af1 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -220,18 +220,6 @@ void Gui_InitFaders() } } -void Gui_SetupFader(int fader_index, - uint8_t alpha, uint8_t R, uint8_t G, uint8_t B, uint32_t blending_mode, - uint16_t fadein_speed, uint16_t fadeout_speed) -{ - if(fader_index >= FADER_LASTINDEX) return; - - Fader[fader_index].SetAlpha(alpha); - Fader[fader_index].SetColor(R,G,B); - Fader[fader_index].SetBlendingMode(blending_mode); - Fader[fader_index].SetSpeed(fadein_speed,fadeout_speed); -} - void Gui_InitNotifier() { Notifier.SetPos(850.0, 850.0); @@ -1411,11 +1399,16 @@ void Gui_DrawInventory() Gui_SwitchGLMode(1); } -void Gui_StartNotifier(int item) +void Gui_NotifierStart(int item) { Notifier.Start(item, GUI_NOTIFIER_SHOWTIME); } +void Gui_NotifierStop() +{ + Notifier.Reset(); +} + void Gui_DrawNotifier() { Notifier.Draw(); @@ -1614,6 +1607,18 @@ bool Gui_FadeAssignPic(int fader, const char* pic_name) return false; } +void Gui_FadeSetup(int fader, + uint8_t alpha, uint8_t R, uint8_t G, uint8_t B, uint32_t blending_mode, + uint16_t fadein_speed, uint16_t fadeout_speed) +{ + if(fader >= FADER_LASTINDEX) return; + + Fader[fader].SetAlpha(alpha); + Fader[fader].SetColor(R,G,B); + Fader[fader].SetBlendingMode(blending_mode); + Fader[fader].SetSpeed(fadein_speed,fadeout_speed); +} + int Gui_FadeCheck(int fader) { if((fader >= 0) && (fader < FADER_LASTINDEX)) diff --git a/src/gui.h b/src/gui.h index b903684f0..7d0817d2f 100644 --- a/src/gui.h +++ b/src/gui.h @@ -505,10 +505,6 @@ void Gui_InitFaders(); void Gui_InitNotifier(); void Gui_InitTempLines(); -void Gui_SetupFader(int fader_index, - uint8_t alpha, uint8_t R, uint8_t G, uint8_t B, uint32_t blending_mode, - uint16_t fadein_speed, uint16_t fadeout_speed); - void Gui_AddLine(gui_text_line_p line); void Gui_DeleteLine(gui_text_line_p line); void Gui_MoveLine(gui_text_line_p line); @@ -764,11 +760,15 @@ bool Gui_FadeStart(int fader, int fade_direction); bool Gui_FadeStop(int fader); bool Gui_FadeAssignPic(int fader, const char* pic_name); int Gui_FadeCheck(int fader); +void Gui_FadeSetup(int fader, + uint8_t alpha, uint8_t R, uint8_t G, uint8_t B, uint32_t blending_mode, + uint16_t fadein_speed, uint16_t fadeout_speed); /** - * Initialize item notifier. + * Item notifier functions. */ -void Gui_StartNotifier(int item); +void Gui_NotifierStart(int item); +void Gui_NotifierStop(); /** * General GUI drawing routines. diff --git a/src/resource.cpp b/src/resource.cpp index eef5c77f9..d82221614 100644 --- a/src/resource.cpp +++ b/src/resource.cpp @@ -957,7 +957,7 @@ int TR_Sector_TranslateFloorData(room_sector_p sector, class VT_Level *tr) break; case TR_ACTIVATOR_PICKUP: - snprintf(buf, 256, " if((getEntityActivity(%d) == 0) and (getEntitySectorStatus(%d) == 0)) then \n setEntitySectorStatus(%d, 1); \n", operands, operands, operands); + snprintf(buf, 256, " if((getEntityEnability(%d) == 0) and (getEntitySectorStatus(%d) == 0)) then \n setEntitySectorStatus(%d, 1); \n", operands, operands, operands); break; } @@ -1936,9 +1936,6 @@ void TR_GenWorld(struct world_s *world, class VT_Level *tr) Room_Disable(r); } } - - // Set loadscreen fader to fade-in state. - Gui_FadeStart(FADER_LOADSCREEN, GUI_FADER_DIR_IN); } diff --git a/src/world.cpp b/src/world.cpp index 9ec16b206..a7e655ecf 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -1124,37 +1124,21 @@ void Room_SwapToBase(room_p room) Room_Disable(room); //Disable current room Room_Disable(room->base_room); //Paranoid Room_SwapPortals(room, room->base_room); //Update portals to match this room + Room_SwapItems(room, room->base_room); //Update items to match this room Room_Enable(room->base_room); //Enable original room } - else if((room->alternate_room != NULL) && (room->active == 0)) //If room is inactive base room - { - Render_CleanList(); - Room_Disable(room); //Paranoid - Room_Disable(room->alternate_room); //Disable alternate room - Room_SwapPortals(room->alternate_room, room); //Update portals to match this room - Room_SwapItems(room->alternate_room, room); //Update items to match this room - Room_Enable(room); //Enable base room - } } void Room_SwapToAlternate(room_p room) { - if((room->base_room != NULL) && (room->active == 0)) //If room is inactive alternate room - { - Render_CleanList(); - Room_Disable(room); //Paranoid - Room_Disable(room->base_room); //Disable base room - Room_SwapPortals(room->base_room, room); //Update portals to match this room - Room_Enable(room); //Enable alternate room - } - else if((room->alternate_room != NULL) && (room->active == 1)) //If room is active base room + if((room->alternate_room != NULL) && (room->active == 1)) //If room is active base room { Render_CleanList(); Room_Disable(room); //Disable current room Room_Disable(room->alternate_room); //Paranoid Room_SwapPortals(room, room->alternate_room); //Update portals to match this room - Room_SwapItems(room, room->alternate_room); //Update items to match this room - Room_Enable(room); //Enable base room + Room_SwapItems(room, room->alternate_room); //Update items to match this room + Room_Enable(room->alternate_room); //Enable base room } } diff --git a/src/world.h b/src/world.h index f451cfb6d..03571dea8 100644 --- a/src/world.h +++ b/src/world.h @@ -400,8 +400,8 @@ void Room_Disable(room_p room); void Room_SwapToAlternate(room_p room); void Room_SwapToBase(room_p room); room_p Room_CheckFlip(room_p r); -void Room_SwapPortals(room_p room, room_p dest_room);//Swap room portals of input room to destination room -void Room_SwapItems(room_p room, room_p dest_room);//Swap room items of input room to destination room +void Room_SwapPortals(room_p room, room_p dest_room); //Swap room portals of input room to destination room +void Room_SwapItems(room_p room, room_p dest_room); //Swap room items of input room to destination room void Room_BuildNearRoomsList(room_p room); int Room_IsJoined(room_p r1, room_p r2);