Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
303 | ligi | 1 | /************************************************** |
2 | * |
||
3 | * class representing the Params Structure |
||
4 | * |
||
5 | * Author: Marcus -LiGi- Bueschleb |
||
403 | ligi | 6 | * |
7 | * see README for further Infos |
||
8 | * |
||
303 | ligi | 9 | *************************************************/ |
10 | |||
11 | public class MKParamsParser |
||
475 | ligi | 12 | implements MKParamDefinitions |
303 | ligi | 13 | |
14 | { |
||
15 | |||
314 | ligi | 16 | public final static int MAX_PARAMSETS=20; |
503 | ligi | 17 | public final static int MAX_PARAMLENGTH=70; |
303 | ligi | 18 | |
314 | ligi | 19 | public int[][] field; |
20 | public String[] names={"Paramset 1","Paramset 2","Paramset 3","Paramset 4","Paramset 5"}; |
||
303 | ligi | 21 | |
314 | ligi | 22 | public int act_paramset=0; |
23 | |||
24 | |||
390 | ligi | 25 | public int get_field_from_act(int pos) |
26 | { return field[act_paramset][pos]; } |
||
314 | ligi | 27 | |
390 | ligi | 28 | public void set_field_from_act(int pos,int val) |
411 | ligi | 29 | { |
30 | if (val>255) val=255; |
||
31 | if (val<0) val=255; |
||
32 | field[act_paramset][pos]=val; |
||
33 | } |
||
390 | ligi | 34 | |
35 | |||
314 | ligi | 36 | public void field_from_act_add(int pos,int val) |
37 | { |
||
411 | ligi | 38 | set_field_from_act(pos , get_field_from_act(pos)+val); |
314 | ligi | 39 | } |
40 | |||
411 | ligi | 41 | // for boolean Flags |
314 | ligi | 42 | public void field_from_act_xor(int pos,int val) |
43 | { |
||
44 | field[act_paramset][pos]^=val; |
||
45 | } |
||
46 | |||
303 | ligi | 47 | public MKParamsParser() |
48 | { |
||
503 | ligi | 49 | field=new int[MAX_PARAMSETS][MAX_PARAMLENGTH]; |
314 | ligi | 50 | for (int ii=0;ii<MAX_PARAMSETS;ii++) |
503 | ligi | 51 | for (int i=0;i<MAX_PARAMLENGTH;i++) |
314 | ligi | 52 | field[ii][i]=-1; |
303 | ligi | 53 | |
54 | } |
||
55 | |||
475 | ligi | 56 | |
57 | public int[] param_type; |
||
58 | public int[] param_pos; |
||
59 | public int[] param_innerpos; |
||
60 | |||
314 | ligi | 61 | public void set_by_mk_data(int paramset_num,int[] in_arr,MKVersion version) |
303 | ligi | 62 | { |
475 | ligi | 63 | param_type=new int[PARAM_COUNT]; |
64 | param_pos=new int[PARAM_COUNT]; |
||
65 | param_innerpos=new int[PARAM_COUNT]; |
||
66 | |||
67 | param_type[PARAMID_STICK_ACCELERATE]=PARAMTYPE_BYTE; |
||
68 | param_pos[PARAMID_STICK_ACCELERATE]=2; |
||
69 | param_innerpos[PARAMID_STICK_ACCELERATE]=0; |
||
70 | |||
71 | |||
72 | switch (version.compatible) |
||
314 | ligi | 73 | { |
475 | ligi | 74 | case 4: |
495 | ligi | 75 | case 5: |
475 | ligi | 76 | |
77 | for ( int i=0;i<58;i++) |
||
78 | field[paramset_num][i]=in_arr[i]; |
||
79 | names[paramset_num]="" + (paramset_num+1) +": "; |
||
80 | for ( int i=46;i<58;i++) |
||
81 | { |
||
82 | if(in_arr[i]==0)break; |
||
83 | names[paramset_num]+=(char)in_arr[i]; |
||
84 | } |
||
85 | break; |
||
86 | |||
87 | case 6: |
||
88 | for ( int i=0;i<65;i++) |
||
89 | field[paramset_num][i]=in_arr[i]; |
||
90 | names[paramset_num]="" + (paramset_num+1) +": "; |
||
91 | for ( int i=53;i<65;i++) |
||
92 | { |
||
93 | if(in_arr[i]==0)break; |
||
94 | names[paramset_num]+=(char)in_arr[i]; |
||
95 | } |
||
96 | break; |
||
503 | ligi | 97 | case 7: |
98 | for ( int i=0;i<70;i++) |
||
99 | field[paramset_num][i]=in_arr[i]; |
||
100 | names[paramset_num]="" + (paramset_num+1) +": "; |
||
101 | for ( int i=58;i<70;i++) |
||
102 | { |
||
103 | if(in_arr[i]==0)break; |
||
104 | names[paramset_num]+=(char)in_arr[i]; |
||
105 | } |
||
106 | break; |
||
475 | ligi | 107 | |
314 | ligi | 108 | } |
303 | ligi | 109 | } |
110 | |||
111 | |||
112 | |||
113 | } |