2 // ===========================================================================================================
4 vg_tex2d tex_tile_data
= { .path
= "textures/tileset.qoi" };
5 vg_tex2d tex_tile_glow
= { .path
= "textures/lineset.qoi" };
6 vg_tex2d tex_tile_detail
= { .path
= "textures/tile_overlays.qoi" };
8 vg_tex2d tex_tiles_wood
= { .path
= "textures/tile_wood.qoi" };
9 vg_tex2d tex_tiles_min
= { .path
= "textures/tile_minimal.qoi" };
10 vg_tex2d tex_tiles_lab
= { .path
= "textures/tile_lab.qoi" };
12 vg_tex2d tex_ball_noise
= { .path
= "textures/bnoise.qoi" };
13 vg_tex2d tex_unkown
= { .path
= "textures/unkown.qoi" };
14 vg_tex2d tex_buttons
= { .path
= "textures/buttons.qoi" };
15 vg_tex2d tex_sprites
= { .path
= "textures/autocombine.qoi" };
17 vg_tex2d
*texture_list
[] = {
30 #include "sprites_autocombine.h"
33 // ===========================================================================================================
35 sfx_vol_control audio_volume_sfx
= { .val
= 1.0f
, .name
= "Sound effects" };
36 sfx_vol_control audio_volume_music
= { .val
= 1.0f
, .name
= "Music" };
38 sfx_system audio_system_sfx
=
42 .vol_src
= &audio_volume_sfx
,
46 sfx_set audio_tile_mod
=
58 sfx_set audio_splitter
=
61 sound/splitter_01.ogg\0"
67 sound/rolling_01.ogg\0\
68 sound/rolling_02.ogg\0"
71 sfx_set audio_random
=
74 sound/random_01.ogg\0\
75 sound/random_02.ogg\0\
76 sound/random_03.ogg\0\
77 sound/random_04.ogg\0\
78 sound/random_05.ogg\0\
79 sound/random_06.ogg\0\
80 sound/random_07.ogg\0\
81 sound/random_08.ogg\0"
84 sfx_set audio_clicks
=
107 sfx_set audio_music
=
109 .sources
= "sound/mccompt2.ogg\0"
112 // One two or three layers of rolling noise
113 sfx_system audio_system_balls_rolling
=
115 .vol
= 0.7f
, .ch
= 1, .vol_src
= &audio_volume_sfx
,
116 .name
= "Balls Rolling", .flags
= SFX_FLAG_REPEAT
| SFX_FLAG_PERSISTENT
120 sfx_system audio_system_balls_switching
=
122 .vol
= 0.2f
, .ch
= 1, .vol_src
= &audio_volume_sfx
,
123 .name
= "Balls Switching"
126 // Gameplay critical sounds eg. splitter sound rocking
127 sfx_system audio_system_balls_important
=
129 .vol
= 1.f
, .ch
= 1, .vol_src
= &audio_volume_sfx
,
130 .name
= "Balls Gameplay"
133 // Suplemental sounds
134 sfx_system audio_system_balls_extra
=
136 .vol
= 0.27f
, .ch
= 1, .vol_src
= &audio_volume_sfx
,
137 .name
= "Balls Extra"
140 sfx_system audio_system_ui
=
142 .vol
= 1.f
, .ch
= 1, .vol_src
= &audio_volume_sfx
,
146 sfx_system audio_system_music
=
150 .vol_src
= &audio_volume_music
,
152 .flags
= SFX_FLAG_REPEAT
| SFX_FLAG_PERSISTENT
| SFX_FLAG_STEREO
155 static void *load_and_play_bgm( void *_inf
)
157 sfx_set_init( &audio_music
, NULL
);
158 sfx_set_play( &audio_music
, &audio_system_music
, 0 );
162 static void resource_load_main(void)
165 vg_tex2d_init( texture_list
, vg_list_size( texture_list
) );
168 sfx_set_init( &audio_tile_mod
, NULL
);
169 sfx_set_init( &audio_splitter
, NULL
);
170 sfx_set_init( &audio_rolls
, NULL
);
171 sfx_set_init( &audio_random
, NULL
);
172 sfx_set_init( &audio_clicks
, NULL
);
173 sfx_set_init( &audio_tones
, NULL
);
175 vg_thread_run( load_and_play_bgm
, NULL
);
178 static void resource_free_main(void)
180 vg_tex2d_free( texture_list
, vg_list_size( texture_list
) );
182 sfx_set_free( &audio_tile_mod
);
183 sfx_set_free( &audio_splitter
);
184 sfx_set_free( &audio_rolls
);
185 sfx_set_free( &audio_random
);
186 sfx_set_free( &audio_clicks
);
187 sfx_set_free( &audio_tones
);
191 // ===========================================================================================================
193 SHADER_DEFINE( shader_tile_colour
,
196 "layout (location=0) in vec2 a_co;"
198 "uniform vec3 uOffset;"
202 "gl_Position = vec4( uPv * vec3( a_co * uOffset.z + uOffset.xy, 1.0 ), 1.0 );"
206 "out vec4 FragColor;"
207 "uniform vec4 uColour;"
211 "FragColor = uColour;"
214 UNIFORMS({ "uPv", "uOffset", "uColour" })
217 SHADER_DEFINE( shader_ball
,
219 "layout (location=0) in vec2 a_co;"
220 "uniform vec3 uOffset;"
223 "out vec4 aTexCoords;"
228 "vec3 worldpos = vec3( (a_co * 0.5 - 0.25) * uOffset.z + uOffset.xy, 1.0 );"
229 "gl_Position = vec4( uPv * worldpos, 1.0 );"
231 // Create texture coords
232 "aTexCoords = vec4( a_co, worldpos.xy );"
236 "out vec4 FragColor;"
238 "uniform sampler2D uTexMain;"
239 "uniform vec3 uColour;"
240 "uniform vec2 uTexOffset;"
242 "in vec4 aTexCoords;"
246 "vec2 center_coords = aTexCoords.xy - 0.5;"
247 "vec2 center_coords_sqr = center_coords*center_coords;"
248 "float circle_factor = smoothstep( 0.07, 0.0625, center_coords_sqr.x+center_coords_sqr.y );"
250 "float bulge_amt = center_coords_sqr.x+center_coords_sqr.y;"
251 "vec2 warped_coords = aTexCoords.zw+uTexOffset - center_coords;"
252 "vec4 noise_sample = texture( uTexMain, warped_coords );"
254 "float rim_light = (center_coords_sqr.x+center_coords_sqr.y)*15.0;"
256 "vec2 shadow_coords = center_coords + vec2(0.02,0.07);"
257 "vec2 shadow_coords_sqr = shadow_coords*shadow_coords;"
258 "float shadow = exp(-((shadow_coords_sqr.x+shadow_coords_sqr.y)-0.0125)*15.0);"
260 "vec3 marble_comp = uColour*0.6 + (noise_sample.x*2.7+pow(rim_light,3.0)*2.0) * 0.1;"
261 //"vec4 colour_comp = mix( vec4(0.74,0.53,0.34,shadow), vec4(marble_comp,1.0), circle_factor );"
262 "vec4 colour_comp = mix( vec4(0.0,0.0,0.0,shadow), vec4(marble_comp,1.0), circle_factor );"
264 "FragColor = colour_comp;"
267 UNIFORMS({ "uTexMain", "uColour", "uOffset", "uPv", "uTexOffset" })
270 SHADER_DEFINE( shader_tile_main
,
272 "layout (location=0) in vec2 a_co;"
273 "uniform vec4 uOffset;" // Tile x/y, uv x/y
275 "uniform mat2 uSubTransform;"
276 "uniform float uVisibility;"
278 "out vec4 aTexCoords;"
279 "out vec2 aWorldCoords;"
281 "vec2 hash22(vec2 p)"
283 "vec3 p3 = fract(vec3(p.xyx) * vec3(.1031, .1030, .0973));"
284 "p3 += dot(p3, p3.yzx+33.33);"
285 "return fract((p3.xx+p3.yz)*p3.zy);"
290 "vec2 hash_val = hash22(uOffset.xy);"
291 "float scaling_factor = smoothstep( hash_val.x, hash_val.x+1.0, uVisibility );"
294 "vec2 subtransform = uSubTransform * (a_co-0.5) * scaling_factor + 0.5;"
295 "vec3 worldpos = vec3( subtransform + uOffset.xy, 1.0 );"
296 "gl_Position = vec4( uPv * worldpos, 1.0 );"
298 // Create texture coords
299 "vec2 random_offset = floor(hash_val * 4.0) * 0.25;"
300 "vec2 edge_safe_coords = a_co * 0.98 + 0.01;"
301 "aTexCoords = vec4((edge_safe_coords + uOffset.zw) * 0.25, edge_safe_coords * 0.25 + random_offset );"
302 "aWorldCoords = worldpos.xy;"
306 "out vec4 FragColor;"
308 "uniform sampler2D uTexGlyphs;"
309 "uniform sampler2D uTexGlow;"
310 "uniform sampler2D uTexWood;"
311 "uniform float uGhost;"
312 "uniform float uForeground;"
313 "uniform vec2 uMousePos;"
314 "uniform vec4 uColour;"
315 "uniform vec3 uShadowing;"
316 "uniform vec3 uGlowA;"
317 "uniform vec3 uGlowB;"
319 "in vec4 aTexCoords;"
320 "in vec2 aWorldCoords;"
324 //"vec3 shadowing_colour = vec3( 0.93, 0.88536, 0.8184 ) * 0.97;"
325 //"vec3 shadowing_colour = vec3( 0.8, 0.8, 0.8 );"
327 "vec4 glyph = texture( uTexGlyphs, aTexCoords.xy );"
328 "vec4 glyph_glow = texture( uTexGlow, aTexCoords.xy );"
329 "vec4 wood = texture( uTexWood, aTexCoords.zw );"
330 "vec4 wood_secondary = texture( uTexWood, aTexCoords.zw + 0.25 );"
331 "vec3 wood_comp = mix( wood_secondary.rgb * uShadowing, wood.rgb, clamp( glyph.b*2.0-1.0, 0.0, 1.0 ) );"
333 //"vec3 shadows = mix( vec3( 0.85, 0.7344, 0.561 ), vec3(1.0,1.0,1.0), glyph.r );"
334 "vec3 shadows = mix( uShadowing, vec3(1.0,1.0,1.0), glyph.r );"
336 "vec4 output_regular = vec4( wood_comp * shadows, mix( glyph.a, glyph.b, uForeground ) );"
338 "float ghost_dist = clamp( 1.5 - distance(uMousePos, aWorldCoords), 0.0, 1.0 );"
339 "vec4 output_ghost = vec4( 1.0, 1.0, 1.0, glyph.g*ghost_dist );"
340 "vec4 glow_comp = vec4(glyph_glow.b*uGlowA+glyph_glow.g*uGlowB,0.0);"
342 "FragColor = mix( output_regular, output_ghost, uGhost )*uColour + glow_comp;"
345 UNIFORMS({ "uPv", "uOffset", "uTexGlyphs", "uTexWood", "uSubTransform", "uGhost", "uMousePos",
346 "uColour", "uForeground", "uVisibility", "uShadowing", "uTexGlow",
347 "uGlowA", "uGlowB" })
350 SHADER_DEFINE( shader_background
,
352 "layout (location=0) in vec2 a_co;"
354 "uniform vec3 uOffset;"
356 "out vec2 aTexCoords;"
360 "vec2 world_pos = a_co * uOffset.z + uOffset.xy;"
361 "gl_Position = vec4( uPv * vec3( world_pos, 1.0 ), 1.0 );"
366 "out vec4 FragColor;"
368 "uniform sampler2D uTexMain;"
369 "uniform sampler2D uSamplerNoise;"
370 "uniform float uVariance;"
371 "uniform float uVisibility;"
373 "in vec2 aTexCoords;"
377 "vec4 data_this_tile = texture( uTexMain, aTexCoords );"
379 "float ao_accum = 0.0;"
383 "for( int i=0; i<10; ++i )"
385 "random_noise = (texture( uSamplerNoise, aTexCoords * 10.0 + float(i) * 0.2 ).xy - vec2( 0.5, 0.5 )) * uVariance;"
386 "vec4 background = texture( uTexMain, aTexCoords + random_noise );"
387 "float height_diff = min(data_this_tile.r - background.r,0.0);"
389 "ao_accum += height_diff * clamp((1.0 - length( random_noise )), 0.0, 1.0);"
394 "vec3 colour_main = mix( vec3( 0.369768, 0.3654, 0.42 ), vec3( 0.275, 0.388, 0.553 ), data_this_tile.g * uVisibility );"
397 "vec2 square_coords = fract( aTexCoords * 64.0 );"
398 "vec2 grid_coords = abs( square_coords - 0.5 );"
399 "float gridline = step( 0.49, max(grid_coords.x,grid_coords.y) );"
401 "vec3 colour_main = mix( vec3( 0.14 ) + random_noise.x*0.5, vec3( 0.1 ) + gridline*0.02, data_this_tile.g * uVisibility );"
402 "FragColor = vec4( colour_main + ao_accum*0.05, 1.0 );"
405 UNIFORMS({ "uPv", "uOffset", "uTexMain", "uVariance", "uSamplerNoise", "uVisibility" })
408 SHADER_DEFINE( shader_wire
,
410 "layout (location=0) in vec2 a_co;"
411 "uniform vec3 uStart;"
414 "uniform float uCurve;"
416 "out vec2 aTexCoords;"
418 "vec3 sample_curve_time( float t )"
420 "vec3 line_coord = mix( uStart, uEnd, t );"
422 "float curve_amt = 1.0-(pow((t*2.0-1.0),2.0));"
423 "return vec3( line_coord.x, line_coord.y - curve_amt*uCurve, line_coord.z );"
429 "vec3 p0 = sample_curve_time( a_co.x );"
430 "vec3 p1 = sample_curve_time( a_co.x + 0.025 );"
432 "vec2 line_tangent = normalize(p1.xy-p0.xy);"
433 "vec2 line_normal = vec2( -line_tangent.y, line_tangent.x );"
435 "vec2 worldfinal = p0.xy + line_normal*a_co.y*p0.z;"
437 "gl_Position = vec4( uPv * vec3(worldfinal, 1.0), 1.0 );"
439 // Create texture coords (todo: include stretch adjusted coords?)
440 "aTexCoords = vec2( a_co.x, a_co.y + 0.5 );"
444 "out vec4 FragColor;"
446 "uniform sampler2D uTexMain;"
447 "uniform vec4 uColour;"
448 "uniform float uTime;"
449 "uniform float uGlow;"
451 "in vec2 aTexCoords;"
456 "float shadow = 1.0 - abs(aTexCoords.y - 0.5) * 2.0;"
457 "float masking = smoothstep( 0.5, 0.8, shadow );"
459 "vec3 colour_comp = mix( vec3(0.0,0.0,0.0), uColour.rgb, masking );"
461 "float flow_thing = fract( aTexCoords.x + uTime );"
462 "vec3 final_comp = colour_comp + flow_thing * uGlow;"
464 "FragColor = vec4( final_comp, max( shadow* 0.2, masking ) * uColour.a );"
467 UNIFORMS({ "uPv", "uColour", "uTexMain", "uStart", "uEnd", "uCurve", "uTime", "uGlow" })
470 SHADER_DEFINE( shader_buttons
,
472 "layout (location=0) in vec2 a_co;"
473 "uniform vec4 uOffset;" // Tile x/y, uv x/y
476 "out vec2 aTexCoords;"
481 "vec3 worldpos = vec3( a_co + uOffset.xy, 1.0 );"
482 "gl_Position = vec4( uPv * worldpos, 1.0 );"
484 // Create texture coords
485 "vec2 edge_safe_coords = a_co * 0.98 + 0.01;"
486 "aTexCoords = (edge_safe_coords + uOffset.zw) * 0.25;"
490 "out vec4 FragColor;"
492 "uniform sampler2D uTexMain;"
493 "uniform vec4 uColour;" // rgb, light amount
495 "in vec2 aTexCoords;"
499 "vec4 glyph = texture( uTexMain, aTexCoords.xy );"
501 "FragColor = vec4( uColour.rgb * (mix(glyph.r, glyph.g, uColour.a)+0.02)*2.6 + glyph.b * 0.4, glyph.a );"
504 UNIFORMS({ "uPv", "uOffset", "uTexMain", "uColour" })
507 SHADER_DEFINE( shader_sprite
,
510 "layout (location=0) in vec2 a_co;" // quad mesh
516 "out vec2 aTexCoords;"
520 "vec2 vertex_world = uUv.zw * (a_co-0.5) * uPos.z + uPos.xy;"
521 "gl_Position = vec4( uPv * vec3( vertex_world, 1.0 ), 1.0 );"
522 "aTexCoords = uUv.xy + a_co*uUv.zw;"
526 "uniform sampler2D uTexMain;"
527 "out vec4 FragColor;"
529 "in vec2 aTexCoords;"
533 "vec4 texture_sample = texture( uTexMain, aTexCoords );"
534 "FragColor = texture_sample;"
537 UNIFORMS({ "uPv", "uTexMain", "uUv", "uPos" })
540 SHADER_DEFINE( shader_post_darken
,
541 "layout (location=0) in vec2 a_co;"
542 "out vec2 aTexCoords;"
546 "gl_Position = vec4( a_co * 2.0 - 1.0, 0.0, 1.0 );"
550 "uniform sampler2D uTexMain;"
551 "out vec4 FragColor;"
553 "in vec2 aTexCoords;"
557 "vec4 texture_sample = texture( uTexMain, aTexCoords );"
558 "FragColor = vec4(pow(texture_sample.rgb,vec3(2.2)), 1.0);"
561 UNIFORMS({"uTexMain"})
564 SHADER_DEFINE( shader_post_blur
,
565 "layout (location=0) in vec2 a_co;"
566 "out vec2 aTexCoords;"
570 "gl_Position = vec4( a_co * 2.0 - 1.0, 0.0, 1.0 );"
574 "uniform sampler2D uTexMain;"
576 "out vec4 FragColor;"
578 "in vec2 aTexCoords;"
582 "vec4 colour = vec4(0.0);"
584 "vec2 off1 = vec2(1.411764705882353) * uDir;"
585 "vec2 off2 = vec2(3.2941176470588234) * uDir;"
586 "vec2 off3 = vec2(5.176470588235294) * uDir;"
587 "colour += texture2D( uTexMain, aTexCoords ) * 0.1964825501511404;"
588 "colour += texture2D( uTexMain, aTexCoords + off1 ) * 0.2969069646728344;"
589 "colour += texture2D( uTexMain, aTexCoords - off1 ) * 0.2969069646728344;"
590 "colour += texture2D( uTexMain, aTexCoords + off2 ) * 0.09447039785044732;"
591 "colour += texture2D( uTexMain, aTexCoords - off2 ) * 0.09447039785044732;"
592 "colour += texture2D( uTexMain, aTexCoords + off3 ) * 0.010381362401148057;"
593 "colour += texture2D( uTexMain, aTexCoords - off3 ) * 0.010381362401148057;"
594 "FragColor = colour;"
597 UNIFORMS({"uTexMain","uDir"})
600 SHADER_DEFINE( shader_post_comp
,
601 "layout (location=0) in vec2 a_co;"
602 "out vec2 aTexCoords;"
606 "gl_Position = vec4( a_co * 2.0 - 1.0, 0.0, 1.0 );"
610 "uniform sampler2D uTexMain;"
611 "uniform sampler2D uTexBloom;"
612 "uniform vec2 uComp;" /* x: bloom, y: vignette */
613 "out vec4 FragColor;"
615 "in vec2 aTexCoords;"
619 "vec4 texture_sample = texture( uTexMain, aTexCoords );"
620 "vec4 bloom_sample = texture( uTexBloom, aTexCoords );"
622 "vec2 vigCoord = aTexCoords - 0.5;"
623 "float vig = pow(1.0 - dot( vigCoord, vigCoord ), 2.0);"
625 "FragColor = (texture_sample + bloom_sample*0.3*uComp.x)"
626 " * max(uComp.y, vig);"
629 UNIFORMS({"uTexMain", "uTexBloom", "uComp"})
632 void vg_register(void)
634 SHADER_INIT( shader_tile_colour
);
635 SHADER_INIT( shader_tile_main
);
636 SHADER_INIT( shader_ball
);
637 SHADER_INIT( shader_background
);
638 SHADER_INIT( shader_wire
);
639 SHADER_INIT( shader_buttons
);
640 SHADER_INIT( shader_sprite
);
641 SHADER_INIT( shader_post_darken
);
642 SHADER_INIT( shader_post_comp
);
643 SHADER_INIT( shader_post_blur
);
647 0000 0 | 0001 1 | 0010 2 | 0011 3
651 0100 4 | 0101 5 | 0110 6 | 0111 7
655 1000 8 | 1001 9 | 1010 10 | 1011 11
659 1100 12 | 1101 13 | 1110 14 | 1111 15
670 const char *map_name
;
672 const char *description
;
674 const char *achievement
;
676 int _unlock
, _linked
; // When completed, unlock this level
698 struct world_button btn
;
699 struct cmp_level
*unlock
, *linked
;
702 SteamLeaderboard_t steam_leaderboard
;
706 static struct cmp_level cmp_levels_tutorials
[] =
709 0, "cmp_t01", "PRINCIPLE 1", "",
714 1, "cmp_t02", "PRINCIPLE 2", "",
719 2, "cmp_t03", "PRINCIPLE 3", "",
724 12, "cmp_t04", "PRINCIPLE 4", "",
727 .achievement
= "TUTORIALS"
730 15, "cmp_b10", "PRINCIPLE 5", "",
735 17, "cmp_b11", "PRINCIPLE 6", "(Right click)",
740 26, "cmp_p7", "PRINCIPLE 7", "Emitters",
747 static struct cmp_level cmp_levels_basic
[] =
750 6, "cmp_b04", "PATCH", "",
755 3, "cmp_b01", "SUBDIVISION 1", "",
760 4, "cmp_b02", "SUBDIVISION 2", "",
764 5, "cmp_b03", "RESTRUCTURE", "",
769 31, "cmp_121", "1-2-1", "",
773 7, "cmp_b05", "PATTERNS 1", "",
778 8, "cmp_b06", "PATTERNS 2", "",
782 16, "cmp_routing", "ROUTING PROBLEM", "",
786 9, "cmp_b07", "MIGHTY CONSUMER", "",
789 .achievement
= "MIGHTY_CONSUMER"
792 10, "cmp_b08", "SHIFT", "",
796 11, "cmp_b09", "REVERSE", "",
800 18, "cmp_not", "NOT GATE", "",
805 19, "cmp_and", "AND GATE", "",
809 20, "cmp_xor", "QUALIFICATION PROJECT", "",
811 .achievement
= "GRADUATE"
814 27, "cmp_expander", "EXPAND", "",
818 28, "cmp_pattern3", "PATTERNS 3", "",
822 29, "cmp_routing2", "ROUTING PROBLEM 2", "Spaghetti!",
827 30, "cmp_exact5", "EXACTLY 5", "",
831 32, "cmp_3and2", "THREE AND FOUR", "",
835 34, "doublex2", "DOUBLE DOUBLE", "Delay & repeat",
839 35, "oddoreven", "ODD OR EVEN", ""
843 static struct cmp_level cmp_levels_grad
[] =
846 13, "cmp_i01", "SORT", "",
850 14, "cmp_i02", "THIRDS", "",
854 21, "cmp_grad", "SIMPLE ADDITION", "",
859 22, "cmp_secret", "SECRET CODE", "",
864 static struct cmp_level cmp_levels_computer
[] =
867 23, "cmp_binary", "3 BIT BINARY", "Convert amount to binary",
872 .placement
= k_placement_bottom
,
874 "\t\t\t\t\t\t\t\t\t\t\x83 \x84\n"
875 "\t\t\t\t\t\t\t\t\t\t\x83 \x84 Binary\n"
876 "\t\t\t\t\t\t\t\t\t\t\x83 4 2 1 \x84"
879 .placement
= k_placement_top
,
882 "\t\t\t\t\t\t\t\t\t\t\t Count"
887 24, "cmp_add3b", "3 BIT ADDER", "Binary addition",
892 .placement
= k_placement_top
,
893 //.str ="\t\t\t\t\t\t\t\t\t| NUMBER A | | NUMBER B |\n"
895 "\t\t\t\t\t\t\t\t\t\x8A 4 2 1 \x8B \x8A 4 2 1 \x8B\n"
896 "\t\t\t\t\t\t\t\t\t\x83 \x84 add \x83 \x84\n"
897 "\t\t\t\t\t\t\t\t\t\x83 \x84 \x83 \x84"
900 .placement
= k_placement_bottom
,
903 "\t\t\t\x83 \x84 result a+b\n"
904 "\t\t\t\x83 8 4 2 1 \x84"
909 25, "cmp_plot3x3", "3x3 PLOT", "2 bit x/y",
914 .placement
= k_placement_top
,
916 "\t\t\t\t\t\t\t\t\x8A 2 1 \x8B \x8A 2 1 \x8B\n"
917 "\t\t\t\t\t\t\t\t\x83 \x84 X Y \x83 \x84\n"
918 "\t\t\t\t\t\t\t\t\x83 \x84 \x83 \x84"
923 33, "compactxor", "Compact XOR", "",
927 .placement
= k_placement_top
,
929 "\t\t\t\t\x8A \x8B \x8A \x8B\n"
930 "\t\t\t\t\x83 \x84""A B\x83 \x84\n"
931 "\t\t\t\t\x83 \x84 \x83 \x84"
934 .placement
= k_placement_bottom
,
937 "\t\t\t\x83 \x84 result a xor b\n"
944 #define NUM_CAMPAIGN_LEVELS (vg_list_size( cmp_levels_tutorials ) + vg_list_size( cmp_levels_basic ) + vg_list_size( cmp_levels_grad ) + vg_list_size( cmp_levels_computer ) )
946 static struct career_level_pack
948 struct cmp_level
*pack
;
959 .pack
= cmp_levels_tutorials
,
961 .count
= vg_list_size( cmp_levels_tutorials
),
962 .primary_colour
= { 0.204f
, 0.345f
, 0.553f
},
963 .origin
= { -4, -2 },
967 .pack
= cmp_levels_basic
,
968 .title
= "\x8C\x8D"" Core",
969 .count
= vg_list_size( cmp_levels_basic
),
970 .primary_colour
= { 0.304f
, 0.245f
, 0.553f
},
971 .origin
= { -3, -2 },
975 .pack
= cmp_levels_grad
,
976 .title
= "\x8C\x8E"" Challenge",
977 .count
= vg_list_size( cmp_levels_grad
),
978 .primary_colour
= { 0.75f
, 0.23f
, 0.39f
},
983 .pack
= cmp_levels_computer
,
984 .title
= "\x8C\x8F"" 3 Bit computer\n\n (preview)",
985 .count
= vg_list_size( cmp_levels_computer
),
986 .primary_colour
= { 0.75f
, 0.14f
, 0.1f
},
992 // Setup pointers and that
993 static void career_local_data_init(void)
995 struct cmp_level
*level_ptrs
[ NUM_CAMPAIGN_LEVELS
];
996 for( int i
= 0; i
< NUM_CAMPAIGN_LEVELS
; i
++ )
997 level_ptrs
[i
] = NULL
;
1000 for( int i
= 0; i
< vg_list_size( career_packs
); i
++ )
1002 struct career_level_pack
*set
= &career_packs
[i
];
1004 for( int j
= 0; j
< set
->count
; j
++ )
1006 int id
= set
->pack
[j
].serial_id
;
1008 if( level_ptrs
[ id
] )
1009 vg_error( "Serial id %u already used!\n", id
);
1011 level_ptrs
[ set
->pack
[j
].serial_id
] = &set
->pack
[j
];
1016 for( int i
= 0; i
< vg_list_size( career_packs
); i
++ )
1018 struct career_level_pack
*set
= &career_packs
[i
];
1020 for( int j
= 0; j
< set
->count
; j
++ )
1022 struct cmp_level
*lvl
= &set
->pack
[j
];
1024 if( lvl
->_unlock
>= NUM_CAMPAIGN_LEVELS
||
1025 lvl
->_linked
>= NUM_CAMPAIGN_LEVELS
)
1027 vg_error( "_unlock / _linked out of range (%d, %d)\n",
1028 lvl
->_unlock
, lvl
->_linked
);
1032 lvl
->unlock
= lvl
->_unlock
? level_ptrs
[ lvl
->_unlock
]: NULL
;
1033 lvl
->linked
= lvl
->_linked
? level_ptrs
[ lvl
->_linked
]: NULL
;