214 changes: 214 additions & 0 deletions data/base/structs/power_module4.pie
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
PIE 2
TYPE 10200
TEXTURE 0 page-11-player-buildings.png 256 256
LEVELS 1
LEVEL 1
POINTS 125
-114 0 91
-113 0 -91
-100 144 90
-99 144 -91
-92 0 113
-91 0 68
-91 144 82
-91 144 99
-90 0 -113
-90 0 -68
-90 144 -99
-90 144 -82
-83 0 -73
-83 0 73
-83 144 90
-82 144 -90
-73 0 -83
-73 0 82
-69 0 90
-68 0 -90
-68 15 -65
-68 15 66
-66 15 69
-65 0 -27
-65 0 27
-65 15 -68
-65 65 -27
-65 65 27
-51 0 -40
-51 0 40
-51 36 -48
-51 36 49
-51 38 -40
-51 38 40
-51 39 -40
-51 39 40
-51 40 -40
-51 65 -40
-51 65 40
-48 36 -51
-48 36 52
-40 0 -51
-40 0 51
-40 38 -51
-40 38 51
-40 39 -51
-40 39 51
-40 40 -51
-40 41 51
-40 65 -51
-40 65 51
-27 0 -65
-27 0 65
-27 65 -65
-27 65 65
-13 65 -13
-13 65 12
-4 66 -56
-4 66 -48
-4 66 47
-4 66 55
0 65 0
0 174 0
3 66 -56
3 66 -48
3 66 47
3 66 55
12 65 -13
12 65 12
27 0 -65
27 0 65
27 65 -65
27 65 65
40 0 -51
40 0 51
40 38 -51
40 38 51
40 39 -51
40 39 51
40 40 -51
40 65 -51
40 65 51
47 36 50
48 36 -51
49 36 47
51 0 -40
51 0 40
51 36 -49
51 38 -40
51 38 40
51 39 -40
51 39 40
51 40 -40
51 65 -40
51 65 40
54 0 -37
54 65 -37
64 15 67
65 0 -27
65 0 27
65 15 -69
65 65 -27
65 65 27
67 0 91
67 15 64
68 0 -89
68 15 -66
73 0 -83
73 0 82
81 144 91
82 0 -73
82 0 73
82 144 -89
89 0 69
89 144 83
90 0 -67
90 0 114
90 144 -81
90 144 100
91 0 -112
91 144 -98
98 144 91
99 144 -90
112 0 92
113 0 -90
POLYGONS 80
200 3 2 6 5 148 32 148 46 205 52
200 3 2 5 0 148 32 205 52 205 26
200 3 2 7 14 26 193 41 193 41 208
200 3 2 14 6 26 193 41 208 26 208
200 3 14 7 4 148 46 148 32 205 26
200 3 14 4 18 148 46 205 26 205 52
200 3 7 2 0 148 46 148 32 205 26
200 3 7 0 4 148 46 205 26 205 52
200 3 6 14 18 148 32 148 46 205 52
200 3 6 18 5 148 32 205 52 205 26
200 3 11 3 1 148 46 148 32 205 26
200 3 11 1 9 148 46 205 26 205 52
200 3 10 15 19 148 32 148 46 205 52
200 3 10 19 8 148 32 205 52 205 26
200 3 10 3 11 26 193 41 193 41 208
200 3 10 11 15 26 193 41 208 26 208
200 3 15 11 9 148 32 148 46 205 52
200 3 15 9 19 148 32 205 52 205 26
200 3 121 118 116 148 46 148 32 205 26
200 3 121 116 123 148 46 205 26 205 52
200 3 114 121 123 148 46 148 32 205 26
200 3 114 123 113 148 46 205 26 205 52
200 3 118 121 114 26 193 41 193 41 208
200 3 118 114 109 26 193 41 208 26 208
200 3 118 109 103 148 32 148 46 205 52
200 3 118 103 116 148 32 205 52 205 26
200 3 109 114 113 148 32 148 46 205 52
200 3 109 113 103 148 32 205 52 205 26
200 3 112 120 119 148 46 148 32 205 26
200 3 112 119 105 148 46 205 26 205 52
200 3 122 120 112 26 193 41 193 41 208
200 3 122 112 117 26 193 41 208 26 208
200 3 122 117 115 148 32 148 46 205 52
200 3 122 115 124 148 32 205 52 205 26
200 3 117 112 105 148 32 148 46 205 52
200 3 117 105 115 148 32 205 52 205 26
200 3 46 35 33 0 109 0 81 0 81
200 3 46 33 44 0 109 0 81 0 109
200 3 29 42 48 125 34 120 34 120 12
200 3 29 48 33 125 34 120 12 125 13
200 3 13 17 44 40 81 40 109 0 109
200 3 13 44 33 40 81 0 109 0 81
200 3 21 22 40 63 47 67 47 67 51
200 3 21 40 31 63 47 67 51 63 51
200 3 29 13 35 42 168 0 169 42 136
200 3 34 45 43 0 109 0 81 0 81
200 3 34 43 32 0 109 0 81 0 109
200 3 41 28 36 125 34 120 34 120 12
200 3 41 36 47 125 34 120 12 125 12
200 3 16 12 32 40 81 40 109 0 109
200 3 16 32 43 40 81 0 109 0 81
200 3 25 20 30 63 47 67 47 67 51
200 3 25 30 39 63 47 67 51 63 51
200 3 12 28 34 42 168 0 169 0 136
200 3 41 16 45 42 168 0 169 42 136
200 3 77 90 88 0 109 0 81 0 81
200 3 77 88 75 0 109 0 81 0 109
200 3 85 73 79 124 34 119 34 119 12
200 3 85 79 92 124 34 119 12 124 12
200 3 110 107 75 40 81 40 109 0 109
200 3 110 75 88 40 81 0 109 0 81
200 3 106 100 83 63 47 67 47 67 51
200 3 106 83 87 63 47 67 51 63 51
200 3 107 73 77 42 168 0 169 0 136
200 3 85 110 90 42 168 0 169 42 136
200 3 17 42 46 42 168 0 169 0 136
200 3 91 78 76 0 109 0 81 0 81
200 3 91 76 89 0 109 0 81 0 109
200 3 74 86 89 125 34 120 34 120 13
200 3 74 89 76 125 34 120 13 125 13
200 3 108 111 89 40 81 40 109 0 109
200 3 108 89 76 40 81 0 109 0 81
200 3 97 104 84 63 47 67 47 67 51
200 3 97 84 82 63 47 67 51 63 51
200 3 111 86 91 42 168 0 169 0 136
200 3 74 108 78 42 168 0 169 42 136
200 3 120 122 124 148 46 148 32 205 26
200 3 120 124 119 148 46 205 26 205 52
200 3 3 10 8 148 46 148 32 205 26
200 3 3 8 1 148 46 205 26 205 52
CONNECTORS 1
90 -90 0
212 changes: 212 additions & 0 deletions data/base/structs/research_module4.pie
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
PIE 2
TYPE 10200
TEXTURE 0 page-12-player-buildings.png 256 256
LEVELS 1
LEVEL 1
POINTS 100
-104 51 0
0 51 -103
103 51 0
0 51 104
-104 0 0
0 0 -103
103 0 0
0 0 104
-28 96 -64
7 96 -28
-28 96 7
-64 96 -28
-28 52 -54
-3 52 -28
-28 52 -3
-54 52 -28
-84 43 -67
-111 43 -67
-116 43 -94
-95 43 -114
-69 43 -111
-70 43 -82
-59 32 -42
-45 32 -57
-70 0 -82
-45 0 -57
-59 0 -42
-84 0 -67
-99 0 -119
-72 0 -116
-116 0 -69
-120 0 -97
68 43 -83
68 43 -110
95 43 -115
115 43 -94
112 43 -68
83 43 -69
83 0 -69
58 0 -44
58 32 -44
43 32 -58
43 0 -58
68 0 -83
120 0 -98
117 0 -71
71 0 -115
99 0 -120
59 0 44
85 0 69
85 43 69
59 32 44
71 0 84
45 0 59
45 32 59
71 43 84
99 0 121
72 0 118
69 43 113
95 43 116
116 0 71
112 43 69
121 0 99
116 43 96
-48 0 56
-75 0 79
-75 43 79
-48 32 56
-89 0 64
-62 0 41
-62 32 41
-89 43 64
-128 0 89
-122 0 62
-118 43 60
-123 43 86
-80 0 110
-77 43 106
-108 0 113
-104 43 108
-107 0 112
52 32 51
-4 51 99
-113 43 -96
-60 51 -43
-60 0 -43
-70 37 -53
-45 32 -56
-70 42 -80
-46 0 -57
-46 51 -57
-60 32 -43
-46 32 -57
-45 51 -57
103 43 0
0 43 -103
44 0 -59
44 43 -59
58 43 -44
44 32 -59
POLYGONS 105
200 3 16 86 21 128 75 142 75 128 80
200 3 21 20 19 204 61 204 74 194 75
200 3 21 19 16 204 61 194 75 198 56
200 3 19 83 16 194 75 186 68 198 56
200 3 19 20 29 117 209 125 209 125 222
200 3 19 29 28 117 209 125 222 117 222
200 3 20 21 24 126 209 133 209 133 222
200 3 20 24 29 126 209 133 222 126 222
200 3 51 81 51 155 75 155 76 154 75
200 3 89 85 91 167 54 157 54 157 38
200 3 89 91 92 167 54 157 38 167 38
200 3 86 22 87 142 75 155 75 155 78
200 3 86 87 88 142 75 155 78 128 79
200 3 84 90 92 157 29 167 29 167 38
200 3 84 92 91 157 29 167 38 157 38
200 3 48 51 51 136 203 136 190 135 189
200 3 48 51 48 136 203 135 189 135 203
200 3 25 89 92 167 54 167 54 167 38
200 3 25 92 23 167 54 167 38 167 38
200 3 23 21 88 155 79 128 80 128 79
200 3 23 88 87 155 79 128 79 155 78
200 3 90 93 23 167 29 167 29 167 38
200 3 90 23 92 167 29 167 38 167 38
200 3 21 23 25 107 185 136 189 136 203
200 3 21 25 24 107 185 136 203 107 203
200 3 39 96 99 168 25 158 25 158 8
200 3 39 99 40 168 25 158 8 168 8
200 3 40 37 32 155 79 128 80 128 75
200 3 40 32 41 155 79 128 75 155 75
200 3 97 98 40 158 3 168 3 168 8
200 3 97 40 99 158 3 168 8 158 8
200 3 37 40 39 107 185 136 189 136 203
200 3 37 39 38 107 185 136 203 107 203
200 3 36 37 38 126 209 133 209 133 222
200 3 36 38 45 126 209 133 222 126 222
200 3 94 39 98 201 3 168 25 168 3
200 3 41 32 43 136 190 107 185 107 203
200 3 41 43 42 136 190 107 203 136 203
200 3 33 34 47 98 209 106 209 106 222
200 3 33 47 46 98 209 106 222 98 222
200 3 32 33 46 89 209 97 209 97 222
200 3 32 46 43 89 209 97 222 89 222
200 3 37 36 35 204 61 204 74 194 75
200 3 37 35 32 204 61 194 75 198 56
200 3 35 34 33 194 75 185 68 186 57
200 3 35 33 32 194 75 186 57 198 56
200 3 22 16 27 136 190 107 185 107 203
200 3 22 27 26 136 190 107 203 136 203
200 3 70 69 69 136 189 136 203 135 203
200 3 70 69 70 136 189 135 203 135 188
200 3 70 70 67 155 79 154 79 155 75
200 3 68 71 70 107 203 107 185 135 188
200 3 68 70 69 107 203 135 188 135 203
200 3 74 71 68 126 209 133 209 133 222
200 3 74 68 73 126 209 133 222 126 222
200 3 71 66 67 128 80 128 75 155 75
200 3 71 67 70 128 80 155 75 154 79
200 3 67 66 65 136 190 107 185 107 203
200 3 67 65 64 136 190 107 203 136 203
200 3 66 77 76 89 209 97 209 97 222
200 3 66 76 65 89 209 97 222 89 222
200 3 75 79 77 194 75 185 68 186 57
200 3 75 77 66 194 75 186 57 198 56
200 3 71 74 75 204 61 204 74 194 75
200 3 71 75 66 204 61 194 75 198 56
200 3 75 74 73 117 209 125 209 125 222
200 3 75 73 72 117 209 125 222 117 222
200 3 17 18 31 98 209 106 209 106 222
200 3 17 31 30 98 209 106 222 98 222
200 3 18 17 16 185 68 186 57 198 56
200 3 18 16 83 185 68 198 56 186 68
200 3 16 17 30 89 209 97 209 97 222
200 3 16 30 27 89 209 97 222 89 222
200 3 76 77 79 98 222 98 209 106 209
200 3 76 79 80 98 222 106 209 105 222
200 3 35 36 45 117 209 125 209 125 222
200 3 35 45 44 117 209 125 222 117 222
200 3 50 51 81 128 75 154 75 155 76
200 3 50 81 54 128 75 155 76 155 79
200 3 50 54 55 128 75 155 79 128 80
200 3 55 54 53 107 185 136 189 136 203
200 3 55 53 52 107 185 136 203 107 203
200 3 58 55 52 126 209 133 209 133 222
200 3 58 52 57 126 209 133 222 126 222
200 3 59 58 57 117 209 125 209 125 222
200 3 59 57 56 117 209 125 222 117 222
200 3 50 49 48 107 185 107 203 135 203
200 3 50 48 51 107 185 135 203 135 189
200 3 50 61 60 89 209 97 209 97 222
200 3 50 60 49 89 209 97 222 89 222
200 3 61 63 62 98 209 106 209 106 222
200 3 61 62 60 98 209 106 222 98 222
200 3 59 63 61 194 75 185 68 186 57
200 3 59 61 50 194 75 186 57 198 56
200 3 55 58 59 204 61 204 74 194 75
200 3 55 59 50 204 61 194 75 198 56
200 3 79 75 72 107 209 116 209 116 222
200 3 79 72 78 107 209 116 222 107 222
200 3 78 80 79 106 222 105 222 106 209
200 3 18 19 28 107 209 116 209 116 222
200 3 18 28 31 107 209 116 222 107 222
200 3 34 35 44 107 209 116 209 116 222
200 3 34 44 47 107 209 116 222 107 222
200 3 63 59 56 107 209 116 209 116 222
200 3 63 56 62 107 209 116 222 107 222
4 changes: 4 additions & 0 deletions data/base/wrf/piestats.wrf
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
directory "structs"
file IMD "blpower0.pie"
file IMD "blpower4.pie"
file IMD "power_module4.pie"
file IMD "blhq.pie"
file IMD "blhq2.pie"
file IMD "blbfact.pie"
file IMD "blfact0.pie"
file IMD "blfact1.pie"
file IMD "blfact2.pie"
file IMD "factory_module1.pie"
file IMD "factory_module2.pie"
file IMD "blwallh.pie"
file IMD "blwallc2.pie"
file IMD "blwall2.pie"
Expand All @@ -26,6 +29,7 @@ file IMD "blbpower.pie"
file IMD "blbresch.pie"
file IMD "blresch0.pie"
file IMD "blresch4.pie"
file IMD "research_module4.pie"
file IMD "blbrbgen.pie"
file IMD "blbgen.pie"
file IMD "blbhq.pie"
Expand Down
14 changes: 7 additions & 7 deletions data/mp/stats/structures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ A0CommandCentreCO,HQ,Level Two,HARD,0,2,2,Concrete,500,3,10,1000,10,100,30,300,1
A0CommandCentreNE,HQ,Level Three,HARD,0,2,2,Concrete,500,3,10,1000,10,100,30,300,1,1,ZNULLECM,CCSensor,0,blhq4.pie,blbhq.pie,1,0
A0CommandCentreNP,HQ,Level One,HARD,0,2,2,Concrete,500,3,10,1000,10,100,30,300,1,1,ZNULLECM,CCSensor,0,blhq2.pie,blbhq.pie,1,0
A0CyborgFactory,CYBORG FACTORY,Level All,MEDIUM,1,1,2,Concrete,500,2,10,1000,100,100,30,150,255,20,ZNULLECM,DefaultSensor1Mk1,1,blcfact1.pie,blbcfact.pie,1,0
A0FacMod1,FACTORY MODULE,Level All,MEDIUM,1,3,3,Concrete,250,2,10,500,100,100,25,150,255,30,ZNULLECM,DefaultSensor1Mk1,0,BLFACT1.PIE,0,1,0
A0FacMod1,FACTORY MODULE,Level All,MEDIUM,1,3,3,Concrete,250,2,10,500,100,100,25,150,255,30,ZNULLECM,DefaultSensor1Mk1,0,blfact1.pie@factory_module1.pie@factory_module2.pie,0,1,0
A0HardcreteMk1CWall,CORNER WALL,Level All,HARD,1,1,1,Concrete,125,2,15,700,10,25,1,0,255,0,ZNULLECM,ZNULLSENSOR,0,BLWALLC1.pie,0,0,0
A0HardcreteMk1Gate,GATE,Level All,HARD,1,1,1,Concrete,250,2,15,700,10,25,1,0,255,0,ZNULLECM,ZNULLSENSOR,0,BLGATEH.pie,0,0,0
A0HardcreteMk1Wall,WALL,Level All,HARD,1,1,1,Concrete,125,2,15,700,10,25,1,0,255,0,ZNULLECM,ZNULLSENSOR,0,BLWALLH.pie,0,1,0
A0LasSatCommand,DOOR,Level All,MEDIUM,1,2,2,Concrete,2500,2,16,1000,10,1000,1,0,255,0,ZNULLECM,0,1,milasbas.pie,0,0,1
A0LightFactory,FACTORY,Level All,MEDIUM,1,3,3,Concrete,500,3,10,1000,100,100,30,150,255,20,ZNULLECM,BaBaSensor,1,BLFACT0.pie,blbfact.pie,1,0
A0PowerGenerator,POWER GENERATOR,Level All,MEDIUM,1,2,2,Concrete,500,2,20,1000,30,50,30,300,255,10,ZNULLECM,DefaultSensor1Mk1,0,BLPOWER0.PIE,blbpower.pie,1,0
A0PowMod1,POWER MODULE,Level All,MEDIUM,0,2,2,Concrete,250,2,10,1000,0,0,0,150,255,0,ZNULLECM,DefaultSensor1Mk1,0,BLPOWER4.PIE,0,1,0
A0LightFactory,FACTORY,Level All,MEDIUM,1,3,3,Concrete,500,3,10,1000,100,100,30,150,255,20,ZNULLECM,BaBaSensor,1,blfact0.pie@blfact1.pie@blfact2.pie,blbfact.pie,1,0
A0PowerGenerator,POWER GENERATOR,Level All,MEDIUM,1,2,2,Concrete,500,2,20,1000,30,50,30,300,255,10,ZNULLECM,DefaultSensor1Mk1,0,blpower0.pie@blpower4.pie,blbpower.pie,1,0
A0PowMod1,POWER MODULE,Level All,MEDIUM,0,2,2,Concrete,250,2,10,1000,0,0,0,150,255,0,ZNULLECM,DefaultSensor1Mk1,0,blpower4.pie@power_module4.pie,0,1,0
A0RepairCentre3,REPAIR FACILITY,Level All,MEDIUM,0,1,1,Concrete,500,2,10,1000,0,100,0,150,255,0,RepairCentre,DefaultSensor1Mk1,0,BLRPAIR3.PIE,BLBGEN.PIE,1,0
A0ResearchFacility,RESEARCH,Level All,MEDIUM,1,2,2,Concrete,500,2,10,800,100,100,30,150,255,10,ZNULLECM,DefaultSensor1Mk1,0,BLRESCH0.PIE,blbresch.pie,1,0
A0ResearchModule1,RESEARCH MODULE,Level All,MEDIUM,1,2,2,Concrete,250,2,10,800,50,100,5,150,255,5,ZNULLECM,DefaultSensor1Mk1,0,blresch4.PIE,0,1,0
A0ResearchFacility,RESEARCH,Level All,MEDIUM,1,2,2,Concrete,500,2,10,800,100,100,30,150,255,10,ZNULLECM,DefaultSensor1Mk1,0,blresch0.pie@blresch4.pie,blbresch.pie,1,0
A0ResearchModule1,RESEARCH MODULE,Level All,MEDIUM,1,2,2,Concrete,250,2,10,800,50,100,5,150,255,5,ZNULLECM,DefaultSensor1Mk1,0,blresch4.pie@research_module4.pie,0,1,0
A0ResourceExtractor,RESOURCE EXTRACTOR,Level All,MEDIUM,0,1,1,Concrete,100,1,5,600,10,0,2,150,255,1,ZNULLECM,DefaultSensor1Mk1,0,BLDERIK.PIE,0,1,0
A0Sat-linkCentre,SAT UPLINK,Level All,MEDIUM,0,2,2,Concrete,1250,3,12,1600,10,1000,30,0,1,1,ZNULLECM,UplinkSensor,0,miupbase.PIE,0,0,0
A0TankTrap,WALL,Level All,HARD,1,1,1,Concrete,40,1,10,200,10,15,1,0,255,0,ZNULLECM,ZNULLSENSOR,0,MITRAP2.PIE,0,1,0
A0VTolFactory1,VTOL FACTORY,Level All,MEDIUM,1,3,3,Concrete,500,3,10,500,100,100,30,150,255,20,ZNULLECM,DefaultSensor1Mk1,1,blvfact0.pie,blbfact.pie,1,0
A0VTolFactory1,VTOL FACTORY,Level All,MEDIUM,1,3,3,Concrete,500,3,10,500,100,100,30,150,255,20,ZNULLECM,DefaultSensor1Mk1,1,blvfact0.pie@blvfact1.pie@blvfact2.pie,blbfact.pie,1,0
A0VtolPad,REARM PAD,Level All,MEDIUM,0,1,1,Concrete,300,1,10,300,0,100,0,150,255,0,ZNULLECM,DefaultSensor1Mk1,0,blvtolpd.pie,blbgen.pie,1,0
AASite-QuadBof,DEFENSE,Level Two-Three,HARD,0,1,1,Concrete,300,1,12,600,10,300,10,150,255,1,ZNULLECM,DefaultSensor1Mk1,1,Blaamnt2.PIE,0,0,1
AASite-QuadMg1,DEFENSE,Level Two-Three,MEDIUM,0,1,1,Concrete,250,1,12,400,10,125,10,150,255,1,ZNULLECM,DefaultSensor1Mk1,1,Blaamnt1.PIE,0,0,1
Expand Down
4 changes: 4 additions & 0 deletions data/mp/wrf/piestats.wrf
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
directory "structs"
file IMD "blpower0.pie"
file IMD "blpower4.pie"
file IMD "power_module4.pie"
file IMD "blhq.pie"
file IMD "blhq2.pie"
file IMD "blbfact.pie"
file IMD "blfact0.pie"
file IMD "blfact1.pie"
file IMD "blfact2.pie"
file IMD "factory_module1.pie"
file IMD "factory_module2.pie"
file IMD "blwallh.pie"
file IMD "blgateh.pie"
file IMD "blwallc2.pie"
Expand All @@ -27,6 +30,7 @@ file IMD "blbpower.pie"
file IMD "blbresch.pie"
file IMD "blresch0.pie"
file IMD "blresch4.pie"
file IMD "research_module4.pie"
file IMD "blbrbgen.pie"
file IMD "blbgen.pie"
file IMD "blbhq.pie"
Expand Down
14 changes: 7 additions & 7 deletions src/component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ static UDWORD getStructureHeight(STRUCTURE *psStructure)

