1 // ==========================
2 // Monster Config Generator
3 // ==========================
5 void M_Config_Queue_Swap(float root, float child, entity pass)
7 string oldroot = mon_config_queue[root];
8 mon_config_queue[root] = mon_config_queue[child];
9 mon_config_queue[child] = oldroot;
12 float M_Config_Queue_Compare(float root, float child, entity pass)
16 for(i = 1; i <= 100; ++i)
18 r = str2chr(mon_config_queue[root], i);
19 c = str2chr(mon_config_queue[child], i);
20 if(r == c) { continue; }
21 else if(c > r) { return -1; }
28 void Dump_Monster_Settings(void)
30 float i, x, totalsettings = 0;
31 for(i = MON_FIRST; i <= MON_LAST; ++i)
33 // step 1: clear the queue
35 for(x = 0; x <= MAX_MON_CONFIG; ++x)
36 { mon_config_queue[x] = string_null; }
38 // step 2: build new queue
39 MON_ACTION(i, MR_CONFIG);
42 heapsort(MON_CONFIG_COUNT, M_Config_Queue_Swap, M_Config_Queue_Compare, world);
44 // step 4: write queue
45 MON_CONFIG_WRITETOFILE(sprintf("// {{{ #%d: %s\n", i, M_NAME(i)))
46 for(x = 0; x <= MON_CONFIG_COUNT; ++x)
47 { MON_CONFIG_WRITETOFILE(mon_config_queue[x]) }
48 MON_CONFIG_WRITETOFILE("// }}}\n")
51 print(sprintf("#%d: %s: %d settings...\n", i, M_NAME(i), MON_CONFIG_COUNT));
52 totalsettings += MON_CONFIG_COUNT;
55 // clear queue now that we're finished
57 for(x = 0; x <= MAX_MON_CONFIG; ++x)
58 { mon_config_queue[x] = string_null; }
61 print(sprintf("Totals: %d monsters, %d settings\n", (i - 1), totalsettings));