2 // ===========================================================================================================
4 vg_tex2d tex_tile_data
= { .path
= "textures/tileset.qoi" };
5 vg_tex2d tex_tile_detail
= { .path
= "textures/tile_overlays.qoi" };
6 vg_tex2d tex_wood
= { .path
= "textures/wood.qoi" };
7 vg_tex2d tex_background
= { .path
= "textures/background.qoi" };
8 vg_tex2d tex_ball_noise
= { .path
= "textures/bnoise.qoi" };
9 vg_tex2d tex_monofur
= { .path
= "textures/ascii.qoi", .flags
= VG_TEXTURE_NO_MIP
};
10 vg_tex2d tex_unkown
= { .path
= "textures/unkown.qoi" };
11 vg_tex2d tex_buttons
= { .path
= "textures/buttons.qoi" };
13 vg_tex2d
*texture_list
[] = { &tex_tile_detail
, &tex_tile_data
, &tex_wood
, &tex_background
, &tex_ball_noise
, &tex_monofur
, &tex_unkown
, &tex_buttons
};
16 // ===========================================================================================================
18 sfx_vol_control audio_volume_sfx
= { .val
= 1.0f
, .name
= "Sound effects" };
19 sfx_vol_control audio_volume_music
= { .val
= 1.0f
, .name
= "Music" };
21 sfx_system audio_system_sfx
=
25 .vol_src
= &audio_volume_sfx
,
29 sfx_set audio_tile_mod
=
41 sfx_set audio_splitter
=
44 sound/splitter_01.ogg\0"
50 sound/rolling_01.ogg\0\
51 sound/rolling_02.ogg\0"
54 sfx_set audio_random
=
57 sound/random_01.ogg\0\
58 sound/random_02.ogg\0\
59 sound/random_03.ogg\0\
60 sound/random_04.ogg\0\
61 sound/random_05.ogg\0\
62 sound/random_06.ogg\0\
63 sound/random_07.ogg\0\
64 sound/random_08.ogg\0"
67 // One two or three layers of rolling noise
68 sfx_system audio_system_balls_rolling
=
70 .vol
= 1.f
, .ch
= 1, .vol_src
= &audio_volume_sfx
,
71 .name
= "Balls Rolling", .flags
= SFX_FLAG_REPEAT
75 sfx_system audio_system_balls_switching
=
77 .vol
= 1.f
, .ch
= 1, .vol_src
= &audio_volume_sfx
,
78 .name
= "Balls Switching"
81 // Gameplay critical sounds eg. splitter sound rocking
82 sfx_system audio_system_balls_important
=
84 .vol
= 1.f
, .ch
= 1, .vol_src
= &audio_volume_sfx
,
85 .name
= "Balls Gameplay"
89 sfx_system audio_system_balls_extra
=
91 .vol
= 1.f
, .ch
= 1, .vol_src
= &audio_volume_sfx
,
95 ui_colourset ui_fl_colours
= {
101 ui_colourset ui_fl_colours_inactive
= {
107 static void resource_load_main(void)
110 vg_tex2d_init( texture_list
, vg_list_size( texture_list
) );
112 ui_override_font( tex_monofur
.name
, 7 );
114 ui_global_ctx
.colours_main
= &ui_fl_colours
;
118 sfx_set_init( &audio_tile_mod
, NULL
);
119 sfx_set_init( &audio_splitter
, NULL
);
120 sfx_set_init( &audio_rolls
, NULL
);
121 sfx_set_init( &audio_random
, NULL
);
124 static void resource_free_main(void)
126 vg_tex2d_free( texture_list
, vg_list_size( texture_list
) );
128 sfx_set_free( &audio_tile_mod
);
129 sfx_set_free( &audio_splitter
);
130 sfx_set_free( &audio_rolls
);
131 sfx_set_free( &audio_random
);
135 // ===========================================================================================================
137 SHADER_DEFINE( shader_tile_colour
,
140 "layout (location=0) in vec2 a_co;"
142 "uniform vec3 uOffset;"
146 "gl_Position = vec4( uPv * vec3( a_co * uOffset.z + uOffset.xy, 1.0 ), 1.0 );"
150 "out vec4 FragColor;"
151 "uniform vec4 uColour;"
155 "FragColor = uColour;"
158 UNIFORMS({ "uPv", "uOffset", "uColour" })
161 SHADER_DEFINE( shader_ball
,
163 "layout (location=0) in vec2 a_co;"
164 "uniform vec3 uOffset;"
167 "out vec4 aTexCoords;"
172 "vec3 worldpos = vec3( (a_co * 0.5 - 0.25) * uOffset.z + uOffset.xy, 1.0 );"
173 "gl_Position = vec4( uPv * worldpos, 1.0 );"
175 // Create texture coords
176 "aTexCoords = vec4( a_co, worldpos.xy );"
180 "out vec4 FragColor;"
182 "uniform sampler2D uTexMain;"
183 "uniform vec3 uColour;"
184 "uniform vec2 uTexOffset;"
186 "in vec4 aTexCoords;"
190 "vec2 center_coords = aTexCoords.xy - 0.5;"
191 "vec2 center_coords_sqr = center_coords*center_coords;"
192 "float circle_factor = smoothstep( 0.07, 0.0625, center_coords_sqr.x+center_coords_sqr.y );"
194 "float bulge_amt = center_coords_sqr.x+center_coords_sqr.y;"
195 "vec2 warped_coords = aTexCoords.zw+uTexOffset - center_coords;"
196 "vec4 noise_sample = texture( uTexMain, warped_coords );"
198 "float rim_light = (center_coords_sqr.x+center_coords_sqr.y)*15.0;"
200 "vec2 shadow_coords = center_coords + vec2(0.02,0.07);"
201 "vec2 shadow_coords_sqr = shadow_coords*shadow_coords;"
202 "float shadow = exp(-((shadow_coords_sqr.x+shadow_coords_sqr.y)-0.0125)*15.0);"
204 "vec3 marble_comp = uColour*0.9 + (noise_sample.x*0.7+pow(rim_light,3.0)*2.0) * 0.1;"
205 "vec4 colour_comp = mix( vec4(0.74,0.53,0.34,shadow), vec4(marble_comp,1.0), circle_factor );"
207 "FragColor = colour_comp;"
210 UNIFORMS({ "uTexMain", "uColour", "uOffset", "uPv", "uTexOffset" })
213 SHADER_DEFINE( shader_tile_main
,
215 "layout (location=0) in vec2 a_co;"
216 "uniform vec4 uOffset;" // Tile x/y, uv x/y
218 "uniform mat2 uSubTransform;"
220 "out vec4 aTexCoords;"
221 "out vec2 aWorldCoords;"
223 "vec2 hash22(vec2 p)"
225 "vec3 p3 = fract(vec3(p.xyx) * vec3(.1031, .1030, .0973));"
226 "p3 += dot(p3, p3.yzx+33.33);"
227 "return fract((p3.xx+p3.yz)*p3.zy);"
233 "vec2 subtransform = uSubTransform * (a_co-0.5) + 0.5;"
234 "vec3 worldpos = vec3( subtransform + uOffset.xy, 1.0 );"
235 "gl_Position = vec4( uPv * worldpos, 1.0 );"
237 // Create texture coords
238 "vec2 random_offset = floor(hash22(uOffset.xy) * 4.0) * 0.25;"
239 "vec2 edge_safe_coords = a_co * 0.98 + 0.01;"
240 "aTexCoords = vec4((edge_safe_coords + uOffset.zw) * 0.25, edge_safe_coords * 0.25 + random_offset );"
241 "aWorldCoords = worldpos.xy;"
245 "out vec4 FragColor;"
247 "uniform sampler2D uTexGlyphs;"
248 "uniform sampler2D uTexWood;"
249 "uniform float uGhost;"
250 "uniform float uForeground;"
251 "uniform vec2 uMousePos;"
252 "uniform vec4 uColour;"
254 "in vec4 aTexCoords;"
255 "in vec2 aWorldCoords;"
259 "vec3 shadowing_colour = vec3( 0.93, 0.88536, 0.8184 ) * 0.97;"
260 "vec4 glyph = texture( uTexGlyphs, aTexCoords.xy );"
261 "vec4 wood = texture( uTexWood, aTexCoords.zw );"
262 "vec4 wood_secondary = texture( uTexWood, aTexCoords.zw + 0.25 );"
263 "vec3 wood_comp = mix( wood_secondary.rgb * shadowing_colour, wood.rgb, clamp( glyph.b * 2.0 - 1.0, 0.0, 1.0 ) );"
265 "vec3 shadows = mix( vec3( 0.85, 0.7344, 0.561 ), vec3(1.0,1.0,1.0), glyph.r );"
267 "vec4 output_regular = vec4( wood_comp * shadows, mix( glyph.a, glyph.b, uForeground ) );"
269 "float ghost_dist = clamp( 1.5 - distance(uMousePos, aWorldCoords), 0.0, 1.0 );"
270 "vec4 output_ghost = vec4( 1.0, 1.0, 1.0, glyph.g * ghost_dist );"
272 "FragColor = mix( output_regular, output_ghost, uGhost ) * uColour;"
275 UNIFORMS({ "uPv", "uOffset", "uTexGlyphs", "uTexWood", "uSubTransform", "uGhost", "uMousePos", "uColour", "uForeground" })
278 SHADER_DEFINE( shader_background
,
280 "layout (location=0) in vec2 a_co;"
282 "uniform vec3 uOffset;"
284 "out vec2 aTexCoords;"
288 "vec2 world_pos = a_co * uOffset.z + uOffset.xy;"
289 "gl_Position = vec4( uPv * vec3( world_pos, 1.0 ), 1.0 );"
294 "out vec4 FragColor;"
296 "uniform sampler2D uTexMain;"
297 "uniform sampler2D uSamplerNoise;"
298 "uniform float uVariance;"
300 "in vec2 aTexCoords;"
304 "float ao_accum = 0.0;"
305 "for( int i=0; i<10; ++i )"
307 "vec2 random_noise = (texture( uSamplerNoise, aTexCoords * 20.0 + float(i) * 0.2 ).xy - vec2( 0.5, 0.5 )) * uVariance;"
308 "vec4 background = texture( uTexMain, aTexCoords + random_noise );"
309 "ao_accum += background.r * clamp((1.0 - length( random_noise )), 0.0, 1.0);"
313 "vec4 data_this_tile = texture( uTexMain, aTexCoords );"
315 "ao_accum -= data_this_tile.r;"
317 "vec3 colour_main = mix( vec3( 0.369768, 0.3654, 0.42 ),vec3( 0.275, 0.388, 0.553 ), data_this_tile.g );"
319 "vec2 square_coords = fract( aTexCoords * 64.0 );"
320 "vec2 grid_coords = abs( square_coords - 0.5 );"
321 "float edge_contrast = (1.0-ao_accum*0.2);"
323 "float gridline = step( 0.49, max(grid_coords.x,grid_coords.y) );"
324 "float gridline_fadeout = min(max(edge_contrast-1.0, 0.0)*40.0 + data_this_tile.g,10.0);"
326 "FragColor = vec4( colour_main * edge_contrast + gridline * 0.02 * gridline_fadeout, 1.0 );"
329 UNIFORMS({ "uPv", "uOffset", "uTexMain", "uVariance", "uSamplerNoise" })
332 SHADER_DEFINE( shader_wire
,
334 "layout (location=0) in vec2 a_co;"
335 "uniform vec3 uStart;"
338 "uniform float uCurve;"
340 "out vec2 aTexCoords;"
342 "vec3 sample_curve_time( float t )"
344 "vec3 line_coord = mix( uStart, uEnd, t );"
346 "float curve_amt = 1.0-(pow((t*2.0-1.0),2.0));"
347 "return vec3( line_coord.x, line_coord.y - curve_amt*uCurve, line_coord.z );"
353 "vec3 p0 = sample_curve_time( a_co.x );"
354 "vec3 p1 = sample_curve_time( a_co.x + 0.025 );"
356 "vec2 line_tangent = normalize(p1.xy-p0.xy);"
357 "vec2 line_normal = vec2( -line_tangent.y, line_tangent.x );"
359 "vec2 worldfinal = p0.xy + line_normal*a_co.y*p0.z;"
361 "gl_Position = vec4( uPv * vec3(worldfinal, 1.0), 1.0 );"
363 // Create texture coords (todo: include stretch adjusted coords?)
364 "aTexCoords = vec2( a_co.x, a_co.y + 0.5 );"
368 "out vec4 FragColor;"
370 "uniform sampler2D uTexMain;"
371 "uniform vec4 uColour;"
373 "in vec2 aTexCoords;"
377 "FragColor = uColour;"
380 UNIFORMS({ "uPv", "uColour", "uTexMain", "uStart", "uEnd", "uCurve" })
383 SHADER_DEFINE( shader_buttons
,
385 "layout (location=0) in vec2 a_co;"
386 "uniform vec4 uOffset;" // Tile x/y, uv x/y
389 "out vec2 aTexCoords;"
394 "vec3 worldpos = vec3( a_co + uOffset.xy, 1.0 );"
395 "gl_Position = vec4( uPv * worldpos, 1.0 );"
397 // Create texture coords
398 "vec2 edge_safe_coords = a_co * 0.98 + 0.01;"
399 "aTexCoords = (edge_safe_coords + uOffset.zw) * 0.25;"
403 "out vec4 FragColor;"
405 "uniform sampler2D uTexMain;"
406 "uniform vec4 uColour;" // rgb, light amount
408 "in vec2 aTexCoords;"
412 "vec4 glyph = texture( uTexMain, aTexCoords.xy );"
414 "FragColor = vec4( uColour.rgb * (mix(glyph.r, glyph.g, uColour.a)+0.02)*2.6 + glyph.b * 0.4, glyph.a );"
417 UNIFORMS({ "uPv", "uOffset", "uTexMain", "uColour" })
421 void vg_register(void)
423 SHADER_INIT( shader_tile_colour
);
424 SHADER_INIT( shader_tile_main
);
425 SHADER_INIT( shader_ball
);
426 SHADER_INIT( shader_background
);
427 SHADER_INIT( shader_wire
);
428 SHADER_INIT( shader_buttons
);
432 0000 0 | 0001 1 | 0010 2 | 0011 3
436 0100 4 | 0101 5 | 0110 6 | 0111 7
440 1000 8 | 1001 9 | 1010 10 | 1011 11
444 1100 12 | 1101 13 | 1110 14 | 1111 15
450 float const MESH_NUMBER_0
[] = {
451 #include "fonts/numbers/n0.h"
454 float const MESH_NUMBER_1
[] = {
455 #include "fonts/numbers/n1.h"
458 float const MESH_NUMBER_2
[] = {
459 #include "fonts/numbers/n2.h"
462 float const MESH_NUMBER_3
[] = {
463 #include "fonts/numbers/n3.h"
466 float const MESH_NUMBER_4
[] = {
467 #include "fonts/numbers/n4.h"
470 float const MESH_NUMBER_5
[] = {
471 #include "fonts/numbers/n5.h"
474 float const MESH_NUMBER_6
[] = {
475 #include "fonts/numbers/n6.h"
478 float const MESH_NUMBER_7
[] = {
479 #include "fonts/numbers/n7.h"
482 float const MESH_NUMBER_8
[] = {
483 #include "fonts/numbers/n8.h"
486 float const MESH_NUMBER_9
[] = {
487 #include "fonts/numbers/n9.h"
490 float const MESH_NUMBERS_BUFFER
[] =
492 #include "fonts/numbers/n0.h"
493 #include "fonts/numbers/n1.h"
494 #include "fonts/numbers/n2.h"
495 #include "fonts/numbers/n3.h"
496 #include "fonts/numbers/n4.h"
497 #include "fonts/numbers/n5.h"
498 #include "fonts/numbers/n6.h"
499 #include "fonts/numbers/n7.h"
500 #include "fonts/numbers/n8.h"
501 #include "fonts/numbers/n9.h"
504 #define MESH_NUMBER_DIVISOR 6
506 u32
const MESH_NUMBERS_OFFSETS
[][2] =
510 vg_list_size( MESH_NUMBER_0
) / MESH_NUMBER_DIVISOR
513 vg_list_size( MESH_NUMBER_0
) / MESH_NUMBER_DIVISOR
,
514 vg_list_size( MESH_NUMBER_1
) / MESH_NUMBER_DIVISOR
518 vg_list_size( MESH_NUMBER_0
) +
519 vg_list_size( MESH_NUMBER_1
)
520 ) / MESH_NUMBER_DIVISOR
,
521 vg_list_size( MESH_NUMBER_2
) / MESH_NUMBER_DIVISOR
525 vg_list_size( MESH_NUMBER_0
) +
526 vg_list_size( MESH_NUMBER_1
) +
527 vg_list_size( MESH_NUMBER_2
)
528 ) / MESH_NUMBER_DIVISOR
,
529 vg_list_size( MESH_NUMBER_3
) / MESH_NUMBER_DIVISOR
533 vg_list_size( MESH_NUMBER_0
) +
534 vg_list_size( MESH_NUMBER_1
) +
535 vg_list_size( MESH_NUMBER_2
) +
536 vg_list_size( MESH_NUMBER_3
)
537 ) / MESH_NUMBER_DIVISOR
,
538 vg_list_size( MESH_NUMBER_4
) / MESH_NUMBER_DIVISOR
542 vg_list_size( MESH_NUMBER_0
) +
543 vg_list_size( MESH_NUMBER_1
) +
544 vg_list_size( MESH_NUMBER_2
) +
545 vg_list_size( MESH_NUMBER_3
) +
546 vg_list_size( MESH_NUMBER_4
)
547 ) / MESH_NUMBER_DIVISOR
,
548 vg_list_size( MESH_NUMBER_5
) / MESH_NUMBER_DIVISOR
552 vg_list_size( MESH_NUMBER_0
) +
553 vg_list_size( MESH_NUMBER_1
) +
554 vg_list_size( MESH_NUMBER_2
) +
555 vg_list_size( MESH_NUMBER_3
) +
556 vg_list_size( MESH_NUMBER_4
) +
557 vg_list_size( MESH_NUMBER_5
)
558 ) / MESH_NUMBER_DIVISOR
,
559 vg_list_size( MESH_NUMBER_6
) / MESH_NUMBER_DIVISOR
563 vg_list_size( MESH_NUMBER_0
) +
564 vg_list_size( MESH_NUMBER_1
) +
565 vg_list_size( MESH_NUMBER_2
) +
566 vg_list_size( MESH_NUMBER_3
) +
567 vg_list_size( MESH_NUMBER_4
) +
568 vg_list_size( MESH_NUMBER_5
) +
569 vg_list_size( MESH_NUMBER_6
)
570 ) / MESH_NUMBER_DIVISOR
,
571 vg_list_size( MESH_NUMBER_7
) / MESH_NUMBER_DIVISOR
575 vg_list_size( MESH_NUMBER_0
) +
576 vg_list_size( MESH_NUMBER_1
) +
577 vg_list_size( MESH_NUMBER_2
) +
578 vg_list_size( MESH_NUMBER_3
) +
579 vg_list_size( MESH_NUMBER_4
) +
580 vg_list_size( MESH_NUMBER_5
) +
581 vg_list_size( MESH_NUMBER_6
) +
582 vg_list_size( MESH_NUMBER_7
)
583 ) / MESH_NUMBER_DIVISOR
,
584 vg_list_size( MESH_NUMBER_8
) / MESH_NUMBER_DIVISOR
588 vg_list_size( MESH_NUMBER_0
) +
589 vg_list_size( MESH_NUMBER_1
) +
590 vg_list_size( MESH_NUMBER_2
) +
591 vg_list_size( MESH_NUMBER_3
) +
592 vg_list_size( MESH_NUMBER_4
) +
593 vg_list_size( MESH_NUMBER_5
) +
594 vg_list_size( MESH_NUMBER_6
) +
595 vg_list_size( MESH_NUMBER_7
) +
596 vg_list_size( MESH_NUMBER_8
)
597 ) / MESH_NUMBER_DIVISOR
,
598 vg_list_size( MESH_NUMBER_9
) / MESH_NUMBER_DIVISOR
604 const char *map_name
;
606 const char *description
;
611 int _unlock
, _linked
; // When completed, unlock this level
612 struct cmp_level
*unlock
, *linked
;
617 SteamLeaderboard_t steam_leaderboard
;
620 static struct cmp_level cmp_levels_tutorials
[] =
625 .title
= "PRINCIPLE 1",
626 .map_name
= "cmp_t01",
627 .description
= "Utilize basic transport methods",
635 .title
= "PRINCIPLE 2",
636 .map_name
= "cmp_t02",
637 .description
= "Utilize the twisty turny(TM) piece to split\n"
638 "the marble stream into two",
646 .title
= "PRINCIPLE 3",
647 .map_name
= "cmp_t03",
648 .description
= "Merge transport into one",
656 .title
= "PRINCIPLE 4",
657 .map_name
= "cmp_t04",
658 .description
= "Some stages require multiple runs to succeed\n"
666 static struct cmp_level cmp_levels_basic
[] =
671 .title
= "SUBDIVISION 1",
672 .map_name
= "cmp_b01",
673 .description
= "Sometimes getting the desired amount takes\n"
674 "dividing up the input and recombining it.",
682 .title
= "SUBDIVISION 2",
683 .map_name
= "cmp_b02",
692 .title
= "RESTRUCTURE",
693 .map_name
= "cmp_b03",
694 .description
= "It is possible to swap these values using\n"
695 "simple division and addition.",
701 .title
= "SERIALIZE",
702 .map_name
= "cmp_b04",
703 .description
= "Merge and sort",
709 .title
= "PATTERNS 1",
710 .map_name
= "cmp_b05",
711 .description
= "Replicate",
717 .title
= "PATTERNS 2",
718 .map_name
= "cmp_b06",
719 .description
= "Replicate MORE",
725 .title
= "MIGHTY CONSUMER",
726 .map_name
= "cmp_b07",
727 .description
= "Build a greedy system",
734 .title
= "ENCRYPTED 1",
735 .map_name
= "cmp_b08",
736 .description
= "Some configurations may not be valid",
743 .map_name
= "cmp_b09",
744 .description
= "Reverse the incoming order. Always length 4",
751 .title
= "PRINCIPLE 5",
752 .map_name
= "cmp_b10",
754 "The eager engineers among you may have already spotted\n"
755 "and utilized these parts of the system\n"
757 "We forgot to include the relevant principle tasks as\n"
758 "of your training package, you will now be tasked to\n"
767 .title
= "ROUTING PROBLEM",
768 .map_name
= "cmp_routing",
770 "Things can get a little chaotic on tight boards, do your\n"
771 "best to utilize principle 5 to get the job done\n",
777 .title
= "PRINCIPLE 6",
778 .map_name
= "cmp_b11",
780 "While hovering over a simple tile peice, right click and\n"
781 "drag to start creating a wire. These can be connected to\n"
782 "the left, or right recieving pins of a Twisty Turny(TM).\n"
784 "Once connected, the Twisty Turny(TM) will no longer\n"
785 "'flip flop' as marbles run through them, but instead be\n"
786 "et to left or right rotating only. As indicated by the\n"
787 "status arrow beneath them\n"
789 "When the left or right slot is triggered, the Twisty\n"
790 "Turny(TM) will switch modes according to that input.\n"
792 "Trigger wires apply instantaneously, however if both the\n"
793 "left and right inputs are recieved at the same time,\n"
794 "this results in no operation being performed, and no\n"
795 "state changes take place in the Twisty Turny(TM)\n",
803 .map_name
= "cmp_not",
805 "Test your knowledge of triggers, build an 'NOT GATE'\n"
806 "emulated by marble logic.",
814 .map_name
= "cmp_and",
816 "A slightly more complicated gate, but shouldn't be\n"
817 "too difficult for your skillset.",
823 .title
= "QUALIFICATION PROJECT",
824 .map_name
= "cmp_grad",
826 "There's no instructions here, resolve and complete this\n"
827 "task to qualify yourself as an official marble engineer",
832 static struct cmp_level cmp_levels_grad
[] =
837 .map_name
= "cmp_i01",
839 "Device a scheme to filter and sort the inputs. If you\n"
840 "believe you lack the tools required to solve this one,\n"
841 "take a harder look at the inputs.",
848 .map_name
= "cmp_i02",
850 "Split the inputs up into a third of their values\n"
852 "Is this possible? -HG",
859 .map_name
= "cmp_xor",
861 "Significantly more complicated than an AND or NOT gate,\n"
867 .title
= "SECRET CODE",
868 .map_name
= "cmp_secret",
870 "Only one input should send an unlock signal marble to\n"
876 #define NUM_CAMPAIGN_LEVELS (vg_list_size( cmp_levels_tutorials ) + vg_list_size( cmp_levels_basic ) + vg_list_size( cmp_levels_grad ))
886 static struct serializable_set
888 struct cmp_level
*pack
;
891 career_serializable
[] =
894 .pack
= cmp_levels_tutorials
,
895 .count
= vg_list_size( cmp_levels_tutorials
)
898 .pack
= cmp_levels_basic
,
899 .count
= vg_list_size( cmp_levels_basic
)
902 .pack
= cmp_levels_grad
,
903 .count
= vg_list_size( cmp_levels_grad
)
907 // Setup pointers and that
908 static void career_local_data_init(void)
910 struct cmp_level
*level_ptrs
[ NUM_CAMPAIGN_LEVELS
];
913 for( int i
= 0; i
< vg_list_size( career_serializable
); i
++ )
915 struct serializable_set
*set
= &career_serializable
[i
];
917 for( int j
= 0; j
< set
->count
; j
++ )
918 level_ptrs
[ set
->pack
[j
].serial_id
] = &set
->pack
[j
];
922 for( int i
= 0; i
< vg_list_size( career_serializable
); i
++ )
924 struct serializable_set
*set
= &career_serializable
[i
];
926 for( int j
= 0; j
< set
->count
; j
++ )
928 struct cmp_level
*lvl
= &set
->pack
[j
];
929 lvl
->unlock
= lvl
->_unlock
? level_ptrs
[ lvl
->_unlock
]: NULL
;
930 lvl
->linked
= lvl
->_linked
? level_ptrs
[ lvl
->_linked
]: NULL
;