UDWORD getStructureStatHeight(STRUCTURE_STATS *psStat)
{
if (psStat->pIMD)
if (psStat->pIMD[0])
{
return (psStat->pIMD->max.y - psStat->pIMD->min.y);
return (psStat->pIMD[0]->max.y - psStat->pIMD[0]->min.y);
}

return 0;
Expand Down Expand Up @@ -197,7 +197,7 @@ void displayStructureButton(STRUCTURE *psStructure, Vector3i *rotation, Vector3i
/*HACK HACK HACK!
if its a 'tall thin (ie tower)' structure with something on the top - offset the
position to show the object on top*/
if (psStructure->pStructureType->pIMD->nconnectors && scale == SMALL_STRUCT_SCALE &&
if (psStructure->pStructureType->pIMD[0]->nconnectors && scale == SMALL_STRUCT_SCALE &&
getStructureHeight(psStructure) > TOWER_HEIGHT)
{
Position->y -= 20;
Expand Down Expand Up @@ -293,7 +293,7 @@ void displayStructureStatButton(STRUCTURE_STATS *Stats, Vector3i *Rotation, Vect
/*HACK HACK HACK!
if its a 'tall thin (ie tower)' structure stat with something on the top - offset the
position to show the object on top*/
if (Stats->pIMD->nconnectors && scale == SMALL_STRUCT_SCALE &&
if (Stats->pIMD[0]->nconnectors && scale == SMALL_STRUCT_SCALE &&
getStructureStatHeight(Stats) > TOWER_HEIGHT)
{
Position->y -= 20;
Expand All @@ -309,10 +309,10 @@ void displayStructureStatButton(STRUCTURE_STATS *Stats, Vector3i *Rotation, Vect
{
pie_Draw3DShape(baseImd, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, pie_BUTTON, 0);
}
pie_Draw3DShape(Stats->pIMD, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, pie_BUTTON, 0);
pie_Draw3DShape(Stats->pIMD[0], 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, pie_BUTTON, 0);

//and draw the turret
if(Stats->pIMD->nconnectors)
if(Stats->pIMD[0]->nconnectors)
{
if (Stats->numWeaps > 0)
{
Expand All @@ -327,7 +327,7 @@ void displayStructureStatButton(STRUCTURE_STATS *Stats, Vector3i *Rotation, Vect
weaponImd[0] = NULL;
mountImd[0] = NULL;
}
strImd = Stats->pIMD;
strImd = Stats->pIMD[0];
//get an imd to draw on the connector priority is weapon, ECM, sensor
//check for weapon
//can only have the STRUCT_MAXWEAPS
Expand Down
10 changes: 2 additions & 8 deletions src/intdisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ void intDisplayStatusButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ
if(DroidIsBuilding(Droid)) {
Structure = DroidGetBuildStructure(Droid);
if(Structure) {
Object = Structure; //(void*)StructureGetIMD(Structure);
Object = Structure;
IMDType = IMDTYPE_STRUCTURE;
RENDERBUTTON_INITIALISED(Buffer);
}
Expand Down Expand Up @@ -2698,12 +2698,6 @@ RESEARCH_FACILITY *StructureGetResearch(STRUCTURE *Structure)
}


iIMDShape *StructureGetIMD(STRUCTURE *Structure)
{
return Structure->pStructureType->pIMD;
}


DROID_TEMPLATE *FactoryGetTemplate(FACTORY *Factory)
{
if (Factory->psSubjectPending != NULL)
Expand All @@ -2730,7 +2724,7 @@ iIMDShape *StatGetStructureIMD(BASE_STATS *Stat,UDWORD Player)
{
(void)Player;
//return buildingIMDs[aBuildingIMDs[Player][((STRUCTURE_STATS*)Stat)->type]];
return ((STRUCTURE_STATS*)Stat)->pIMD;
return ((STRUCTURE_STATS*)Stat)->pIMD[0];
}

bool StatIsTemplate(BASE_STATS *Stat)
Expand Down
1 change: 0 additions & 1 deletion src/intdisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ DROID_TEMPLATE *FactoryGetTemplate(FACTORY *Factory);

RESEARCH_FACILITY *StructureGetResearch(STRUCTURE *Structure);
FACTORY *StructureGetFactory(STRUCTURE *Structure);
iIMDShape *StructureGetIMD(STRUCTURE *Structure);

//iIMDShape *TemplateGetIMD(DROID_TEMPLATE *DroidTemp,UDWORD Player);
//UDWORD TemplateGetIMDIndex(DROID_TEMPLATE *Template,UDWORD Player);
Expand Down
2 changes: 1 addition & 1 deletion src/mapdisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void renderResearchToBuffer(RESEARCH *psResearch, UDWORD OriginX, UDWORD OriginY
/*HACK HACK HACK!
if its a 'tall thin (ie tower)' structure stat with something on
the top - offset the position to show the object on top*/
if (((STRUCTURE_STATS*)psResearch->psStat)->pIMD->nconnectors &&
if (((STRUCTURE_STATS*)psResearch->psStat)->pIMD[0]->nconnectors &&
getStructureStatHeight((STRUCTURE_STATS*)psResearch->psStat) > TOWER_HEIGHT)
{
Position.y -= 30;
Expand Down
6 changes: 3 additions & 3 deletions src/multiopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ static bool cleanMap(UDWORD player)
((FACTORY*)psStruct->pFunctionality)->capacity = 0;
((FACTORY*)psStruct->pFunctionality)->productionOutput = (UBYTE)((PRODUCTION_FUNCTION*)psStruct->pStructureType->asFuncList[0])->productionOutput;

psStruct->sDisplay.imd = psStruct->pStructureType->pIMD;
psStruct->sDisplay.imd = psStruct->pStructureType->pIMD[0];
psStruct->body = (UWORD)(structureBody(psStruct));

}
Expand All @@ -474,7 +474,7 @@ static bool cleanMap(UDWORD player)
{ // downgrade research
((RESEARCH_FACILITY*)psStruct->pFunctionality)->capacity = 0;
((RESEARCH_FACILITY*)psStruct->pFunctionality)->researchPoints = ((RESEARCH_FUNCTION*)psStruct->pStructureType->asFuncList[0])->researchPoints;
psStruct->sDisplay.imd = psStruct->pStructureType->pIMD;
psStruct->sDisplay.imd = psStruct->pStructureType->pIMD[0];
psStruct->body = (UWORD)(structureBody(psStruct));
}
psStruct=psStruct->psNext;
Expand All @@ -486,7 +486,7 @@ static bool cleanMap(UDWORD player)
{ // downgrade powergen.
((POWER_GEN*)psStruct->pFunctionality)->capacity = 0;

psStruct->sDisplay.imd = psStruct->pStructureType->pIMD;
psStruct->sDisplay.imd = psStruct->pStructureType->pIMD[0];
psStruct->body = (UWORD)(structureBody(psStruct));
}
structurePowerUpgrade(psStruct);
Expand Down
2 changes: 1 addition & 1 deletion src/projectile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1794,7 +1794,7 @@ int establishTargetHeight(BASE_OBJECT const *psTarget)
case OBJ_STRUCTURE:
{
STRUCTURE_STATS * psStructureStats = ((STRUCTURE const *)psTarget)->pStructureType;
return psStructureStats->pIMD->max.y + psStructureStats->pIMD->min.y;
return psStructureStats->pIMD[0]->max.y + psStructureStats->pIMD[0]->min.y;
}
case OBJ_FEATURE:
// Just use imd ymax+ymin
Expand Down
22 changes: 22 additions & 0 deletions src/stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,28 @@ iIMDShape *LineView::imdShape(unsigned int index, bool accept0AsNULL)
return result;
}

std::vector<iIMDShape *> LineView::imdShapes(unsigned int index)
{
std::string const &str = s(index);
std::vector<iIMDShape *> result;
int begin = 0;
do
{
int end = str.find_first_of('@', begin);
if (end == std::string::npos)
{
end = str.size();
}
result.push_back((iIMDShape *)resGetData("IMD", str.substr(begin, end - begin).c_str()));
if (result.back() == NULL)
{
setError(index, "Expected PIE shape.");
}
begin = end + 1;
} while (begin != str.size() + 1);
return result;
}

static inline bool stringToEnumFindFunction(std::pair<char const *, unsigned> const &a, char const *b)
{
return strcmp(a.first, b) < 0;
Expand Down
2 changes: 2 additions & 0 deletions src/statsdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ class LineView

/// Returns the .pie file data referenced by the cell. May return NULL without error if the cell is "0" and accept0AsNULL is true.
iIMDShape *imdShape(unsigned index, bool accept0AsNULL = false);
/// Returns the .pie files data referenced by the cell, separated by '@' characters.
std::vector<iIMDShape *> imdShapes(unsigned index);

/// Returns the STATS * in the given list with the same name as this cell. May return NULL without error if the cell is "0" and accept0AsNULL is true.
template <typename STATS>
Expand Down
204 changes: 41 additions & 163 deletions src/structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@
//used to calculate the time required for repairing
#define VTOL_REPAIR_FACTOR 10

//holds the IMD pointers for the modules - ONLY VALID for player0
iIMDShape * factoryModuleIMDs[NUM_FACTORY_MODULES][NUM_FACMOD_TYPES];
iIMDShape * researchModuleIMDs[NUM_RESEARCH_MODULES];
iIMDShape * powerModuleIMDs[NUM_POWER_MODULES];

//Value is stored for easy access to this structure stat
UDWORD factoryModuleStat;
UDWORD powerModuleStat;
Expand Down Expand Up @@ -261,6 +256,18 @@ bool IsStatExpansionModule(STRUCTURE_STATS const *psStats)
psStats->type == REF_RESEARCH_MODULE;
}

static int numStructureModules(STRUCTURE const *psStruct)
{
switch (psStruct->pStructureType->type)
{
case REF_POWER_GEN: return psStruct->pFunctionality->powerGenerator.capacity;
case REF_VTOL_FACTORY:
case REF_FACTORY: return psStruct->pFunctionality->factory.capacity;
case REF_RESEARCH: return psStruct->pFunctionality->researchFacility.capacity;
default: return 0;
}
}

bool structureIsBlueprint(STRUCTURE *psStructure)
{
return (psStructure->status == SS_BLUEPRINT_VALID ||
Expand All @@ -278,17 +285,6 @@ void structureInitVars(void)
{
int i, j;

for(i=0; i<NUM_FACTORY_MODULES ; i++) {
factoryModuleIMDs[i][0] = NULL;
factoryModuleIMDs[i][1] = NULL;
}
for(i=0; i<NUM_RESEARCH_MODULES ; i++) {
researchModuleIMDs[i] = NULL;
}
for(i=0; i<NUM_POWER_MODULES ; i++) {
powerModuleIMDs[i] = NULL;
}

asStructureStats = NULL;
numStructureStats = 0;
factoryModuleStat = 0;
Expand Down Expand Up @@ -418,82 +414,22 @@ static const StringToEnum<STRUCT_STRENGTH> map_STRUCT_STRENGTH[] =
{"BUNKER", STRENGTH_BUNKER },
};

static void initModulePIEs(std::string const &PIEName, unsigned i, STRUCTURE_TYPE type)
static void initModuleStats(unsigned i, STRUCTURE_TYPE type)
{
std::string GfxFile = PIEName;
char charNum[2];
UDWORD length, module = 0;

//need to work out the IMD's for the modules - HACK!
//need to work out the stats for the modules - HACK! - But less hacky than what was here before.
switch (type)
{
case REF_FACTORY_MODULE:
length = GfxFile.size() - 5;
for (module = 1; module < NUM_FACTORY_MODULES+1; module++)
{
sprintf(charNum,"%d",module);
GfxFile[length] = *charNum;
factoryModuleIMDs[module-1][0] = (iIMDShape *)resGetData("IMD", GfxFile.c_str());
if (factoryModuleIMDs[module-1][0] == NULL)
{
debug(LOG_ERROR, "Cannot find the PIE for factory module %d - %s", module, GfxFile.c_str());
return;
}
}
//store the stat for easy access later on
factoryModuleStat = i;
break;
case REF_VTOL_FACTORY:
length = GfxFile.size() - 5;
for (module = 1; module < NUM_FACTORY_MODULES+1; module++)
{
sprintf(charNum,"%d",module);
GfxFile[length] = *charNum;
factoryModuleIMDs[module-1][1] = (iIMDShape *)resGetData("IMD", GfxFile.c_str());
if (factoryModuleIMDs[module-1][1] == NULL)
{
debug(LOG_ERROR, "Cannot find the PIE for vtol factory module %d - %s", module, GfxFile.c_str());
return;
}
}
break;
// Setup the PIE's for the research modules.
case REF_RESEARCH_MODULE:
length = GfxFile.size() - 5;
GfxFile[length] = '4';

researchModuleIMDs[0] = (iIMDShape *)resGetData("IMD", GfxFile.c_str());
if (researchModuleIMDs[0] == NULL)
{
debug(LOG_ERROR, "Cannot find the PIE for research module %d - %s", module, GfxFile.c_str());
return;
}

researchModuleIMDs[1] = researchModuleIMDs[0];
researchModuleIMDs[2] = researchModuleIMDs[0];
researchModuleIMDs[3] = researchModuleIMDs[0];

case REF_RESEARCH_MODULE:
//store the stat for easy access later on
researchModuleStat = i;
break;

// Setup the PIE's for the power modules.
case REF_POWER_MODULE:
length = GfxFile.size() - 5;

GfxFile[length] = '4';

powerModuleIMDs[0] = (iIMDShape *)resGetData("IMD", GfxFile.c_str());
if (powerModuleIMDs[0] == NULL)
{
debug(LOG_ERROR, "Cannot find the PIE for power module %d - %s", module, GfxFile.c_str());
return;
}

powerModuleIMDs[1] = powerModuleIMDs[0];
powerModuleIMDs[2] = powerModuleIMDs[0];
powerModuleIMDs[3] = powerModuleIMDs[0];

//store the stat for easy access later on
powerModuleStat = i;
break;
Expand All @@ -514,7 +450,7 @@ STRUCTURE_STATS::STRUCTURE_STATS(LineView line)
, bodyPoints(line.u32(11))
, powerToBuild(line.u32(13))
, resistance(line.u32(15))
, pIMD(line.imdShape(21))
, pIMD(line.imdShapes(21))
, pBaseIMD(line.imdShape(22, true))
, pECM(line.stats(18, asECMStats, numECMStats, true))
, pSensor(line.stats(19, asSensorStats, numSensorStats, true))
Expand All @@ -540,7 +476,6 @@ STRUCTURE_STATS::STRUCTURE_STATS(LineView line)
/* load the Structure stats from the Access database */
bool loadStructureStats(const char *pStructData, UDWORD bufferSize)
{
UDWORD module;
UDWORD iID;

// Skip descriptive header
Expand All @@ -549,21 +484,6 @@ bool loadStructureStats(const char *pStructData, UDWORD bufferSize)
pStructData = strchr(pStructData,'\n') + 1;
}

//initialise the module IMD structs
for (module = 0; module < NUM_FACTORY_MODULES; module++)
{
factoryModuleIMDs[module][0] = NULL;
factoryModuleIMDs[module][1] = NULL;
}
for (module = 0; module < NUM_RESEARCH_MODULES; module++)
{
researchModuleIMDs[module] = NULL;
}
for (module = 0; module < NUM_POWER_MODULES; module++)
{
powerModuleIMDs[module] = NULL;
}

TableView table(pStructData, bufferSize);

asStructureStats = new STRUCTURE_STATS[table.size()];
Expand All @@ -580,7 +500,7 @@ bool loadStructureStats(const char *pStructData, UDWORD bufferSize)
return false;
}

initModulePIEs(line.s(21), i, asStructureStats[i].type); // This function looks like a hack.
initModuleStats(i, asStructureStats[i].type); // This function looks like a hack. But slightly less hacky than before.
}

/* get global dummy stat pointer - GJ */
Expand Down Expand Up @@ -1281,7 +1201,7 @@ static WallOrientation structChooseWallType(unsigned player, int mapX, int mapY)
{
STRUCTURE_STATS *psStats = ((WALL_FUNCTION *)psStruct->pStructureType->asFuncList[0])->pCornerStat;
psStruct->pStructureType = psStats;
psStruct->sDisplay.imd = psStats->pIMD;
psStruct->sDisplay.imd = psStats->pIMD[0];
}
}
else if (scanType == WALL_HORIZ)
Expand Down Expand Up @@ -1477,7 +1397,7 @@ STRUCTURE* buildStructureDir(STRUCTURE_STATS *pStructureType, UDWORD x, UDWORD y
Vector2i map = map_coord(Vector2i(x, y)) - size/2;

//set up the imd to use for the display
psBuilding->sDisplay.imd = pStructureType->pIMD;
psBuilding->sDisplay.imd = pStructureType->pIMD[0];

psBuilding->state = SAS_NORMAL;
psBuilding->lastStateTime = gameTime;
Expand Down Expand Up @@ -1728,6 +1648,8 @@ STRUCTURE* buildStructureDir(STRUCTURE_STATS *pStructureType, UDWORD x, UDWORD y
return NULL;
}

int capacity = 0; // Dummy initialisation.

if (pStructureType->type == REF_FACTORY_MODULE)
{
if (psBuilding->pStructureType->type != REF_FACTORY &&
Expand All @@ -1753,42 +1675,8 @@ STRUCTURE* buildStructureDir(STRUCTURE_STATS *pStructureType, UDWORD x, UDWORD y

psBuilding->pFunctionality->factory.productionOutput += ((
PRODUCTION_FUNCTION*)pStructureType->asFuncList[0])->productionOutput;
//need to change which IMD is used for player 0
//Need to do a check its not Barbarian really!

if ( (bMultiPlayer && isHumanPlayer(psBuilding->player))
|| (bMultiPlayer && (game.type == SKIRMISH) && (psBuilding->player < game.maxPlayers))
|| !bMultiPlayer)
{
int capacity = psBuilding->pFunctionality->factory.capacity;

if (capacity < NUM_FACTORY_MODULES)
{
if (psBuilding->pStructureType->type == REF_FACTORY)
{
psBuilding->sDisplay.imd = factoryModuleIMDs[
capacity-1][0];
}
else
{
psBuilding->sDisplay.imd = factoryModuleIMDs[
capacity-1][1];
}
}
else
{
if (psBuilding->pStructureType->type == REF_FACTORY)
{
psBuilding->sDisplay.imd = factoryModuleIMDs[
NUM_FACTORY_MODULES-1][0];
}
else
{
psBuilding->sDisplay.imd = factoryModuleIMDs[
NUM_FACTORY_MODULES-1][1];
}
}
}
capacity = psBuilding->pFunctionality->factory.capacity;
}
}

Expand Down Expand Up @@ -1818,23 +1706,7 @@ STRUCTURE* buildStructureDir(STRUCTURE_STATS *pStructureType, UDWORD x, UDWORD y
holdResearch(psBuilding, ModeImmediate);
}

//need to change which IMD is used for player 0
//Need to do a check its not Barbarian really!
if ( (bMultiPlayer && isHumanPlayer(psBuilding->player))
|| (bMultiPlayer && (game.type == SKIRMISH) && (psBuilding->player < game.maxPlayers))
|| !bMultiPlayer)
{
int capacity = psBuilding->pFunctionality->researchFacility.capacity;

if (capacity < NUM_RESEARCH_MODULES)
{
psBuilding->sDisplay.imd = researchModuleIMDs[capacity-1];
}
else
{
psBuilding->sDisplay.imd = researchModuleIMDs[NUM_RESEARCH_MODULES-1];
}
}
capacity = psBuilding->pFunctionality->researchFacility.capacity;
}
}

Expand All @@ -1855,22 +1727,18 @@ STRUCTURE* buildStructureDir(STRUCTURE_STATS *pStructureType, UDWORD x, UDWORD y
psBuilding->pFunctionality->powerGenerator.capacity = NUM_POWER_MODULES;
bUpgraded = true;

//need to change which IMD is used for player 0
//Need to do a check its not Barbarian really!
capacity = psBuilding->pFunctionality->powerGenerator.capacity;

if ( (bMultiPlayer && isHumanPlayer(psBuilding->player))
|| (bMultiPlayer && (game.type == SKIRMISH) && (psBuilding->player < game.maxPlayers))
|| !bMultiPlayer)
{
psBuilding->sDisplay.imd = powerModuleIMDs[0];
}
//need to inform any res Extr associated that not digging until complete
releasePowerGen(psBuilding);
structurePowerUpgrade(psBuilding);
}
}
if (bUpgraded)
{
std::vector<iIMDShape *> &IMDs = psBuilding->pStructureType->pIMD;
psBuilding->sDisplay.imd = IMDs[std::min<int>(capacity, IMDs.size() - 1)];

//calculate the new body points of the owning structure
psBuilding->body = (uint64_t)structureBody(psBuilding) * bodyDiff / 65536;

Expand Down Expand Up @@ -1907,13 +1775,23 @@ STRUCTURE *buildBlueprint(STRUCTURE_STATS const *psStats, int32_t x, int32_t y,
STRUCTURE *blueprint;

ASSERT_OR_RETURN(NULL, psStats != NULL, "No blueprint stats");
ASSERT_OR_RETURN(NULL, psStats->pIMD != NULL, "No blueprint model for %s", getStatName(psStats));
ASSERT_OR_RETURN(NULL, psStats->pIMD[0] != NULL, "No blueprint model for %s", getStatName(psStats));

int moduleNumber = 0;
if (IsStatExpansionModule(psStats))
{
STRUCTURE *baseStruct = castStructure(worldTile(x, y)->psObject);
if (baseStruct != NULL)
{
moduleNumber = numStructureModules(baseStruct) + 1;
}
}

blueprint = new STRUCTURE(0, selectedPlayer);
// construct the fake structure
blueprint->pStructureType = const_cast<STRUCTURE_STATS *>(psStats); // Couldn't be bothered to fix const correctness everywhere.
blueprint->visible[selectedPlayer] = UBYTE_MAX;
blueprint->sDisplay.imd = psStats->pIMD;
blueprint->sDisplay.imd = psStats->pIMD[std::min<int>(moduleNumber, psStats->pIMD.size() - 1)];
blueprint->pos.x = x;
blueprint->pos.y = y;
blueprint->pos.z = map_Height(blueprint->pos.x, blueprint->pos.y) + world_coord(1)/10;
Expand Down Expand Up @@ -5404,7 +5282,7 @@ bool getLasSatExists(UDWORD player)
/* calculate muzzle base location in 3d world */
bool calcStructureMuzzleBaseLocation(STRUCTURE *psStructure, Vector3i *muzzle, int weapon_slot)
{
iIMDShape *psShape = psStructure->pStructureType->pIMD;
iIMDShape *psShape = psStructure->pStructureType->pIMD[0];

CHECK_STRUCTURE(psStructure);

Expand Down Expand Up @@ -5438,7 +5316,7 @@ bool calcStructureMuzzleBaseLocation(STRUCTURE *psStructure, Vector3i *muzzle, i
/* calculate muzzle tip location in 3d world */
bool calcStructureMuzzleLocation(STRUCTURE *psStructure, Vector3i *muzzle, int weapon_slot)
{
iIMDShape *psShape = psStructure->pStructureType->pIMD;
iIMDShape *psShape = psStructure->pStructureType->pIMD[0];

CHECK_STRUCTURE(psStructure);

Expand Down
2 changes: 1 addition & 1 deletion src/structuredef.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ struct STRUCTURE_STATS : public BASE_STATS
UDWORD resistance; /*The number used to determine whether a
structure can resist an enemy takeover -
0 = cannot be attacked electrically*/
iIMDShape *pIMD; /*The IMD to draw for this structure */
std::vector<iIMDShape *> pIMD; // The IMDs to draw for this structure, for each possible number of modules.
iIMDShape *pBaseIMD; /*The base IMD to draw for this structure */
struct ECM_STATS *pECM; /*Which ECM is standard for the structure -
if any*/
Expand Down