QB.WPC source code

THUG+ discussions can go here, about modding, or what ever you want
Post Reply
Catarax
VIP
Posts: 132
Joined: Sat Oct 25, 2014 6:50 pm

QB.WPC source code

Post by Catarax » Fri Jan 13, 2017 10:14 am

Hello,

Is it possible to get the entire source code of a THAW qb.wpc? Can't find the option in Queen Bee.
Thanks.

%.gone.
Global Moderator
Posts: 390
Joined: Sun Mar 07, 2010 5:12 pm

Re: QB.WPC source code

Post by %.gone. » Fri Jan 13, 2017 6:11 pm

Queenbee by default can't do it. Queenbee doesn't decompile into text form either.
You can export a section script and add these bytes to the very beginning of the exported script to allow blubs tool to stop when decompiling.
012316FFFFFFFF
That gives the script a starting script token.
Note, many scripts also have instruction 0x4A which blubs tool cannot handle.
If there's a specific qb file you want converted and not an entire pak let me know.

Catarax
VIP
Posts: 132
Joined: Sat Oct 25, 2014 6:50 pm

Re: QB.WPC source code

Post by Catarax » Mon Jan 16, 2017 5:39 pm

Ok.
I would like a conversion of soundoptions.qb of THE MOD, thanks!

%.gone.
Global Moderator
Posts: 390
Joined: Sun Mar 07, 2010 5:12 pm

Re: QB.WPC source code

Post by %.gone. » Tue Jan 17, 2017 1:09 am

scripts#game#menu#soundoptions.pre.qb

