-
Notifications
You must be signed in to change notification settings - Fork 26
/
mod_loader.cpp
2676 lines (2122 loc) · 127 KB
/
mod_loader.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "mod_loader.h"
#include <cmath>
#include "func.h"
using namespace std;
using namespace Debugger;
void Mod::print_effect_numbers(FILE *fil){
fprintf(fil, "//effect numbers:\n");
fprintf(fil, "0=nothing\n");
fprintf(fil, "1=multiply creature speed by parameter3 for time parameter1 with creature visual effect from weapon parameter2, parameter4=disable speed change when bullet hits (0=no/1=yes)\n");
fprintf(fil, "2=start alien attack\n");
fprintf(fil, "3=drop item parameter1, amount parameter2, random area size parameter3 pixels, maximum amount of similar items in area parameter4 (0=infinite)\n");
fprintf(fil, "4=increase creature's bar parameter3 with parameter1 (if parameter2=1, don't increase over maximum or decrease below minimum)\n");
fprintf(fil, "5=activate scanner with distance parameter1\n");
fprintf(fil, "6=set targeting beam, type parameter1 (0=disabled, 1=normal, 2=turns green when hits enemy), length = parameter2 + weapon length * parameter3\n");
fprintf(fil, "7=set light parameter1 size parameter2 to creature (if parameter1=-1, disable light)\n");
fprintf(fil, "8=set light level addition, parameter1=type (0=map tiles, 1=items/plot_objects, 2=props, 3=creatures), parameter2=r, parameter3=g, parameter4=b\n");
fprintf(fil, "9=select gun parameter1\n");
fprintf(fil, "10=drop creature number parameter1 side parameter2 (-1=same side) tactic parameter3 (-1=default) tactic2 parameter4 (-1=default). Player can switch between a friendly creature's tactics by right clicking the creature. Don't forget to set parameter3 to -1 if you're not planning on changing the default tactic specified in creatures.dat.\n");
fprintf(fil, "11=change maximum bar parameter1 amount by parameter2\n");
fprintf(fil, "12=change armor level to parameter1\n");
fprintf(fil, "13=enable creature detector with distance parameter1\n");
fprintf(fil, "14=play sound parameter1 (from sounds.dat) with volume parameter2\n");
fprintf(fil, "15=change creature into creature number parameter1 for time parameter2 (-1 for infinite) with creature visual effect from weapon parameter3\n");
fprintf(fil, "16=give item parameter1 amount parameter2, parameter3=inventory number\n");
fprintf(fil, "17=set creature's bar parameter3 to parameter1\n");
fprintf(fil, "18=increase player's body temperature by parameter1\n");
fprintf(fil, "19=drop plot_object parameter1, object size parameter2, random area size parameter3 pixels, maximum amount of similar items in area parameter4 (0=infinite)\n");
fprintf(fil, "20=enable large map\n");
fprintf(fil, "21=teleport to area parameter1 (if -1, game finds the right area) plot_object parameter2, parameter3: 0=don't transfer other creatures 1=transfer other creatures\n");
fprintf(fil, "22=change side to parameter1 target for time parameter2 (-1=infinite) with creature visual effect from weapon parameter3\n");
fprintf(fil, "23=continuously increase bar parameter3 by parameter1 for time parameter4 with creature visual effect from weapon parameter2\n");
fprintf(fil, "24=fire weapon parameter1, times parameter2, (parameter3, 0=normal direction, 1=towards nearest enemy, 2=random direction, 3=shoot in direction parameter4), parameter4=shoot direction (only applicable if parameter3=3)\n");
fprintf(fil, "25=show animation parameter1, and if (parameter2, 0=continue game, 1=end game)\n");
fprintf(fil, "26=fire particle parameter1 times parameter2 with parameters (spread, speed, time) taken from weapon number parameter3\n");
fprintf(fil, "27=make light number parameter1 for time parameter2 (-1=infinite) size min parameter3, max parameter4\n");
fprintf(fil, "28=bar parameter1 increased by bar parameter2 * parameter3\n");
fprintf(fil, "29=run script parameter1, parameter2=check conditions (0=no, 1=yes)\n");
fprintf(fil, "30=set creature's eat item amount to parameter1\n");
fprintf(fil, "31=kill creature (set all bars to minimum)\n");
fprintf(fil, "32=change creature's anger level to parameter1 (between 0 and 1)\n");
fprintf(fil, "33=stagger mouse by parameter1, speed parameter2 for time parameter3\n");
fprintf(fil, "34=change player race into parameter1\n");
fprintf(fil, "35=activate/disable script parameter1, (parameter2: 0=disable, 1=activate)\n");
fprintf(fil, "36=shake screen power parameter1 time parameter2 milliseconds\n");
fprintf(fil, "37=start rain for time parameter1 (0=stop rain)\n");
fprintf(fil, "38=change game speed to parameter1 (don't set it to negative)\n");
fprintf(fil, "39=show bar parameter1\n");
fprintf(fil, "40=destroy plot_objects parameter1 from area size parameter2 pixels (not entirely accurate, use with care)\n");
fprintf(fil, "41=destroy items parameter1 from area size parameter2 pixels (not entirely accurate, use with care), parameter3=maximum amount of items to delete (0=all)\n");
fprintf(fil, "42=increase maximum carry weight by parameter1\n");
fprintf(fil, "43=return creature to previous frame position\n");
fprintf(fil, "44=increase player's bar parameter3 with parameter1 (if parameter2=1, don't increase over maximum or decrease below minimum)\n");
fprintf(fil, "45=prevent creature from using weapon parameter1 (-1=all weapons) for time parameter2, with creature visual effect from weapon parameter3, parameter4: 0=individual weapons 1=weapon classes\n");
fprintf(fil, "46=change creature's AI tactic parameter1 (0=primary, 1=secondary) to parameter2\n");
fprintf(fil, "47=start dialog parameter1 (from dialogs.dat)\n");
fprintf(fil, "48=pick up nearest creature of (parameter1, 0=type, 1=class) parameter2, maximum distance parameter3, side parameter4 (-1=same, -2=any)\n");
fprintf(fil, "49=attach camera to (parameter1, -1=player, 0=this creature [distance parameter2 from head], 1=this position), for time parameter3 (-1=infinite)\n");
fprintf(fil, "50=player controls nearest creature of (parameter1, 0=type, 1=class) parameter2, maximum distance parameter3, side parameter4 (-1=same, -2=any)\n");
fprintf(fil, "51=nearest creature of (parameter1, 0=type, 1=class) parameter2, maximum distance parameter3, side parameter4 (-1=same, -2=any) picks up this creature\n");
fprintf(fil, "52=active inventory=parameter1 (0 to 10)\n");
fprintf(fil, "53=continuously increase bar parameter3 by parameter1 for time parameter4 with creature visual effect from weapon parameter2, cap at maximum\n");
fprintf(fil, "54=make creature vanish for time parameter1 milliseconds\n");
fprintf(fil, "55=make mouse (parameter1, 0=invisible, 1=visible)\n");
fprintf(fil, "56=override control type (parameter1, -1=default, 0=absolute, 1=relative, 2=vehicle)\n");
fprintf(fil, "57=skip to day of journal (parameter1, 0=next day, 1 and above=skip to day number) This effect doesn't affect the time of the day.\n");
fprintf(fil, "58=player (parameter1, 0=cannot, 1=can) view the inventory\n");
fprintf(fil, "59=use player's item parameter1 if there is one\n");
fprintf(fil, "60=player (parameter1, 0=cannot, 1=can) drop items\n");
fprintf(fil, "61=play song number parameter1 from music.dat\n");
fprintf(fil, "62=(parameter1, 0=close, 1=open) inventory\n");
fprintf(fil, "63=set random value (between parameter1 and parameter2) to bar parameter3, (parameter4, 0=set value, 1=add to bar) (this effect caps at bar min & max)\n");
fprintf(fil, "64=(parameter1, 0=hide, 1=show) radar\n");
fprintf(fil, "\n");
fprintf(fil, "\n");
fprintf(fil, "//condition numbers:\n");
fprintf(fil, "0=must have item parameter0 amount parameter1\n");
fprintf(fil, "1=must be distance parameter1 + object size from plot_object parameter0\n");
fprintf(fil, "2=must be distance parameter1 + object size from plot_object class parameter0\n");
fprintf(fil, "3=creature's bar parameter0 is greater or equal to parameter1\n");
fprintf(fil, "4=killed all creatures parameter0 from area parameter1 (-1=current area)\n");
fprintf(fil, "5=creature's bar parameter0 is smaller than parameter1\n");
fprintf(fil, "6=player is race parameter0\n");
fprintf(fil, "7=player is not race parameter0\n");
fprintf(fil, "8=random integer between 0 and parameter0 is 0\n");
fprintf(fil, "9=player (parameter0, 0=is, 1=is not) in shade\n");
fprintf(fil, "10=creature has eaten parameter0 eat items\n");
fprintf(fil, "11=item parameter0 is (parameter1=0=wielded, parameter1=1=not wielded)\n");
fprintf(fil, "12=game difficulty is (parameter0, 0=higher than, 1=lower than, 2=equal to) parameter1 (0=easy, 1=normal, 2=hard)\n");
fprintf(fil, "13=area (parameter1, 0=is, 1=is not) parameter0\n");
fprintf(fil, "14=creature nearer than distance parameter1 + creature size pixels from creature parameter0\n");
fprintf(fil, "15=player is nearer than parameter0 pixels\n");
fprintf(fil, "16=player has parameter0 free weight\n");
fprintf(fil, "17=(parameter1, 0=is, 1=is not) on terrain parameter0\n");
fprintf(fil, "18=creature's bar parameter0's maximum amount is bigger than or equal to parameter1\n");
fprintf(fil, "19=creature's AI tactic parameter0 (0=primary, 1=secondary) is parameter1\n");
fprintf(fil, "20=creature's anger level is (parameter0: 0=bigger than or equal to, 1=smaller than) parameter1\n");
fprintf(fil, "21=creature is of side parameter0\n");
fprintf(fil, "22=creature is of (parameter1: 0=type, 1=class) parameter0\n");
fprintf(fil, "23=creature (parameter0: 0=is, 1=is not) player\n");
fprintf(fil, "24=player's bar parameter0 is greater or equal to parameter1\n");
fprintf(fil, "25=player's bar parameter0 is smaller than parameter1\n");
fprintf(fil, "26=creature is not of (parameter1: 0=type, 1=class) parameter0\n");
fprintf(fil, "27=creature's last dialog (parameter1: 0=was, 1=was not) parameter0\n");
fprintf(fil, "28=it (parameter0: 0=is, 1=is not) raining\n");
fprintf(fil, "29=amount of parameter0 (-1=all) creatures in area is higher than or equal to parameter1\n");
fprintf(fil, "30=amount of parameter0 (-1=all) creatures in area is lower than parameter1\n");
fprintf(fil, "31=amount of parameter0 class creatures in area is higher than or equal to parameter1\n");
fprintf(fil, "32=amount of parameter0 class creatures in area is lower than parameter1\n");
fprintf(fil, "33=creature (parameter0, 0=is, 1=is not) being carried by another creature\n");
fprintf(fil, "34=creature (parameter0, 0=is, 1=is not) carrying another creature\n");
fprintf(fil, "35=must be distance parameter1 from item parameter0\n");
}
void Mod::load_item_info(const string& filename){//loads object info from file
debug->debug_output("Load file "+filename,Action::START,Logfile::STARTUP);
FILE *fil;
char rivi[2000];
general_items.clear();
//seen_item_text.clear();
//quick_keys.clear();
fil = fopen(filename.c_str(),"rt");
if(fil){
general_item_base temp_item;
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_of_file")!=0){//object name
temp_item.name=rivi;
debug->debug_output("Load "+temp_item.name,Action::START,Logfile::STARTUP);
temp_item.identifier=atoi(stripped_fgets(rivi,sizeof(rivi),fil));//identifier
temp_item.item_class=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_item.weight=atof(stripped_fgets(rivi,sizeof(rivi),fil));
stripped_fgets(rivi,sizeof(rivi),fil);
temp_item.description=rivi;
stripped_fgets(rivi,sizeof(rivi),fil);
temp_item.event_text=rivi;
temp_item.size=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_item.show_on_radar=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_item.show_on_radar_particle=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_item.visible_in_inventory=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
//load texture
stripped_fgets(rivi,sizeof(rivi),fil);
temp_item.texture_name=rivi;
temp_item.texture=resources->load_texture(rivi,mod_name);
temp_item.wielded_script=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_item.wielded_disabling_script=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_item.show_condition_help=strtobool(stripped_fgets(rivi,sizeof(rivi),fil));
//wield slots
temp_item.wield_slots.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_wield_slots")!=0){
temp_item.wield_slots.push_back(atoi(rivi));
}
//uses
temp_item.effects.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_effects_block")!=0){
item_effect_base temp_effect;
temp_effect.effect.event_text=rivi;
temp_effect.effect.event_failure_text=stripped_fgets(rivi,sizeof(rivi),fil);
temp_effect.effect.sound=-1;
temp_effect.effect.sound_name=stripped_fgets(rivi,sizeof(rivi),fil);
if(temp_effect.effect.sound_name!="none")temp_effect.effect.sound=resources->load_sample(rivi,2,mod_name);//hit sound
temp_effect.effect.vanish_after_used=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect.use_key=string(stripped_fgets(rivi,sizeof(rivi),fil)).at(0);
temp_effect.quick_key=string(stripped_fgets(rivi,sizeof(rivi),fil)).at(0);
/*if(temp_effect.quick_key!=0){
quick_uses key;
key.item_type=temp_item.identifier;
key.key=temp_effect.quick_key;
quick_keys.push_back(key);
}*/
//conditions
temp_effect.effect.conditions.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_conditions")!=0){
condition temp_effect_condition;
temp_effect_condition.condition_number=atoi(rivi);
temp_effect_condition.condition_parameter0=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_condition.condition_parameter1=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect.effect.conditions.push_back(temp_effect_condition);
}
//effects
temp_effect.effect.effects.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_effects")!=0){
effect temp_effect_effect;
temp_effect_effect.effect_number=atoi(rivi);
temp_effect_effect.parameter1=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_effect.parameter2=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_effect.parameter3=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_effect.parameter4=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect.effect.effects.push_back(temp_effect_effect);
}
temp_item.effects.push_back(temp_effect);
}
//combinations
temp_item.combinations.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_combinations")!=0){
combines temp_combination;
temp_combination.discard_this=strtobool(rivi);
temp_combination.combines_with=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_combination.discard_that=strtobool(stripped_fgets(rivi,sizeof(rivi),fil));
temp_combination.combine_puzzle_difficulty=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_combination.can_be_broken_up=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_combination.combine_results.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_items_given")!=0){
combines::combine_results_base temp_result;
temp_result.combines_to=atoi(rivi);
temp_result.combines_amount=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_combination.combine_results.push_back(temp_result);
}
temp_item.combinations.push_back(temp_combination);
}
//if the identifier is bigger than current list size, increase list size
temp_item.dead=true;
while(general_items.size()<temp_item.identifier+1){
//put in dummy elements
general_items.push_back(temp_item);
//seen_item_text.push_back(false);
}
temp_item.dead=false;
general_items[temp_item.identifier]=temp_item;
//seen_item_text[temp_item.identifier]=false;
debug->debug_output("Load "+temp_item.name,Action::END,Logfile::STARTUP);
}
}
fclose(fil);
debug->debug_output("Load file "+filename,Action::END,Logfile::STARTUP);
//save
/*
filename=filename+'+';
fil = fopen(filename.c_str(),"wt");
general_item_base temp_item;
int a,b,c;
for(a=0;a<general_items.size();a++){
temp_item=general_items[a];
if(temp_item.dead)continue;
fprintf(fil, "%s;//name---------------------------------------\n", temp_item.name.c_str());
fprintf(fil, " %d;//identifier\n", temp_item.identifier);
fprintf(fil, " %d;//item class\n", temp_item.item_class);
fprintf(fil, " %f;//weight\n", temp_item.weight);
fprintf(fil, " %s;//short description\n", temp_item.description.c_str());
fprintf(fil, " %s;//first pick up text\n", temp_item.event_text.c_str());
fprintf(fil, " %f;//size on map\n", temp_item.size);
fprintf(fil, " %d;//show on radar 0=does not show, 1=show on scanner, 2=show even without scanner\n", temp_item.show_on_radar);
fprintf(fil, " %d;//particle to shown on radar\n", temp_item.show_on_radar_particle);
fprintf(fil, " %d;//visible in inventory 0=no (can only be used via quick keys), 1=yes\n", temp_item.visible_in_inventory);
fprintf(fil, " %s;//texture name\n", temp_item.texture_name.c_str());
fprintf(fil, " %d;//wielded script,-1=nothing, only applicable for wieldable items\n", temp_item.wielded_script);
fprintf(fil, " %d;//wielded item disabling script, -1=nothing, this script is only checked for conditions while the item is wielded, if the conditions prove false, the item is unwielded\n", temp_item.wielded_disabling_script);
fprintf(fil, " %d;//show help text for conditions\n", temp_item.show_condition_help);
fprintf(fil, " begin_wield_slots;\n");
for(b=0;b<temp_item.wield_slots.size();b++){
fprintf(fil, " %d;//wield slot number\n", temp_item.wield_slots[b]);
}
fprintf(fil, " end_wield_slots;\n");
fprintf(fil, " begin_effects_block;\n");
for(b=0;b<temp_item.effects.size();b++){
fprintf(fil, " %s;//event text\n", temp_item.effects[b].effect.event_text.c_str());
fprintf(fil, " %s;//event failure text\n", temp_item.effects[b].effect.event_failure_text.c_str());
fprintf(fil, " %s;//sound, none for nothing\n", temp_item.effects[b].effect.sound_name.c_str());
fprintf(fil, " %d;//vanishes after event, 0=no, 1=yes\n", temp_item.effects[b].effect.vanish_after_used);
fprintf(fil, " %c;//use key\n", temp_item.effects[b].use_key);
fprintf(fil, " %c;//quick key\n", temp_item.effects[b].quick_key);
fprintf(fil, " begin_conditions;\n");
for(c=0;c<temp_item.effects[b].effect.conditions.size();c++){
if(temp_item.effects[b].effect.conditions[c].condition_number>=0){
fprintf(fil, " %d;//use condition number\n", temp_item.effects[b].effect.conditions[c].condition_number);
fprintf(fil, " %f;//use condition parameter0\n", temp_item.effects[b].effect.conditions[c].condition_parameter0);
fprintf(fil, " %f;//use condition parameter1\n", temp_item.effects[b].effect.conditions[c].condition_parameter1);
}
}
fprintf(fil, " end_conditions;\n");
fprintf(fil, " begin_effects;\n");
for(c=0;c<temp_item.effects[b].effect.effects.size();c++){
fprintf(fil, " %d;//effect number\n", temp_item.effects[b].effect.effects[c].effect_number);
fprintf(fil, " %f;//parameter1\n", temp_item.effects[b].effect.effects[c].parameter1);
fprintf(fil, " %f;//parameter2\n", temp_item.effects[b].effect.effects[c].parameter2);
fprintf(fil, " %f;//parameter3\n", temp_item.effects[b].effect.effects[c].parameter3);
fprintf(fil, " %f;//parameter4\n", temp_item.effects[b].effect.effects[c].parameter4);
}
fprintf(fil, " end_effects;\n");
}
fprintf(fil, " end_effects_block;\n");
fprintf(fil, " begin_combinations;\n");
for(b=0;b<temp_item.combinations.size();b++){
fprintf(fil, " %d;//discard this item after combine\n", temp_item.combinations[b].discard_this);
fprintf(fil, " %d;//combines with\n", temp_item.combinations[b].combines_with);
fprintf(fil, " %d;//discard that item after combine\n", temp_item.combinations[b].discard_that);
fprintf(fil, " %d;//combine time\n", temp_item.combinations[b].combine_puzzle_difficulty);
fprintf(fil, " %d;//can be broken up\n", temp_item.combinations[b].can_be_broken_up);
fprintf(fil, " begin_items_given;\n");
for(c=0;c<temp_item.combinations[b].combine_results.size();c++){
fprintf(fil, " %d;//result of combine\n", temp_item.combinations[b].combine_results[c].combines_to);
fprintf(fil, " %d;//amount to give\n", temp_item.combinations[b].combine_results[c].combines_amount);
}
fprintf(fil, " end_items_given;\n");
}
fprintf(fil, " end_combinations;\n");
}
fprintf(fil, "end_of_file;\n");
fprintf(fil, "\n");
fprintf(fil, "\n");
print_effect_numbers(fil);
fclose(fil);
*/
}
void Mod::load_object_info(const string& filename){//loads object info from file
debug->debug_output("Load file "+filename,Action::START,Logfile::STARTUP);
FILE *fil;
char rivi[800];
//int object_infos=0;
general_objects.clear();
/* fil = fopen(filename.c_str(),"rt");
if(fil){
general_objects_base temp_object;
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_of_file")!=0){
temp_object.name=rivi;
temp_object.identifier=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
stripped_fgets(rivi,sizeof(rivi),fil);//texture name
//load texture if it's not loaded
temp_object.texture_name=rivi;
temp_object.texture=resources->load_texture(rivi);
temp_object.base_size=(float)atof(stripped_fgets(rivi,sizeof(rivi),fil));//base_size
temp_object.vary_size=(float)atof(stripped_fgets(rivi,sizeof(rivi),fil));//vary_size
temp_object.transparent=atoi(stripped_fgets(rivi,sizeof(rivi),fil));//transparency
temp_object.layer=atoi(stripped_fgets(rivi,sizeof(rivi),fil));//layer
temp_object.swing=atoi(stripped_fgets(rivi,sizeof(rivi),fil));//swing
temp_object.collision_type=0;
temp_object.passable_radius=(float)atof(stripped_fgets(rivi,sizeof(rivi),fil));//passable_radius
temp_object.collision_parameter0=temp_object.passable_radius;
temp_object.collision_parameter1=0;
if(temp_object.passable_radius==0)temp_object.collision_type=-1;
//if the identifier is bigger than current list size, increase list size
while(general_objects.size()<temp_object.identifier+1){
//put in dummy elements
general_objects.push_back(temp_object);
}
general_objects[temp_object.identifier]=temp_object;
}
}
fclose(fil);*/
fil = fopen(filename.c_str(),"rt");
if(fil){
general_objects_base temp_object;
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_of_file")!=0){
temp_object.name=rivi;
temp_object.identifier=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
//stripped_fgets(rivi,sizeof(rivi),fil);//texture name
//load texture if it's not loaded
//temp_object.texture_name=rivi;
//temp_object.texture=resources->load_texture(rivi,mod_name);
temp_object.animation_frames.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_animation_frames")!=0){
object_animation_frame_base temp_frame;
temp_frame.texture=resources->load_texture(rivi,mod_name);
temp_frame.texture_name=rivi;
temp_frame.time=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_object.animation_frames.push_back(temp_frame);
}
temp_object.base_size=(float)atof(stripped_fgets(rivi,sizeof(rivi),fil));//base_size
temp_object.vary_size=(float)atof(stripped_fgets(rivi,sizeof(rivi),fil));//vary_size
temp_object.transparent=atoi(stripped_fgets(rivi,sizeof(rivi),fil));//transparency
temp_object.layer=atoi(stripped_fgets(rivi,sizeof(rivi),fil));//layer
temp_object.swing=atoi(stripped_fgets(rivi,sizeof(rivi),fil));//swing
temp_object.get_transparent=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_object.provide_shade=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_object.collision_type=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_object.collision_parameter0=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_object.collision_parameter1=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_object.blocks_vision=strtobool(stripped_fgets(rivi,sizeof(rivi),fil));
temp_object.stops_bullets=strtobool(stripped_fgets(rivi,sizeof(rivi),fil));
temp_object.passable_radius=temp_object.collision_parameter0;
//if the identifier is bigger than current list size, increase list size
temp_object.dead=true;
while(general_objects.size()<temp_object.identifier+1){
//put in dummy elements
general_objects.push_back(temp_object);
}
temp_object.dead=false;
general_objects[temp_object.identifier]=temp_object;
}
}
fclose(fil);
debug->debug_output("Load file "+filename,Action::END,Logfile::STARTUP);
//save
/*
filename=filename+'+';
fil = fopen(filename.c_str(),"wt");
general_objects_base temp_item;
int a,b;
for(a=0;a<general_objects.size();a++){
temp_item=general_objects[a];
if(temp_item.dead)continue;
fprintf(fil, "%s;//name---------------------------------------\n", temp_item.name.c_str());
fprintf(fil, " %d;//identifier\n", temp_item.identifier);
fprintf(fil, " begin_animation_frames;\n");
for(b=0;b<temp_item.animation_frames.size();b++){
fprintf(fil, " %s;//texture name\n", temp_item.animation_frames[b].texture_name.c_str());
fprintf(fil, " %f;//time to display frame\n", temp_item.animation_frames[b].time);
}
fprintf(fil, " end_animation_frames;\n");
//fprintf(fil, " %s;//texture name\n", temp_item.texture_name.c_str());
fprintf(fil, " %f;//size*128\n", temp_item.base_size);
fprintf(fil, " %f;//vary size\n", temp_item.vary_size);
fprintf(fil, " %d;//transparent\n", temp_item.transparent);
fprintf(fil, " %d;//layer\n", temp_item.layer);
fprintf(fil, " %d;//does it sway with the wind\n", temp_item.swing);
fprintf(fil, " %d;//gets transparent when player near\n", temp_item.get_transparent);
fprintf(fil, " %d;//provides shade for player\n", temp_item.provide_shade);
fprintf(fil, " %d;//collision detection type, -1=none, 0=circle radius parameter0, 1=polygon parameter0 from polygons.dat size parameter1\n", temp_item.collision_type);
fprintf(fil, " %f;//collision detection parameter0\n", temp_item.collision_parameter0);
fprintf(fil, " %f;//collision detection parameter1\n", temp_item.collision_parameter1);
fprintf(fil, " %d;//Block vision. If 1, enemies and player cannot see other creatures through it. Use sparingly, this slows the AI down.\n", temp_item.blocks_vision);
fprintf(fil, " %d;//Stops bullets. Use sparingly as this can slow the game down a lot.\n", temp_item.stops_bullets);
}
fprintf(fil, "end_of_file;\n");
fclose(fil);
*/
}
void Mod::load_creature_info(const string& filename){//loads object info from file
debug->debug_output("Load file "+filename,Action::START,Logfile::STARTUP);
FILE *fil;
char rivi[2000];
general_creatures.clear();
fil = fopen(filename.c_str(),"rt");
if(fil){
general_creatures_base temp_creature;
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_of_file")!=0){//object name
temp_creature.name=rivi;
debug->debug_output("Load "+temp_creature.name,Action::START,Logfile::STARTUP);
temp_creature.identifier=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.creature_class=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
stripped_fgets(rivi,sizeof(rivi),fil);//texture name
//load texture if it's not loaded
temp_creature.texture=resources->load_texture(rivi,mod_name);
temp_creature.texture_name=rivi;
temp_creature.layer=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.corpse_item=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.corpse_item_amount=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.close_combat=strtobool(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.particle_on_radar=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.AI_tactics[0]=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.AI_tactics[1]=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.footsteps=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.die_after_seconds=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.eat_item=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.size=(float)atof(stripped_fgets(rivi,sizeof(rivi),fil));//size
temp_creature.weight=(float)atof(stripped_fgets(rivi,sizeof(rivi),fil));//size
temp_creature.movement_speed=(float)atof(stripped_fgets(rivi,sizeof(rivi),fil));//speed
temp_creature.minimum_movement_speed=(float)atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.leg_animation_speed=(float)atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.turn_speed=(float)atof(stripped_fgets(rivi,sizeof(rivi),fil));//speed
temp_creature.inertia=(float)atof(stripped_fgets(rivi,sizeof(rivi),fil));//speed
temp_creature.hide_behind_walls=strtobool(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.weapon=atoi(stripped_fgets(rivi,sizeof(rivi),fil));//weapon
temp_creature.weapon_x=(float)atof(stripped_fgets(rivi,sizeof(rivi),fil));//weapon_x
temp_creature.weapon_y=(float)atof(stripped_fgets(rivi,sizeof(rivi),fil));//weapon_y
temp_creature.blood=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.bars_visible=strtobool(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.death_animation_speed=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.can_change_area=strtobool(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.AI_hear_range=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.AI_see_range=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.AI_see_angle=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.footstep_sounds.clear();
temp_creature.footstep_sound_names.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_footstep_sounds")!=0){
temp_creature.footstep_sounds.push_back(resources->load_sample(rivi,2,mod_name));
temp_creature.footstep_sound_names.push_back(rivi);
}
temp_creature.hit_sound.clear();
temp_creature.hit_sound_names.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_hit_sounds")!=0){
temp_creature.hit_sound.push_back(resources->load_sample(rivi,2,mod_name));
temp_creature.hit_sound_names.push_back(rivi);
}
temp_creature.die_sound.clear();
temp_creature.die_sound_names.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_die_sounds")!=0){
temp_creature.die_sound.push_back(resources->load_sample(rivi,2,mod_name));
temp_creature.die_sound_names.push_back(rivi);
}
//eat block
temp_creature.eat_block.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_eat_block")!=0){
general_creatures_base::effect_block temp_effect;
//conditions
temp_effect.conditions.clear();
//stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_conditions")!=0){
Mod::condition temp_effect_condition;
temp_effect_condition.condition_number=atoi(rivi);
temp_effect_condition.condition_parameter0=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_condition.condition_parameter1=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect.conditions.push_back(temp_effect_condition);
}
//effects
temp_effect.effects.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_effects")!=0){
Mod::effect temp_effect_effect;
temp_effect_effect.effect_number=atoi(rivi);
temp_effect_effect.parameter1=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_effect.parameter2=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_effect.parameter3=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_effect.parameter4=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect.effects.push_back(temp_effect_effect);
}
temp_creature.eat_block.push_back(temp_effect);
}
//death block
temp_creature.death_block.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_death_block")!=0){
general_creatures_base::death_effect_block temp_effect;
temp_effect.death_type=atoi(rivi);
//conditions
temp_effect.conditions.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_conditions")!=0){
Mod::condition temp_effect_condition;
temp_effect_condition.condition_number=atoi(rivi);
temp_effect_condition.condition_parameter0=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_condition.condition_parameter1=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect.conditions.push_back(temp_effect_condition);
}
//effects
temp_effect.effects.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_effects")!=0){
Mod::effect temp_effect_effect;
temp_effect_effect.effect_number=atoi(rivi);
temp_effect_effect.parameter1=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_effect.parameter2=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_effect.parameter3=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_effect.parameter4=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect.effects.push_back(temp_effect_effect);
}
temp_creature.death_block.push_back(temp_effect);
}
//hit block
temp_creature.hit_block.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_hit_block")!=0){
general_creatures_base::effect_block temp_effect;
//conditions
temp_effect.conditions.clear();
//stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_conditions")!=0){
Mod::condition temp_effect_condition;
temp_effect_condition.condition_number=atoi(rivi);
temp_effect_condition.condition_parameter0=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_condition.condition_parameter1=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect.conditions.push_back(temp_effect_condition);
}
//effects
temp_effect.effects.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_effects")!=0){
Mod::effect temp_effect_effect;
temp_effect_effect.effect_number=atoi(rivi);
temp_effect_effect.parameter1=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_effect.parameter2=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_effect.parameter3=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_effect.parameter4=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect.effects.push_back(temp_effect_effect);
}
temp_creature.hit_block.push_back(temp_effect);
}
//timed block
temp_creature.timed_block.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_timed_block")!=0){
general_creatures_base::timed_effect_block temp_effect;
temp_effect.interval=atoi(rivi);
//conditions
temp_effect.conditions.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_conditions")!=0){
Mod::condition temp_effect_condition;
temp_effect_condition.condition_number=atoi(rivi);
temp_effect_condition.condition_parameter0=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_condition.condition_parameter1=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect.conditions.push_back(temp_effect_condition);
}
//effects
temp_effect.effects.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_effects")!=0){
Mod::effect temp_effect_effect;
temp_effect_effect.effect_number=atoi(rivi);
temp_effect_effect.parameter1=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_effect.parameter2=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_effect.parameter3=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect_effect.parameter4=atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_effect.effects.push_back(temp_effect_effect);
}
temp_creature.timed_block.push_back(temp_effect);
}
//specialties
temp_creature.specialties.clear();
stripped_fgets(rivi,sizeof(rivi),fil);
while(strcmp(stripped_fgets(rivi,sizeof(rivi),fil),"end_specialties")!=0){
general_creatures_base::creature_specialty temp_specialty;
//temp_specialty.description="";
temp_specialty.description=rivi;
temp_specialty.number=atoi(stripped_fgets(rivi,sizeof(rivi),fil));
//temp_specialty.number=atoi(rivi);
temp_specialty.parameter0=(float)atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_specialty.parameter1=(float)atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_specialty.parameter2=(float)atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_specialty.parameter3=(float)atof(stripped_fgets(rivi,sizeof(rivi),fil));
temp_creature.specialties.push_back(temp_specialty);
}
//if the identifier is bigger than current list size, increase list size
temp_creature.dead=true;
while(general_creatures.size()<temp_creature.identifier+1){
//put in dummy elements
general_creatures.push_back(temp_creature);
}
temp_creature.dead=false;
general_creatures[temp_creature.identifier]=temp_creature;
debug->debug_output("Load "+temp_creature.name,Action::END,Logfile::STARTUP);
}
}
fclose(fil);
debug->debug_output("Load file " + filename,Action::END,Logfile::STARTUP);
//save
/*
int i,b,c;
filename=filename+'+';
fil = fopen(filename.c_str(),"wt");
general_creatures_base temp_item;
for(int a=0;a<general_creatures.size();a++){
temp_item=general_creatures[a];
if(temp_item.dead)continue;
fprintf(fil, "%s;//name---------------------------------------\n", temp_item.name.c_str());
fprintf(fil, " %d;//identifier\n", temp_item.identifier);
fprintf(fil, " %d;//class\n", temp_item.creature_class);
fprintf(fil, " %s;//texture\n", temp_item.texture_name.c_str());
fprintf(fil, " %d;//draw layer\n", temp_item.layer);
fprintf(fil, " %d;//corpse item number in items.dat, -1=nothing, -2=whole corpse vanishes when dead\n", temp_item.corpse_item);
fprintf(fil, " %d;//corpse item amount\n", temp_item.corpse_item_amount);
fprintf(fil, " %d;//attack type, 0=shooting attack, 1=close combat\n", temp_item.close_combat);
fprintf(fil, " %d;//particle to show on radar, -1=none\n", temp_item.particle_on_radar);
fprintf(fil, " %d;//primary AI tactic from AI_tactic.dat\n", temp_item.AI_tactics[0]);
fprintf(fil, " %d;//secondary AI tactic from AI_tactic.dat\n", temp_item.AI_tactics[1]);
fprintf(fil, " %d;//footstep particle from particles.dat\n", temp_item.footsteps);
fprintf(fil, " %d;//die after how many seconds, 0=doesn't die\n", temp_item.die_after_seconds);
fprintf(fil, " %d;//eat item number from items.dat, -1=nothing\n", temp_item.eat_item);
fprintf(fil, " %f;//creature size\n", temp_item.size);
fprintf(fil, " %f;//creature weight (affects pushing)\n", temp_item.weight);
fprintf(fil, " %f;//maximum movement speed\n", temp_item.movement_speed);
fprintf(fil, " %f;//minimum movement speed\n", temp_item.minimum_movement_speed);
fprintf(fil, " %f;//leg animation speed\n", temp_item.leg_animation_speed);
fprintf(fil, " %f;//turn speed\n", temp_item.turn_speed);
fprintf(fil, " %f;//inertia level (acceleration/deceleration)\n", temp_item.inertia);
fprintf(fil, " %d;//hide when behind walls\n", temp_item.hide_behind_walls);
fprintf(fil, " %d;//weapon number\n", temp_item.weapon);
fprintf(fil, " %f;//weapon_x\n", temp_item.weapon_x);
fprintf(fil, " %f;//weapon_y\n", temp_item.weapon_y);
fprintf(fil, " %d;//blood particle\n", temp_item.blood);
fprintf(fil, " %d;//bars visible when player hovers mouse on top\n", temp_item.bars_visible);
fprintf(fil, " %f;//death animation speed\n", temp_item.death_animation_speed);
fprintf(fil, " %d;//creature can move from area to another\n", temp_item.can_change_area);
fprintf(fil, " %f;//AI hear range\n", temp_item.AI_hear_range);
fprintf(fil, " %f;//AI see range\n", temp_item.AI_see_range);
fprintf(fil, " %f;//AI see angle\n", temp_item.AI_see_angle);
fprintf(fil, " begin_footstep_sounds\n");
for(i=0;i<temp_item.footstep_sound_names.size();i++){
fprintf(fil, " %s;//sample name\n", temp_item.footstep_sound_names[i].c_str());
}
fprintf(fil, " end_footstep_sounds\n");
fprintf(fil, " begin_hit_sounds\n");
for(i=0;i<temp_item.hit_sound_names.size();i++){
fprintf(fil, " %s;//sample name\n", temp_item.hit_sound_names[i].c_str());
}
fprintf(fil, " end_hit_sounds\n");
fprintf(fil, " begin_die_sounds\n");
for(i=0;i<temp_item.die_sound_names.size();i++){
fprintf(fil, " %s;//sample name\n", temp_item.die_sound_names[i].c_str());
}
fprintf(fil, " end_die_sounds\n");
//eat block
fprintf(fil, " begin_eat_block\n");
for(b=0;b<temp_item.eat_block.size();b++){
fprintf(fil, " begin_conditions;\n");
for(c=0;c<temp_item.eat_block[b].conditions.size();c++){
if(temp_item.eat_block[b].conditions[c].condition_number>=0){
fprintf(fil, " %d;//condition number\n", temp_item.eat_block[b].conditions[c].condition_number);
fprintf(fil, " %f;//condition parameter0\n", temp_item.eat_block[b].conditions[c].condition_parameter0);
fprintf(fil, " %f;//condition parameter1\n", temp_item.eat_block[b].conditions[c].condition_parameter1);
}
}
fprintf(fil, " end_conditions;\n");
fprintf(fil, " begin_effects;\n");
for(c=0;c<temp_item.eat_block[b].effects.size();c++){
fprintf(fil, " %d;//effect number\n", temp_item.eat_block[b].effects[c].effect_number);
fprintf(fil, " %f;//parameter1\n", temp_item.eat_block[b].effects[c].parameter1);
fprintf(fil, " %f;//parameter2\n", temp_item.eat_block[b].effects[c].parameter2);
fprintf(fil, " %f;//parameter3\n", temp_item.eat_block[b].effects[c].parameter3);
fprintf(fil, " %f;//parameter4\n", temp_item.eat_block[b].effects[c].parameter4);
}
fprintf(fil, " end_effects;\n");
}
fprintf(fil, " end_eat_block\n");
//death block
fprintf(fil, " begin_death_block\n");
for(b=0;b<temp_item.death_block.size();b++){
fprintf(fil, " %d;//death type, 0=any death, 1=timed death, 2=killed by player\n", temp_item.death_block[b].death_type);
fprintf(fil, " begin_conditions;\n");
for(c=0;c<temp_item.death_block[b].conditions.size();c++){
if(temp_item.death_block[b].conditions[c].condition_number>=0){
fprintf(fil, " %d;//condition number\n", temp_item.death_block[b].conditions[c].condition_number);
fprintf(fil, " %f;//condition parameter0\n", temp_item.death_block[b].conditions[c].condition_parameter0);
fprintf(fil, " %f;//condition parameter1\n", temp_item.death_block[b].conditions[c].condition_parameter1);
}
}
fprintf(fil, " end_conditions;\n");
fprintf(fil, " begin_effects;\n");
for(c=0;c<temp_item.death_block[b].effects.size();c++){
fprintf(fil, " %d;//effect number\n", temp_item.death_block[b].effects[c].effect_number);
fprintf(fil, " %f;//parameter1\n", temp_item.death_block[b].effects[c].parameter1);
fprintf(fil, " %f;//parameter2\n", temp_item.death_block[b].effects[c].parameter2);
fprintf(fil, " %f;//parameter3\n", temp_item.death_block[b].effects[c].parameter3);
fprintf(fil, " %f;//parameter4\n", temp_item.death_block[b].effects[c].parameter4);
}
fprintf(fil, " end_effects;\n");
}
fprintf(fil, " end_death_block\n");
//hit block
fprintf(fil, " begin_hit_block\n");
for(b=0;b<temp_item.hit_block.size();b++){
fprintf(fil, " begin_conditions;\n");
for(c=0;c<temp_item.hit_block[b].conditions.size();c++){
if(temp_item.hit_block[b].conditions[c].condition_number>=0){
fprintf(fil, " %d;//condition number\n", temp_item.hit_block[b].conditions[c].condition_number);
fprintf(fil, " %f;//condition parameter0\n", temp_item.hit_block[b].conditions[c].condition_parameter0);
fprintf(fil, " %f;//condition parameter1\n", temp_item.hit_block[b].conditions[c].condition_parameter1);
}
}
fprintf(fil, " end_conditions;\n");
fprintf(fil, " begin_effects;\n");
for(c=0;c<temp_item.hit_block[b].effects.size();c++){
fprintf(fil, " %d;//effect number\n", temp_item.hit_block[b].effects[c].effect_number);
fprintf(fil, " %f;//parameter1\n", temp_item.hit_block[b].effects[c].parameter1);
fprintf(fil, " %f;//parameter2\n", temp_item.hit_block[b].effects[c].parameter2);
fprintf(fil, " %f;//parameter3\n", temp_item.hit_block[b].effects[c].parameter3);
fprintf(fil, " %f;//parameter4\n", temp_item.hit_block[b].effects[c].parameter4);
}
fprintf(fil, " end_effects;\n");
}
fprintf(fil, " end_hit_block\n");
//timed block
fprintf(fil, " begin_timed_block\n");
for(b=0;b<temp_item.timed_block.size();b++){
fprintf(fil, " %d;//interval in milliseconds\n", temp_item.timed_block[b].interval);
fprintf(fil, " begin_conditions;\n");
for(c=0;c<temp_item.timed_block[b].conditions.size();c++){
if(temp_item.timed_block[b].conditions[c].condition_number>=0){
fprintf(fil, " %d;//condition number\n", temp_item.timed_block[b].conditions[c].condition_number);
fprintf(fil, " %f;//condition parameter0\n", temp_item.timed_block[b].conditions[c].condition_parameter0);
fprintf(fil, " %f;//condition parameter1\n", temp_item.timed_block[b].conditions[c].condition_parameter1);
}
}
fprintf(fil, " end_conditions;\n");
fprintf(fil, " begin_effects;\n");
for(c=0;c<temp_item.timed_block[b].effects.size();c++){
fprintf(fil, " %d;//effect number\n", temp_item.timed_block[b].effects[c].effect_number);
fprintf(fil, " %f;//parameter1\n", temp_item.timed_block[b].effects[c].parameter1);
fprintf(fil, " %f;//parameter2\n", temp_item.timed_block[b].effects[c].parameter2);
fprintf(fil, " %f;//parameter3\n", temp_item.timed_block[b].effects[c].parameter3);
fprintf(fil, " %f;//parameter4\n", temp_item.timed_block[b].effects[c].parameter4);
}
fprintf(fil, " end_effects;\n");
}
fprintf(fil, " end_timed_block\n");
fprintf(fil, " begin_specialties\n");
for(i=0;i<temp_item.specialties.size();i++){
fprintf(fil, " %s;//description\n", temp_item.specialties[i].description.c_str());
fprintf(fil, " %d;//number\n", temp_item.specialties[i].number);
fprintf(fil, " %f;//parameter0\n", temp_item.specialties[i].parameter0);
fprintf(fil, " %f;//parameter1\n", temp_item.specialties[i].parameter1);
fprintf(fil, " %f;//parameter2\n", temp_item.specialties[i].parameter2);
fprintf(fil, " %f;//parameter3\n", temp_item.specialties[i].parameter3);
}
fprintf(fil, " end_specialties\n");
}
fprintf(fil, "end_of_file;\n");
fprintf(fil, "\n");
fprintf(fil, "\n");
fprintf(fil, "specialties:\n");
fprintf(fil, "0=has bar parameter0 from bars.dat with minimum parameter1 and maximum parameter2 and current value of parameter3 (if any bar reaches minimum, dies)\n");
fprintf(fil, "1=weapon class parameter0 damage is multiplied by parameter1\n");
fprintf(fil, "2=carries light parameter0 size parameter1 transparency parameter2, attached to (parameter3, 0=hands, 1=legs, 2=head)\n");
fprintf(fil, "\n");
fprintf(fil, "\n");
fprintf(fil, "Creature Block Templates\n");
fprintf(fil, "\n");
fprintf(fil, "[Eat Block]\n");
fprintf(fil, " begin_eat_block\n");
fprintf(fil, " begin_conditions;\n");
fprintf(fil, " end_conditions;\n");
fprintf(fil, " begin_effects;\n");
fprintf(fil, " end_effects;\n");
fprintf(fil, " end_eat_block\n");
fprintf(fil, "\n");
fprintf(fil, "[Death Block]\n");
fprintf(fil, " begin_death_block\n");
fprintf(fil, " 0;//death type, 0=any death, 1=timed death, 2=killed by player\n");
fprintf(fil, " begin_conditions;\n");
fprintf(fil, " end_conditions;\n");
fprintf(fil, " begin_effects;\n");
fprintf(fil, " end_effects;\n");
fprintf(fil, " end_death_block\n");
fprintf(fil, "\n");
fprintf(fil, "[Hit Block]\n");
fprintf(fil, " begin_hit_block\n");