Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

очередной фикс титров #447

Merged
merged 10 commits into from
Oct 16, 2023
2 changes: 1 addition & 1 deletion code/controllers/subsystem/SSticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ SUBSYSTEM_DEF(ticker)
for(var/datum/team/team in GLOB.antagonist_teams)
team.on_round_end()

SScredits.roll_credits_for_all_clients() // SS220 ADDITION
play_cinematic(/datum/cinematic/credits, world)

// Display the scoreboard window
score.scoreboard()
Expand Down
1 change: 1 addition & 0 deletions modular_ss220/_defines220/_defines220.dme
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
#include "code/cult_defines_ss220.dm"
#include "code/hud_ss220.dm"
#include "code/layers_ss220.dm"
#include "code/signals_cinematic.dm"
1 change: 1 addition & 0 deletions modular_ss220/_defines220/code/signals_cinematic.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define COMSIG_GLOB_CINEMATIC_STOPPED_PLAYING "!cinematic_waiting_to_play"
Legendaxe marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions modular_ss220/cinematics/_cinematics.dme
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
#include "code/cinematics/malf_doomsday.dm"
#include "code/cinematics/narsie_summon.dm"
#include "code/cinematics/nuke_cinematics.dm"
#include "code/cinematics/credits.dm"
2 changes: 2 additions & 0 deletions modular_ss220/cinematics/code/_cinematics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@

qdel(src)

SEND_GLOBAL_SIGNAL(COMSIG_GLOB_CINEMATIC_STOPPED_PLAYING, null)

/// Locks a mob, preventing them from moving, being hurt, or acting
/datum/cinematic/proc/lock_mob(mob/to_lock)
locked += to_lock
Expand Down
32 changes: 32 additions & 0 deletions modular_ss220/cinematics/code/cinematics/credits.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/datum/cinematic/credits
cleanup_time = 20 SECONDS
is_global = TRUE

/datum/cinematic/credits/New(watcher, datum/callback/special_callback)
. = ..()
screen = new/obj/screen/cinematic/credits(src)

/datum/cinematic/credits/start_cinematic(list/watchers)
watching = watchers
if(SEND_GLOBAL_SIGNAL(COMSIG_GLOB_PLAY_CINEMATIC, src) & COMPONENT_GLOB_BLOCK_CINEMATIC)
RegisterSignal(SSdcs, COMSIG_GLOB_CINEMATIC_STOPPED_PLAYING, PROC_REF(queue_gone))
return
. = ..()

/datum/cinematic/credits/proc/queue_gone(datum/source, datum/cinematic/other)
SIGNAL_HANDLER

start_cinematic(src.watching)

/datum/cinematic/credits/play_cinematic()
play_cinematic_sound(sound(SScredits.title_music))
SScredits.roll_credits_for_clients(watching)

special_callback?.Invoke()

/obj/screen/cinematic/credits
icon = 'icons/mob/screen_gen.dmi'
icon_state = "black"
screen_loc = "WEST,SOUTH to EAST,NORTH"
plane = SPLASHSCREEN_PLANE

41 changes: 14 additions & 27 deletions modular_ss220/credits/code/SScredits.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#define CREDITS_BACKGROUND_PLANE 25
#define CREDITS_PLANE 26

SUBSYSTEM_DEF(credits)
Expand All @@ -17,27 +16,20 @@ SUBSYSTEM_DEF(credits)
credit_animate_height = 14 * world.icon_size
title_music = pick(file2list("config/credits/sounds/title_music.txt"))

/datum/controller/subsystem/credits/proc/roll_credits_for_all_clients()
for(var/client/client in GLOB.clients)
/datum/controller/subsystem/credits/proc/roll_credits_for_clients(list/clients)
if(!length(end_titles))
end_titles = generate_titles()

for(var/client/client in clients)
SScredits.roll_credits(client)

/datum/controller/subsystem/credits/proc/roll_credits(client/client)
LAZYINITLIST(client.credits)

if(end_titles)
end_titles = generate_titles()

addtimer(CALLBACK(src, PROC_REF(roll_credits_for_client), client), 30 SECONDS, TIMER_CLIENT_TIME)

/datum/controller/subsystem/credits/proc/roll_credits_for_client(client/client)
var/list/_credits = client.credits

if(client.mob)
client.mob.overlay_fullscreen("black",/obj/screen/fullscreen/black)
SEND_SOUND(client, sound(title_music, repeat = FALSE, wait = FALSE, volume = 85 * client.prefs.get_channel_volume(CHANNEL_LOBBYMUSIC), channel = CHANNEL_LOBBYMUSIC))

for(var/item in end_titles)
if(!client.credits)
if(!client?.credits)
return
var/obj/screen/credit/title = new(null, item, client)
_credits += title
Expand All @@ -47,9 +39,9 @@ SUBSYSTEM_DEF(credits)
addtimer(CALLBACK(src, PROC_REF(clear_credits), client), (credit_roll_speed), TIMER_CLIENT_TIME)

/datum/controller/subsystem/credits/proc/clear_credits(client/client)
if(!client)
return
QDEL_NULL(client.credits)
client.mob.clear_fullscreen("black")
SEND_SOUND(client, sound(null, repeat = FALSE, wait = FALSE, volume = 85 * client.prefs.get_channel_volume(CHANNEL_LOBBYMUSIC), channel = CHANNEL_LOBBYMUSIC))

/datum/controller/subsystem/credits/proc/generate_titles()
RETURN_TYPE(/list)
Expand Down Expand Up @@ -151,26 +143,19 @@ SUBSYSTEM_DEF(credits)

return titles


/obj/screen/fullscreen/black
icon = 'icons/mob/screen_gen.dmi'
icon_state = "black"
screen_loc = "WEST,SOUTH to EAST,NORTH"
plane = CREDITS_BACKGROUND_PLANE
show_when_dead = TRUE


/obj/screen/credit
icon_state = "blank"
mouse_opacity = 0
alpha = 0
screen_loc = "CENTER-7,CENTER-7"
plane = CREDITS_PLANE
var/client/parent

var/matrix/target
var/client/parent

/obj/screen/credit/Initialize(mapload, credited, client/client)
. = ..()

parent = client
maptext = {"<div style="font:'Small Fonts'">[credited]</div>"}
maptext_height = world.icon_size * 2
Expand All @@ -196,7 +181,9 @@ SUBSYSTEM_DEF(credits)
parent = null
return ..()




/client/var/list/credits

#undef CREDITS_PLANE
#undef CREDITS_BACKGROUND_PLANE
Loading