Code: Select all

	current_soundtrack = #"0xFFFFFFFF"
	script launch_sound_options_menu
		if GotParam {
				from_options
			}
			create_sound_options_menu {
				from_options
			}
		else
			if GotParam {
					from_parked
				}
				create_sound_options_menu {
					from_parked
				}
			else
				create_sound_options_menu
			endif
		endif
	endscript
	script create_sound_options_menu
		SetMusicVolume MusicVolOutsideBox
		make_label_menu {
			menu_id = menu_sound
			vmenu_id = vmenu_sound
			title = "SOUND OPTIONS"
			title_pos = (30.0,30.0)
			title_rotation = 0
			pos = (55.0,95.0)
			spacing = 3
		}
		if InFrontend
			PauseMusic 0
		endif
		create_helper_text {
			helper_text_elements = [
				{text = "\b7/\b4 = Select"}
				{text = "\b6/\b5 = Adjust Levels"}
				{text = "\m1 = Back"}
				{text = "\m0 = Accept"}
			]
		}
		if GotParam from_parked
			flag = from_parked
		else
			flag = ""
		endif
		SetScreenElementProps {
			id = vmenu_sound
			event_handlers = [
				{pad_back generic_menu_pad_back params = {callback = sound_options_exit <flag>}}
			]
		}
		if GetGlobalFlag flag = SOUNDS_SONGORDER_RANDOM
			song_text = "Random"
		else
			song_text = "In Order"
		endif
		if IsTrue ForceAmbientSFXToMusicVolume
			sound_override = not_focusable
			song_text = "Level Music!"
		endif
		add_label_menu_item {
			id = menu_song_order
			text = "SONGS:"
			extra_text = <song_text>
			rot = -2
			padding = 20
			text_offset = (0.0,0.0)
			<sound_override>
			option_arrows
			option_arrows_callback = toggle_song_order
		}
		add_label_menu_item {
			id = menu_skip_track
			text = "SKIP TRACK"
			rot = 1
			length = 170
			label_offset = (-15.0,0.0)
			text_offset = (-5.0,0.0)
			focus_script = skip_track_focus
			unfocus_script = skip_track_unfocus
			pad_choose_script = skip_track
			<sound_override>
		}
		if (isxbox)
			if NOT (DEMO_BUILD)
				add_label_menu_item {
					id = menu_soundtrack
					text = "SOUNDTRACK"
					rot = -1
					length = 180
					text_offset = (-10.0,0.0)
					pad_choose_script = create_soundtrack_menu
					<sound_override>
				}
			endif
		endif
		if NOT inNetGame
			if (current_soundtrack = #"0xFFFFFFFF")
				flag = ""
			else
				flag = not_focusable
			endif
			add_label_menu_item {
				id = menu_playlist
				text = "DEMOLITION RADIO"
				rot = 0
				length = 140
				text_offset = (0.0,0.0)
				padding = 30
				pad_choose_script = create_playlist_menu
				<sound_override>
				<flag>
			}
		endif
		value = (MusicVolOutsideBox / 10)
		displayvalue = <value>
		CastToInteger displayvalue
		FormatText TextName = cdvol "%v" v = <displayvalue>
		add_label_menu_item {
			id = menu_music_level
			text = "MUSIC LEVEL:"
			extra_text = <cdvol>
			rot = -1
			padding = 40
			text_offset = (-15.0,0.0)
			focus_script = menu_music_special_focus
			unfocus_script = menu_music_special_unfocus
			option_arrows
			option_arrows_callback = menu_alter_music
		}
		menu_music_level::menu_alter_music
		GetValueFromVolume sfxvol
		FormatText TextName = sfxvol "%v" v = <value>
		add_label_menu_item {
			id = menu_sound_level
			text = "SOUND LEVEL:"
			extra_text = <sfxvol>
			rot = 1
			length = 288
			label_offset = (-25.0,0.0)
			text_offset = (10.0,0.0)
			focus_script = label_menu_item_focus
			unfocus_script = label_menu_item_unfocus
			option_arrows
			option_arrows_callback = menu_alter_sound
		}
		menu_sound_level::menu_alter_sound
		if GetGlobalFlag flag = SOUNDS_SPECIALSOUNDS_OFF
			sounds_specialsounds = "OFF"
		else
			sounds_specialsounds = "ON"
		endif
		add_label_menu_item {
			id = menu_sound_special
			text = "SPECIAL SOUNDS:"
			extra_text = <sounds_specialsounds>
			rot = 0
			padding = 40
			label_offset = (15.0,0.0)
			text_offset = (-5.0,0.0)
			focus_script = label_menu_item_focus
			unfocus_script = label_menu_item_unfocus
			option_arrows
			option_arrows_callback = toggle_special_sounds
		}
		if GetGlobalFlag flag = SOUNDS_MUSICBOXES_OFF
			sounds_music_boxes = "OFF"
		else
			sounds_music_boxes = "ON"
		endif
		add_label_menu_item {
			id = menu_sound_zones
			text = "MUSIC ZONES:"
			extra_text = <sounds_music_boxes>
			rot = -1
			padding = 40
			label_offset = (-5.0,0.0)
			text_offset = (-10.0,0.0)
			focus_script = label_menu_item_focus
			unfocus_script = label_menu_item_unfocus
			option_arrows
			option_arrows_callback = toggle_music_zones
		}
		Theme_GetHighlightedTextColor return_value = checkmark_rgba
		Theme_GetUnhighlightedTextColor return_value = checkbox_rgba
		if GotParam from_options
			params = from_options
		else
			if GotParam from_parked
				params = from_parked
			else
				params = ""
			endif
		endif
		add_label_menu_item {
			id = menu_done
			text = "DONE"
			rot = 2
			length = 110
			label_offset = (10.0,0.0)
			text_offset = (0.0,0.0)
			pad_choose_script = sound_options_exit
			pad_choose_params = {<params>}
		}
		add_music_track_text
		if InFrontend
		else
			PauseMusic
		endif
		label_menu_finish
	endscript
	script GetTracksEnabled
		<num_enabled> = 0
		GetArraySize {
			playlist_tracks
		}
		index = 0
		while
			if TrackEnabled <index>
				<num_enabled> = (<num_enabled> + 1)
				break
			endif
			index = (<index> + 1)
		repeat <array_size>
		return num_enabled = <num_enabled>
	endscript
	script add_music_track_text parent = current_menu_anchor pos = (575.0,320.0)
		if NOT (current_soundtrack = #"0xFFFFFFFF")
			return
		endif
		GetTracksEnabled
		if (<num_enabled> = 0)
			return
		endif
		if InFrontend
			pos = (575.0,320.0)
		endif
		GetCurrentTrack
		if (<current_track> = 999)
			return
		endif
		if NOT TrackEnabled <current_track>
			return
		endif
		CreateScreenElement {
			type = containerElement
			parent = <parent>
			id = music_track_anchor
			pos = <pos>
			dims = (0.0,0.0)
		}
		current_genre = (playlist_genres[(playlist_tracks[<current_track>].genre)])
		current_band_text = ((playlist_tracks[<current_track>]).band)
		FormatText TextName = current_track_text "''%t''" t = ((playlist_tracks[<current_track>]).track_title)
		Theme_GetHighlightedTextColor return_value = on_rgba
		Theme_GetUnhighlightedTextColor return_value = off_rgba
		CreateScreenElement {
			type = textElement
			parent = music_track_anchor
			id = music_band_text
			text = <current_band_text>
			font = testtitle
			just = [right center]
			scale = (1.0,1.0)
			pos = (36.0,35.0)
			rgba = [0 94 116 128]
			alpha = 0.80000001
			z_priority = 1
		}
		GetScreenElementDims id = music_band_text
		if (<width> > 240)
			<scale> = (240.0 / <width>)
			DoScreenElementMorph id = music_band_text time = 0 scale = <scale>
		endif
		CreateScreenElement {
			type = textElement
			parent = music_track_anchor
			id = music_track_text
			text = <current_track_text>
			font = dialog
			just = [right center]
			scale = (1.0,1.0)
			pos = (36.0,52.0)
			rgba = [0 94 116 128]
			alpha = 0.80000001
			z_priority = 2
		}
		GetScreenElementDims id = music_track_text
		if (<width> > 240)
			<scale> = (240.0 / <width>)
			DoScreenElementMorph id = music_track_text time = 0 scale = <scale>
		endif
		CreateScreenElement {
			type = textElement
			parent = music_track_anchor
			id = music_track_genre
			text = <current_genre>
			font = small
			just = [right top]
			scale = (0.80000001,0.60000002)
			pos = (32.0,58.0)
			rgba = [0 0 0 128]
			alpha = 0.80000001
			z_priority = 3
		}
		CreateScreenElement {
			type = spriteElement
			parent = music_track_anchor
			texture = kyron
			just = [center center]
			scale = (4.30000019,1.10000002)
			pos = (-84.0,47.0)
			rgba = [128 128 128 128]
			rot_angle = 0
			z_priority = -1
		}
		if IsTrue ForceAmbientSFXToMusicVolume
			DoScreenElementMorph id = music_track_anchor alpha = 0
		endif
	endscript
	script spawn_update_music_track_text
		if ScreenElementExists {
				id = music_track_anchor
			}
			RunScriptOnScreenElement id = music_track_anchor update_music_track_text params = {<...>}
		endif
	endscript
	script update_music_track_text
		if ScreenElementExists id = music_track_anchor
			if IsTrue ForceAmbientSFXToMusicVolume
				DoScreenElementMorph id = music_track_anchor alpha = 0
			endif
			GetScreenElementPosition id = music_track_anchor
			old_pos = <ScreenElementPos>
			generic_menu_animate_out force menu = music_track_anchor
		else
			return
		endif
		if NOT GotParam current_track
			wait 2.5 seconds
			GetCurrentTrack
		endif
		if NOT IsTrue ForceAmbientSFXToMusicVolume
			DoScreenElementMorph id = music_track_anchor alpha = 1
		endif
		current_band_text = ((playlist_tracks[<current_track>]).band)
		current_genre = (playlist_genres[(playlist_tracks[<current_track>].genre)])
		FormatText TextName = current_track_text "''%t''" t = ((playlist_tracks[<current_track>]).track_title)
		if ScreenElementExists id = music_band_text
			SetScreenElementProps id = music_band_text text = <current_band_text>
			SetScreenElementProps id = music_track_text text = <current_track_text>
			SetScreenElementProps id = music_track_genre text = <current_genre>
		endif
		DoScreenElementMorph id = music_band_text time = 0 scale = 1.0
		GetScreenElementDims id = music_band_text
		if (<width> > 240)
			<scale> = (240.0 / <width>)
			DoScreenElementMorph id = music_band_text time = 0 scale = <scale>
		endif
		DoScreenElementMorph id = music_track_text time = 0 scale = 1.0
		GetScreenElementDims id = music_track_text
		if (<width> > 240)
			<scale> = (240.0 / <width>)
			DoScreenElementMorph id = music_track_text time = 0 scale = <scale>
		endif
		if ScreenElementExists id = music_track_anchor
			generic_menu_animate_in force menu = music_track_anchor pos = <old_pos>
		endif
	endscript
	script sound_options_exit
		KillSpawnedScript name = shake_projector
		if ScreenElementExists id = current_menu_anchor
			DestroyScreenElement id = current_menu_anchor
		endif
		if GotParam just_remove
			return
		endif
		SFX_Music_Volume_Box_Restore_State sound_options
		if (FadeMusicOutRunning = 1)
			SetMusicVolume 0
		endif
		if (FadeMusicInRunning = 1)
			SetMusicVolume MusicVolOutsideBox
		endif
		if NOT InFrontend
			PauseMusic 1
			if GotParam from_parked
				parked_setup_test_play_menu
			else
				create_options_menu
			endif
		else
			PauseMusic 0
			create_gamesettings_menu
		endif
	endscript
	script toggle_song_order
		if NOT GetGlobalFlag {
				flag = SOUNDS_SONGORDER_RANDOM
			}
			SetScreenElementProps {
				id = {
					menu_song_order
					child = extra_text
				}
				text = "Random"
			}
			PlaySongsRandomly
			SetGlobalFlag {
				flag = SOUNDS_SONGORDER_RANDOM
			}
		else
			SetScreenElementProps {
				id = {
					menu_song_order
					child = extra_text
				}
				text = "In Order"
			}
			PlaySongsInOrder
			UnsetGlobalFlag {
				flag = SOUNDS_SONGORDER_RANDOM
			}
		endif
	endscript
	script toggle_special_sounds
		if NOT GetGlobalFlag {
				flag = SOUNDS_SPECIALSOUNDS_OFF
			}
			SetGlobalFlag {
				flag = SOUNDS_SPECIALSOUNDS_OFF
			}
			SetScreenElementProps {
				id = {
					menu_sound_special
					child = extra_text
				}
				text = "OFF"
			}
		else
			UnsetGlobalFlag {
				flag = SOUNDS_SPECIALSOUNDS_OFF
			}
			PlaySound {
				HUD_specialtrickAA
			}
			SetScreenElementProps {
				id = {
					menu_sound_special
					child = extra_text
				}
				text = "ON"
			}
		endif
	endscript
	script toggle_music_zones
		if NOT GetGlobalFlag {
				flag = SOUNDS_MUSICBOXES_OFF
			}
			SetGlobalFlag {
				flag = SOUNDS_MUSICBOXES_OFF
			}
			change {
				music_was_paused = 0
			}
			SetScreenElementProps {
				id = {
					menu_sound_zones
					child = extra_text
				}
				text = "OFF"
			}
		else
			UnsetGlobalFlag {
				flag = SOUNDS_MUSICBOXES_OFF
			}
			SetScreenElementProps {
				id = {
					menu_sound_zones
					child = extra_text
				}
				text = "ON"
			}
		endif
		if NOT InFrontend
			root_window::SetTags {
				need_music_zone_refresh
			}
		endif
	endscript
	script menu_alter_music
		GetTags
		value = (MusicVolOutsideBox / 10)
		CastToInteger value
		left_rgba = [128 128 128 128]
		right_rgba = [128 128 128 128]
		if GotParam left
			if (<value> > 0)
				<value> = (<value> - 1)
			endif
			sound_options_set_level level = <value> id = menu_music_level type = cdvol
			if (<value> = 0)
				set_music_ambient_state
			endif
		else
			if GotParam right
				if (<value> < 10)
					<value> = (<value> + 1)
				endif
				sound_options_set_level level = <value> id = menu_music_level type = cdvol
				if (<value> = 1)
					set_music_ambient_state
				endif
			endif
		endif
		if (<value> = 0)
			left_rgba = [128 128 128 0]
		else
			if (<value> = 10)
				right_rgba = [128 128 128 0]
			endif
		endif
		SetScreenElementProps {
			id = {menu_music_level child = arrow_left}
			rgba = <left_rgba>
		}
		SetScreenElementProps {
			id = {menu_music_level child = arrow_right}
			rgba = <right_rgba>
		}
	endscript
	script menu_alter_sound
		GetTags
		GetValueFromVolume sfxvol
		left_rgba = [128 128 128 128]
		right_rgba = [128 128 128 128]
		if GotParam left
			if (<value> > 0)
				<value> = (<value> - 1)
				PlaySound SK6_Menu_Horizontal vol = 70
			endif
		else
			if GotParam right
				if (<value> < 10)
					<value> = (<value> + 1)
					PlaySound SK6_Menu_Horizontal vol = 70
				endif
			endif
		endif
		sound_options_set_level level = <value> id = menu_sound_level type = sfxvol
		if (<value> = 0)
			left_rgba = [128 128 128 0]
		else
			if (<value> = 10)
				right_rgba = [128 128 128 0]
			endif
		endif
		SetScreenElementProps {
			id = {menu_sound_level child = arrow_left}
			rgba = <left_rgba>
		}
		SetScreenElementProps {
			id = {menu_sound_level child = arrow_right}
			rgba = <right_rgba>
		}
	endscript
	script menu_music_special_focus
		if NOT InFrontend
			PauseMusic {
				0
			}
		endif
		label_menu_item_focus <...>
	endscript
	script menu_music_special_unfocus
		label_menu_item_unfocus <...>
		if NOT InFrontend
			PauseMusic {
				1
			}
		endif
	endscript
	script skip_track_focus
		if NOT InFrontend
			PauseMusic {
				0
			}
		endif
		label_menu_item_focus <...>
	endscript
	script skip_track_unfocus
		label_menu_item_unfocus <...>
		if NOT InFrontend
			PauseMusic {
				1
			}
		endif
	endscript
	script sound_options_set_level
		FormatText TextName = vol "%v" v = <level>
		if GotParam {
				id
			}
			SetScreenElementProps {
				id = {<id> child = extra_text}
				text = <vol>
			}
		endif
		<level> = (<level> * 10)
		switch <type>
			case cdvol
				SetMusicVolume <level>
				change MusicVolOutsideBox = <level>
				change FadeTempMusicVol = <level>
			case sfxvol
				SetSfxVolume <level>
		endswitch
	endscript
	script skip_track
		skiptrack
	endscript
	script pulse_item
		DoMorph {
			time = 0.05
			scale = 0.89999998
		}
		DoMorph {
			time = 0.05
			scale = 1.0
		}
	endscript
	script create_playlist_menu
		if InFrontend
			PauseMusic 1
		endif
		Theme_GetHighlightedTextColor return_value = on_rgba
		if ObjectExists id = current_menu_anchor
			DestroyScreenElement id = current_menu_anchor
		endif
		SetScreenElementLock id = root_window off
		CreateScreenElement {
			type = containerElement
			parent = root_window
			id = playlist_bg_anchor
			dims = (640.0,480.0)
			pos = (320.0,240.0)
		}
		CreateScreenElement {
			type = spriteElement
			parent = playlist_bg_anchor
			texture = sirius_logo
			pos = (110.0,62.0)
			scale = (1.39999998,0.80000001)
			z_priority = 9
			rgba = [100 100 100 128]
		}
		CreateScreenElement {
			type = spriteElement
			parent = playlist_bg_anchor
			texture = white2
			pos = (10.0,62.0)
			scale = (6.0,6.4000001)
			z_priority = 9
			rgba = [100 100 100 128]
		}
		AssignAlias id = playlist_bg_anchor alias = current_menu_anchor
		create_helper_text {helper_text_elements = [{text = "\b7/\b4 = Select"}
				{text = "\m1 = Back"}
				{text = "\b3 = Toggle"}
				{text = "\me = Preview Track"}
			]
		}
		kill_start_key_binding
		if InFrontend
			build_theme_sub_title title = "DEMOLITION RADIO" no_grad_bar
		else
			build_theme_sub_title title = "DEMOLITION RADIO"
		endif
		CreateScreenElement {
			type = containerElement
			parent = playlist_bg_anchor
			id = playlist_menu
			dims = (640.0,480.0)
			pos = (320.0,620.0)
		}
		theme_background width = 7.0 pos = (320.0,85.0) num_parts = 10.5 parent = playlist_menu
		CreateScreenElement {
			type = containerElement
			parent = playlist_menu
			id = playlist_top_anchor
			dims = (640.0,480.0)
			pos = (320.0,240.0)
		}
		CreateScreenElement {
			type = spriteElement
			parent = playlist_menu
			texture = white2
			scale = (71.0,6.0)
			pos = (36.0,90.0)
			rgba = [0 0 0 128]
			alpha = 0.80000001
			just = [left top]
		}
		CreateScreenElement {
			type = spriteElement
			parent = playlist_top_anchor
			id = left_arrow
			texture = left_arrow
			pos = (55.0,113.0)
			just = [right center]
			z_priority = 50
		}
		CreateScreenElement {
			type = spriteElement
			parent = playlist_top_anchor
			id = right_arrow
			texture = right_arrow
			pos = (580.0,113.0)
			just = [left center]
			z_priority = 5
		}
		CreateScreenElement {
			type = hmenu
			parent = playlist_top_anchor
			id = playlist_hmenu
			pos = (320.0,140.0)
			event_handlers = [{pad_down focus_playlist_vmenu}
				{pad_back generic_menu_pad_back params = {callback = exit_playlist_menu}}
				{pad_left generic_menu_scroll_sideways_sound params = {}}
				{pad_right generic_menu_scroll_sideways_sound params = {}}
				{pad_left set_which_arrow params = {arrow = left_arrow}}
				{pad_right set_which_arrow params = {arrow = right_arrow}}
			]
		}
		playlist_hmenu_add_item {text = "Punk" genre = 0}
		playlist_hmenu_add_item {text = "Hip Hop" genre = 1}
		playlist_hmenu_add_item {text = "Rock/Other" genre = 2}
		CreateScreenElement {
			type = spriteElement
			parent = playlist_menu
			texture = white2
			scale = (71.0,0.80000001)
			pos = (36.0,130.0)
			rgba = [0 58 73 108]
			just = [left top]
			z_priority = 4
		}
		CreateScreenElement {
			type = spriteElement
			parent = playlist_menu
			texture = white2
			scale = (71.0,0.05)
			pos = (36.0,138.0)
			rgba = [0 58 73 128]
			just = [left top]
			z_priority = 4
		}
		CreateScreenElement {
			type = spriteElement
			parent = playlist_menu
			texture = white2
			scale = (71.0,0.60000002)
			pos = (36.0,160.0)
			rgba = [0 58 73 108]
			just = [left top]
			z_priority = 4
		}
		CreateScreenElement {
			type = spriteElement
			parent = playlist_menu
			texture = white2
			scale = (71.0,0.60000002)
			pos = (36.0,370.0)
			rgba = [0 58 73 108]
			just = [left top]
			z_priority = 4
		}
		CreateScreenElement {
			type = spriteElement
			parent = playlist_menu
			texture = white2
			scale = (71.0,3.0)
			pos = (36.0,138.0)
			rgba = [0 0 0 128]
			alpha = 0.80000001
			just = [left top]
			z_priority = 2
		}
		CreateScreenElement {
			type = containerElement
			parent = playlist_menu
			id = playlist_bottom_anchor
			dims = (640.0,480.0)
			pos = (320.0,240.0)
			alpha = 0.5
		}
		CreateScreenElement {
			type = textElement
			parent = playlist_bottom_anchor
			text = "Band"
			font = dialog
			scale = 1
			rgba = [2 103 123 128]
			pos = (75.0,150.0)
		}
		CreateScreenElement {
			type = textElement
			parent = playlist_bottom_anchor
			text = "Song"
			font = dialog
			scale = 1
			rgba = [2 103 123 128]
			pos = (265.0,150.0)
		}
		CreateScreenElement {
			type = textElement
			parent = playlist_bottom_anchor
			text = "Genre"
			font = dialog
			scale = 1
			rgba = [2 103 123 128]
			pos = (505.0,150.0)
		}
		CreateScreenElement {
			type = spriteElement
			parent = playlist_bottom_anchor
			id = view_gaps_menu_up_arrow
			texture = up_arrow
			pos = (320.0,142.0)
			just = [left top]
			z_priority = 5
		}
		CreateScreenElement {
			type = spriteElement
			parent = playlist_bottom_anchor
			id = view_gaps_menu_down_arrow
			texture = down_arrow
			pos = (320.0,370.0)
			just = [left top]
			z_priority = 3
		}
		CreateScreenElement {
			type = VScrollingMenu
			parent = playlist_bottom_anchor
			id = playlist_scrolling_menu
			dims = (640.0,200.0)
			pos = (320.0,180.0)
			just = [center top]
			internal_just = [center top]
		}
		CreateScreenElement {
			type = VMenu
			parent = playlist_scrolling_menu
			id = playlist_vmenu
			pos = (0.0,0.0)
			just = [left top]
			internal_just = [left top]
			dont_allow_wrap
			event_handlers = [
				{pad_up focus_playlist_hmenu}
				{pad_up set_which_arrow params = {arrow = view_gaps_menu_up_arrow}}
				{pad_down set_which_arrow params = {arrow = view_gaps_menu_down_arrow}}
				{pad_back generic_menu_pad_back params = {callback = exit_playlist_menu}}
				{pad_up generic_menu_up_or_down_sound params = {up}}
				{pad_down generic_menu_up_or_down_sound params = {down}}
			]
		}
		AssignAlias id = playlist_vmenu alias = current_menu
		kill_start_key_binding
		add_tracks_to_menu
		wait 2 gameframes
		SetScreenElementProps id = playlist_scrolling_menu reset_window_top
		if InFrontend
			end_pos = (320.0,222.0)
		endif
		finish_themed_sub_menu menu = playlist_menu end_pos = <end_pos>
		FireEvent type = focus target = playlist_hmenu
	endscript
	script exit_playlist_menu
		if ObjectExists {
				id = current_menu_anchor
			}
			DestroyScreenElement {
				id = current_menu_anchor
			}
		endif
		if GotParam {
				from_options
			}
			create_sound_options_menu {
				from_options
			}
		else
			create_sound_options_menu
		endif
	endscript
	script add_tracks_to_menu
		GetArraySize {
			playlist_tracks
		}
		index = 0
		while
			if ((<index> = locked_track1) || (<index> = locked_track2))
				CreateScreenElement {
					type = containerElement
					parent = current_menu
					dims = (0.0,0.0)
					heap = topdown
					not_focusable
				}
			else
				playlist_menu_add_item {index = <index>}
			endif
			<index> = (<index> + 1)
		repeat <array_size>
	endscript
	script change_track_state
		GetTags
		if TrackEnabled <index>
			ChangeTrackState <index> off
			PauseMusic 1
			if ScreenElementExists id = {<id> child = 4}
				DoScreenElementMorph id = {<id> child = 4} alpha = 0
			endif
		else
			ChangeTrackState <index> on
			if ScreenElementExists id = {<id> child = 4}
				DoScreenElementMorph id = {<id> child = 4} alpha = 1
			endif
		endif
		update_genre_checks
	endscript
	script is_genre_on
		printf {
			"is_genre_on"
		}
		on = 1
		GetArraySize {
			playlist_tracks
		}
		index = 0
		while
			if (((playlist_tracks[<index>]).genre) = <genre>)
				if ((<index> = locked_track1) || (<index> = locked_track2))
				else
					if NOT TrackEnabled <index>
						on = 0
						break
					endif
				endif
			endif
			index = (<index> + 1)
		repeat <array_size>
		return on = <on>
	endscript
	script toggle_playlist_genre genre = 0
		found_first = 0
		GetArraySize playlist_tracks
		index = 0
		while
			if (((playlist_tracks[<index>]).genre) = <genre>)
				if (<found_first> = 0)
					found_first = 1
					if TrackEnabled <index>
						toggle = 0
					else
						toggle = 1
					endif
				endif
				if (<toggle> = 1)
					if ScreenElementExists id = {playlist_vmenu child = {<index> child = 4}}
						ChangeTrackState <index> on
						DoScreenElementMorph id = {playlist_vmenu child = {<index> child = 4}} alpha = 1
					endif
				else
					if ScreenElementExists id = {playlist_vmenu child = {<index> child = 4}}
						ChangeTrackState <index> off
						DoScreenElementMorph id = {playlist_vmenu child = {<index> child = 4}} alpha = 0
					endif
				endif
			endif
			index = (<index> + 1)
		repeat <array_size>
		StopSound ThisMenuSelectSound
		PlaySound SK6_Menu_Select vol = 100 id = ThisMenuSelectSound
		update_genre_checks
	endscript
	script preview_music_track
		GetTags
		if NOT TrackEnabled <index>
			ChangeTrackState <index> on
			if ScreenElementExists id = {<id> child = 4}
				DoScreenElementMorph id = {<id> child = 4} alpha = 1
			endif
		endif
		if MusicIsPaused
			StopMusic
			PauseMusic {
				0
			}
			wait {
				1
				gameframes
			}
			PlayTrack <index>
		else
			PauseMusic {
				1
			}
		endif
		update_genre_checks
	endscript
	script playlist_hmenu_add_item
		Theme_GetUnhighlightedTextColor return_value = off_rgba
		switch <genre>
			case 0
				dims = (130.0,50.0)
			case 1
				dims = (165.0,50.0)
			case 2
				dims = (220.0,50.0)
			default
				return
		endswitch
		CreateScreenElement {
			type = containerElement
			parent = playlist_hmenu
			dims = <dims>
			event_handlers = [{pad_choose toggle_playlist_genre params = {genre = <genre>}}
				{focus playlist_hmenu_focus}
				{unfocus playlist_hmenu_unfocus}
			]
		}
		anchor_id = <id>
		CreateScreenElement {
			type = textElement
			parent = <anchor_id>
			z_priority = 50
			font = small
			text = <text>
			rgba = <off_rgba>
			scale = 1.5
			just = [left center]
		}
		GetStackedScreenElementPos X id = <id> offset = (4.0,13.0)
		is_genre_on genre = <genre>
		if (<on> = 1)
			alpha = 1
		else
			alpha = 0
		endif
		CreateScreenElement {
			type = spriteElement
			parent = <anchor_id>
			texture = checkmark
			pos = <pos>
			alpha = <alpha>
			just = [left center]
			rgba = <off_rgba>
			z_priority = 5
		}
		CreateScreenElement {
			type = spriteElement
			parent = <anchor_id>
			texture = checkbox
			pos = (<pos> + (0.0,5.0))
			just = [left center]
			scale = 0.5
			rgba = <off_rgba>
			z_priority = 5
		}
	endscript
	script update_genre_checks
		genre = 0
		while
			is_genre_on genre = <genre>
			if (<on> = 1)
				alpha = 1
			else
				alpha = 0
			endif
			DoScreenElementMorph id = {playlist_hmenu child = {<genre> child = 1}} alpha = <alpha>
			genre = (<genre> + 1)
		repeat 3
	endscript
	script playlist_hmenu_focus
		GetTags
		Theme_GetHighlightedTextColor {
			return_value = on_rgba
		}
		DoScreenElementMorph {id = {<id> child = 0} rgba = <on_rgba>}
		DoScreenElementMorph {id = {<id> child = 1} rgba = <on_rgba>}
		playlist_hmenu::GetTags
		if GotParam {
				arrow_id
			}
			blink_arrow {id = <arrow_id>}
		endif
	endscript
	script playlist_hmenu_unfocus
		GetTags
		Theme_GetUnhighlightedTextColor {
			return_value = off_rgba
		}
		DoScreenElementMorph {id = {<id> child = 0} rgba = <off_rgba>}
		DoScreenElementMorph {id = {<id> child = 1} rgba = <off_rgba>}
		playlist_hmenu::GetTags
		if GotParam {
				arrow_id
			}
			blink_arrow {id = <arrow_id>}
		endif
	endscript
	script focus_playlist_hmenu
		GetTags
		if (<tag_selected_id> = top_item)
			FireEvent {
				type = unfocus
				target = playlist_vmenu
			}
			DoScreenElementMorph {
				id = playlist_bottom_anchor
				alpha = 0.5
			}
			FireEvent {
				type = focus
				target = playlist_hmenu
			}
			DoScreenElementMorph {
				id = playlist_top_anchor
				alpha = 1.0
			}
		endif
	endscript
	script focus_playlist_vmenu
		FireEvent {
			type = unfocus
			target = playlist_hmenu
		}
		DoScreenElementMorph {
			id = playlist_top_anchor
			alpha = 0.5
		}
		FireEvent {
			type = focus
			target = playlist_vmenu
		}
		DoScreenElementMorph {
			id = playlist_bottom_anchor
			alpha = 1.0
		}
	endscript
	script playlist_menu_add_item highlight_bar_scale = (4.3499999,0.5) highlight_bar_pos = (321.0,0.0)
		Theme_GetUnhighlightedTextColor return_value = off_rgba
		Theme_GetHighlightBarColor return_value = bar_rgba
		if (<index> = 0)
			id = top_item
		endif
		CreateScreenElement {
			type = containerElement
			parent = current_menu
			id = <id>
			dims = (500.0,20.0)
			event_handlers = [{focus playlist_menu_focus params = <focus_params>}
				{unfocus playlist_menu_unfocus}
				{pad_choose change_track_state params = {index = <index>}}
				{pad_choose generic_menu_pad_choose_sound}
				{pad_start change_track_state params = {index = <index>}}
				{pad_start generic_menu_pad_choose_sound}
				{pad_option preview_music_track params = {index = <index>}}
			]
			heap = topdown
		}
		<anchor_id> = <id>
		CreateScreenElement {
			type = spriteElement
			parent = <anchor_id>
			texture = de_highlight_bar
			pos = <highlight_bar_pos>
			scale = <highlight_bar_scale>
			just = [center center]
			rgba = <bar_rgba>
			alpha = 0
			z_priority = 3
			heap = topdown
		}
		band = ((playlist_tracks[<index>]).band)
		track_title = ((playlist_tracks[<index>]).track_title)
		genre = ((playlist_tracks[<index>]).genre)
		CreateScreenElement {
			type = textElement
			parent = <anchor_id>
			font = dialog
			text = <band>
			pos = (50.0,0.0)
			just = [left center]
			rgba = <off_rgba>
			scale = 0.69999999
			heap = topdown
		}
		CreateScreenElement {
			type = textElement
			parent = <anchor_id>
			font = dialog
			text = <track_title>
			pos = (245.0,0.0)
			just = [left center]
			rgba = <off_rgba>
			scale = 0.69999999
			heap = topdown
		}
		switch <genre>
			case 0
				genre_text = "Punk"
			case 1
				genre_text = "Hip Hop"
			case 2
				genre_text = "Rock/Other"
			default
				genre_text = ""
		endswitch
		CreateScreenElement {
			type = textElement
			parent = <anchor_id>
			font = dialog
			text = <genre_text>
			pos = (510.0,0.0)
			just = [center center]
			rgba = <off_rgba>
			scale = 0.69999999
			heap = topdown
		}
		if TrackEnabled <index>
			alpha = 1
		else
			alpha = 0
		endif
		checkboxpos = (568.0,-4.0)
		CreateScreenElement {
			type = spriteElement
			parent = <anchor_id>
			texture = checkmark
			pos = <checkboxpos>
			alpha = <alpha>
			just = [left center]
			rgba = <off_rgba>
			z_priority = 5
			heap = topdown
		}
		CreateScreenElement {
			type = spriteElement
			parent = <anchor_id>
			texture = checkbox
			pos = (<checkboxpos> + (0.0,5.0))
			just = [left center]
			scale = 0.5
			rgba = <off_rgba>
			z_priority = 4
			heap = topdown
		}
	endscript
	script playlist_menu_focus
		GetTags
		Theme_GetHighlightedTextColor return_value = on_rgba
		DoScreenElementMorph id = {<id> child = 0} alpha = 1
		index = 1
		while
			if ScreenElementExists id = {<id> child = <index>}
				DoScreenElementMorph {id = {<id> child = <index>} rgba = <on_rgba>}
			else
				break
			endif
			index = (<index> + 1)
		repeat 4
		playlist_vmenu::GetTags
		if GotParam arrow_id
			menu_vert_blink_arrow {id = <arrow_id>}
		endif
		generic_menu_update_arrows menu_id = playlist_vmenu up_arrow_id = view_gaps_menu_up_arrow down_arrow_id = view_gaps_menu_down_arrow
	endscript
	script playlist_menu_unfocus
		GetTags
		Theme_GetUnhighlightedTextColor {
			return_value = off_rgba
		}
		DoScreenElementMorph id = {<id> child = 0} alpha = 0
		index = 1
		while
			if ScreenElementExists id = {<id> child = <index>}
				DoScreenElementMorph {id = {<id> child = <index>} rgba = <off_rgba>}
			else
				break
			endif
			index = (<index> + 1)
		repeat
		PauseMusic {
			1
		}
	endscript
	script create_soundtrack_menu
		make_new_themed_sub_menu title = "SOUNDTRACKS" scrolling skateshop_pos = (230.0,100.0) dims = (300.0,250.0) right_bracket_z = 1
		SetScreenElementProps {id = sub_menu
			event_handlers = [
				{pad_back generic_menu_pad_back params = {callback = create_sound_options_menu}}
			]
		}
		theme_menu_add_item {text = "American Wasteland Playlist"
			pad_choose_script = SetSoundtrack
			pad_choose_params = {track = ""}
			centered
			no_bg
			first_item
		}
		if ((isxbox) || (isPC))
			GetNumSoundtracks
		else
			numsoundtracks = 0
		endif
		if (<numsoundtracks> > 0)
			index = 0
			while
				GetSoundtrackName <index>
				theme_menu_add_item {text = <soundtrackname>
					pad_choose_script = SetSoundtrack
					pad_choose_params = {track = <soundtrackname>}
					centered
					no_bg
					max_width = 380
				}
				<index> = (<index> + 1)
			repeat <numsoundtracks>
		endif
		theme_menu_add_item {text = "Done"
			id = menu_done
			pad_choose_script = create_sound_options_menu
			centered
			no_bg
			last_item
		}
		finish_themed_scrolling_menu force_end_pos
	endscript
	script SetSoundtrack
		if isps2
			return
		endif
		FormatText checksumname = trackchecksum "%t" t = <track>
		printf "soundtrack = %i" i = <trackchecksum>
		generic_menu_pad_choose
		SoundtrackExists trackname = <track>
		printf "soundtrack index = %i" i = <index>
		if NOT (current_soundtrack = <trackchecksum>)
			StopMusic
		endif
		if (<index> = -1)
			printf "use playlist"
			UseStandardSoundtrack
		else
			printf "use soundtrack"
			UseUserSoundtrack <index>
		endif
		change current_soundtrack = <trackchecksum>
		if InFrontend
			create_sound_options_menu
		else
			create_sound_options_menu from_options
		endif
	endscript
	script SoundtrackExists trackname = ""
		printf "trackname = %t" t = <trackname>
		FormatText checksumname = tracknamesum "%t" t = <trackname>
		GetNumSoundtracks
		if NOT (<numsoundtracks> = 0)
			index = 0
			while
				GetSoundtrackName <index>
				printf "soundtrackname = %t" t = <soundtrackname>
				FormatText checksumname = soundtracksum "%s" s = <soundtrackname>
				if (<tracknamesum> = <soundtracksum>)
					return {index = <index>}
				endif
				index = (<index> + 1)
			repeat <numsoundtracks>
		endif
		return {index = -1}
	endscript
	script set_loaded_soundtrack
		printf "set_loaded_soundtrack"
		if NOT ((isxbox) || (isPC))
			return
		endif
		current_soundtrack_exists
		if NOT (current_soundtrack = #"0xFFFFFFFF")
			StopMusic
		endif
		if (<index> = -1)
			printf "use playlist"
			UseStandardSoundtrack
			trackchecksum = #"0xFFFFFFFF"
		else
			printf "use soundtrack %i" i = <index>
			UseUserSoundtrack <index>
		endif
		change current_soundtrack = <trackchecksum>
	endscript
	script current_soundtrack_exists
		GetNumSoundtracks
		if NOT (<numsoundtracks> = 0)
			index = 0
			while
				GetSoundtrackName <index>
				FormatText checksumname = soundtracksum "%s" s = <soundtrackname>
				if (current_soundtrack = <soundtracksum>)
					return {index = <index>}
				endif
				index = (<index> + 1)
			repeat <numsoundtracks>
		endif
		return {
			index = -1
		}
	endscript

Catarax
VIP
Posts: 132
Joined: Sat Oct 25, 2014 6:50 pm

Re: QB.WPC source code

Post by Catarax » Wed Jan 18, 2017 11:51 am

Thanks and for recompiling it to qb.wpc, which tool I have to use?

%.gone.
Global Moderator
Posts: 390
Joined: Sun Mar 07, 2010 5:12 pm

Re: QB.WPC source code

Post by %.gone. » Wed Jan 18, 2017 5:08 pm

You can't, again there aren't released tools for this.
The proper way of using queenbee is to edit global variables within the tool (this file only has one) and export scripts to decompile.
Since the decompiled script I gave you converted the PakStructs you could make individual files for each function minus the :i function $function_name$ and build using Blubs tool.

Post Reply