#config scanner=2 ; 500 meters range #config engine=3 #config armor=2 #config weapon=3 #config heatsinks=2 #def PROFVAR #def TURNDEG #def MAXHEAT #def SCANARC #def RANGE jmp !SETUP ; ***************************************** ; PREDICTION TABLE ; ***************************************** *128, 128, 128, 132 *131, 130, 129, 128 *128, 127, 126, 125 *124, 128, 128, 128 *128, 128, 128, 128 *136, 133, 130, 128 *128, 126, 123, 120 *128, 128, 128, 128 *128, 128, 128, 128 *140, 135, 132, 129 *127, 124, 121, 116 *128, 128, 128, 128 *128, 128, 128, 128 *143, 136, 132, 129 *127, 124, 120, 113 *128, 128, 128, 128 *128, 128, 128, 128 *145, 137, 133, 129 *127, 123, 119, 111 *128, 128, 128, 128 *128, 128, 128, 128 *147, 139, 134, 130 *126, 122, 117, 109 *128, 128, 128, 128 *128, 128, 128, 128 *149, 140, 134, 130 *126, 122, 116, 107 *128, 128, 128, 128 *128, 128, 128, 128 *150, 140, 135, 130 *126, 121, 116, 106 *128, 128, 128, 128 *128, 128, 128, 128 *152, 141, 135, 130 *126, 121, 115, 104 *128, 128, 128, 128 *128, 128, 128, 128 *153, 142, 136, 130 *126, 120, 114, 103 *128, 128, 128, 128 *128, 128, 128, 128 *154, 143, 136, 130 *126, 120, 113, 102 *128, 128, 128, 128 *128, 128, 128, 128 *155, 143, 136, 130 *126, 120, 113, 101 *128, 128, 128, 128 *128, 128, 128, 128 *156, 144, 137, 130 *126, 119, 112, 100 *128, 128, 128, 128 *128, 128, 128, 128 *157, 144, 137, 131 *125, 119, 112, 99 *128, 128, 128, 128 *128, 128, 128, 128 *158, 145, 137, 131 *125, 119, 111, 98 *128, 128, 128, 128 *128, 128, 128, 128 *158, 145, 138, 131 *125, 118, 111, 98 *128, 128, 128, 128 *129, 131, 132, 132 *131, 131, 129, 128 *128, 127, 125, 125 *124, 124, 125, 127 *128, 128, 128, 144 *139, 135, 132, 129 *127, 124, 121, 117 *112, 128, 128, 128 *128, 128, 128, 158 *144, 138, 134, 130 *126, 122, 118, 112 *98, 128, 128, 128 *128, 128, 128, 175 *148, 141, 135, 130 *126, 121, 115, 108 *81, 128, 128, 128 *128, 128, 128, 128 *152, 143, 136, 130 *126, 120, 113, 104 *128, 128, 128, 128 *128, 128, 128, 128 *154, 144, 137, 131 *125, 119, 112, 102 *128, 128, 128, 128 *128, 128, 128, 128 *157, 146, 138, 131 *125, 118, 110, 99 *128, 128, 128, 128 *128, 128, 128, 128 *159, 147, 139, 131 *125, 117, 109, 97 *128, 128, 128, 128 *128, 128, 128, 128 *160, 148, 139, 131 *125, 117, 108, 96 *128, 128, 128, 128 *128, 128, 128, 128 *162, 149, 140, 132 *124, 116, 107, 94 *128, 128, 128, 128 *128, 128, 128, 128 *163, 150, 140, 132 *124, 116, 106, 93 *128, 128, 128, 128 *128, 128, 128, 128 *164, 151, 141, 132 *124, 115, 105, 92 *128, 128, 128, 128 *128, 128, 128, 128 *165, 151, 141, 132 *124, 115, 105, 91 *128, 128, 128, 128 *128, 128, 128, 128 *166, 152, 142, 132 *124, 114, 104, 90 *128, 128, 128, 128 *128, 128, 128, 128 *167, 153, 142, 132 *124, 114, 103, 89 *128, 128, 128, 128 *128, 128, 128, 128 *167, 153, 142, 132 *124, 114, 103, 89 *128, 128, 128, 128 *129, 131, 132, 132 *132, 131, 130, 128 *128, 126, 125, 124 *124, 124, 125, 127 *128, 151, 145, 142 *139, 136, 133, 129 *127, 123, 120, 117 *114, 111, 105, 128 *128, 128, 128, 153 *145, 140, 135, 130 *126, 121, 116, 111 *103, 128, 128, 128 *128, 128, 128, 162 *150, 143, 137, 131 *125, 119, 113, 106 *94, 128, 128, 128 *128, 128, 128, 170 *154, 145, 138, 131 *125, 118, 111, 102 *86, 128, 128, 128 *128, 128, 128, 177 *157, 147, 139, 131 *125, 117, 109, 99 *79, 128, 128, 128 *128, 128, 128, 184 *160, 149, 140, 132 *124, 116, 107, 96 *72, 128, 128, 128 *128, 128, 128, 128 *162, 150, 141, 132 *124, 115, 106, 94 *128, 128, 128, 128 *128, 128, 128, 128 *163, 151, 141, 132 *124, 115, 105, 93 *128, 128, 128, 128 *128, 128, 128, 128 *165, 152, 142, 132 *124, 114, 104, 91 *128, 128, 128, 128 *128, 128, 128, 128 *166, 153, 142, 132 *124, 114, 103, 90 *128, 128, 128, 128 *128, 128, 128, 128 *167, 154, 143, 133 *123, 113, 102, 89 *128, 128, 128, 128 *128, 128, 128, 128 *168, 155, 143, 133 *123, 113, 101, 88 *128, 128, 128, 128 *128, 128, 128, 128 *169, 155, 144, 133 *123, 112, 101, 87 *128, 128, 128, 128 *168, 128, 128, 128 *170, 156, 144, 133 *123, 112, 100, 86 *128, 128, 128, 88 *153, 128, 128, 128 *170, 156, 144, 133 *123, 112, 100, 86 *128, 128, 128, 103 *129, 130, 132, 132 *132, 131, 130, 128 *128, 126, 125, 124 *124, 124, 126, 127 *133, 140, 142, 142 *140, 137, 133, 129 *127, 123, 119, 116 *114, 114, 116, 123 *128, 169, 156, 151 *146, 141, 136, 130 *126, 120, 115, 110 *105, 100, 87, 128 *128, 128, 175, 159 *151, 144, 138, 131 *125, 118, 112, 105 *97, 81, 128, 128 *128, 128, 128, 166 *155, 147, 139, 131 *125, 117, 109, 101 *90, 128, 128, 128 *128, 128, 128, 171 *158, 149, 140, 132 *124, 116, 107, 98 *85, 128, 128, 128 *128, 128, 128, 176 *161, 151, 141, 132 *124, 115, 105, 95 *80, 128, 128, 128 *128, 128, 128, 179 *163, 152, 142, 132 *124, 114, 104, 93 *77, 128, 128, 128 *128, 128, 128, 182 *165, 153, 143, 133 *123, 113, 103, 91 *74, 128, 128, 128 *158, 128, 128, 185 *167, 154, 143, 133 *123, 113, 102, 89 *71, 128, 128, 98 *149, 128, 128, 188 *168, 155, 144, 133 *123, 112, 101, 88 *68, 128, 128, 107 *145, 177, 128, 128 *169, 156, 144, 133 *123, 112, 100, 87 *128, 128, 79, 111 *143, 172, 128, 128 *170, 157, 145, 133 *123, 111, 99, 86 *128, 128, 84, 113 *142, 169, 128, 128 *171, 157, 145, 133 *123, 111, 99, 85 *128, 128, 87, 114 *141, 166, 128, 128 *171, 158, 145, 133 *123, 111, 98, 85 *128, 128, 90, 115 *141, 165, 128, 128 *172, 158, 146, 133 *123, 110, 98, 84 *128, 128, 91, 115 *128, 130, 131, 132 *132, 131, 130, 128 *128, 126, 125, 124 *124, 125, 126, 128 *131, 138, 141, 141 *140, 137, 133, 130 *126, 123, 119, 116 *115, 115, 118, 125 *137, 149, 152, 150 *147, 142, 136, 130 *126, 120, 114, 109 *106, 104, 107, 119 *147, 162, 162, 158 *152, 145, 138, 131 *125, 118, 111, 104 *98, 94, 94, 109 *156, 174, 171, 164 *156, 148, 140, 132 *124, 116, 108, 100 *92, 85, 82, 100 *152, 178, 178, 169 *159, 150, 141, 132 *124, 115, 106, 97 *87, 78, 78, 104 *148, 175, 183, 173 *162, 152, 142, 132 *124, 114, 104, 94 *83, 73, 81, 108 *145, 172, 185, 176 *164, 153, 143, 133 *123, 113, 103, 92 *80, 71, 84, 111 *143, 169, 185, 178 *166, 155, 144, 133 *123, 112, 101, 90 *78, 71, 87, 113 *142, 166, 184, 180 *168, 156, 144, 133 *123, 112, 100, 88 *76, 72, 90, 114 *141, 164, 183, 182 *169, 156, 145, 133 *123, 111, 100, 87 *74, 73, 92, 115 *140, 163, 182, 183 *170, 157, 145, 133 *123, 111, 99, 86 *73, 74, 93, 116 *139, 162, 181, 185 *171, 158, 145, 133 *123, 111, 98, 85 *71, 75, 94, 117 *139, 161, 180, 186 *172, 158, 146, 134 *122, 110, 98, 84 *70, 76, 95, 117 *139, 160, 179, 187 *172, 159, 146, 134 *122, 110, 97, 84 *69, 77, 96, 117 *138, 159, 178, 187 *173, 159, 146, 134 *122, 110, 97, 83 *69, 78, 97, 118 *128, 130, 132, 132 *132, 131, 130, 128 *128, 126, 125, 124 *124, 124, 126, 128 *131, 137, 141, 141 *140, 137, 134, 130 *126, 122, 119, 116 *115, 115, 119, 125 *134, 145, 150, 150 *147, 142, 137, 131 *125, 119, 114, 109 *106, 106, 111, 122 *138, 153, 158, 157 *152, 146, 139, 131 *125, 117, 110, 104 *99, 98, 103, 118 *140, 158, 165, 163 *157, 149, 140, 132 *124, 116, 107, 99 *93, 91, 98, 116 *140, 161, 170, 168 *160, 151, 142, 132 *124, 114, 105, 96 *88, 86, 95, 116 *140, 162, 173, 171 *163, 153, 143, 133 *123, 113, 103, 93 *85, 83, 94, 116 *140, 161, 175, 174 *165, 154, 143, 133 *123, 113, 102, 91 *82, 81, 95, 116 *139, 161, 176, 176 *167, 155, 144, 133 *123, 112, 101, 89 *80, 80, 95, 117 *139, 160, 176, 178 *168, 157, 145, 133 *123, 111, 99, 88 *78, 80, 96, 117 *139, 159, 176, 180 *170, 157, 145, 133 *123, 111, 99, 86 *76, 80, 97, 117 *138, 159, 176, 181 *171, 158, 146, 134 *122, 110, 98, 85 *75, 80, 97, 118 *138, 158, 175, 182 *172, 159, 146, 134 *122, 110, 97, 84 *74, 81, 98, 118 *138, 158, 175, 183 *172, 159, 146, 134 *122, 110, 97, 84 *73, 81, 98, 118 *138, 157, 175, 184 *173, 160, 147, 134 *122, 109, 96, 83 *72, 81, 99, 118 *138, 157, 174, 184 *174, 160, 147, 134 *122, 109, 96, 82 *72, 82, 99, 118 *128, 130, 131, 132 *132, 131, 130, 128 *128, 126, 125, 124 *124, 125, 126, 128 *131, 137, 140, 141 *140, 137, 134, 130 *126, 122, 119, 116 *115, 116, 119, 125 *134, 143, 149, 150 *147, 142, 137, 131 *125, 119, 114, 109 *106, 107, 113, 122 *136, 150, 156, 157 *153, 146, 139, 131 *125, 117, 110, 103 *99, 100, 106, 120 *137, 154, 162, 162 *157, 149, 141, 132 *124, 115, 107, 99 *94, 94, 102, 119 *138, 156, 166, 167 *160, 152, 142, 132 *124, 114, 104, 96 *89, 90, 100, 118 *138, 157, 169, 170 *163, 153, 143, 133 *123, 113, 103, 93 *86, 87, 99, 118 *138, 157, 171, 173 *165, 155, 144, 133 *123, 112, 101, 91 *83, 85, 99, 118 *138, 157, 172, 175 *167, 156, 145, 133 *123, 111, 100, 89 *81, 84, 99, 118 *138, 157, 172, 177 *169, 157, 145, 133 *123, 111, 99, 87 *79, 84, 99, 118 *138, 157, 173, 179 *170, 158, 146, 134 *122, 110, 98, 86 *77, 83, 99, 118 *138, 157, 173, 180 *171, 159, 146, 134 *122, 110, 97, 85 *76, 83, 99, 118 *137, 156, 173, 181 *172, 159, 147, 134 *122, 109, 97, 84 *75, 83, 100, 119 *137, 156, 173, 182 *173, 160, 147, 134 *122, 109, 96, 83 *74, 83, 100, 119 *137, 156, 173, 182 *174, 161, 147, 134 *122, 109, 95, 82 *74, 83, 100, 119 *137, 156, 172, 183 *174, 161, 147, 134 *122, 109, 95, 82 *73, 84, 100, 119 *128, 130, 131, 132 *132, 131, 130, 128 *128, 126, 125, 124 *124, 125, 126, 128 *131, 136, 140, 141 *140, 138, 134, 130 *126, 122, 118, 116 *115, 116, 120, 125 *133, 143, 148, 149 *147, 143, 137, 131 *125, 119, 113, 109 *107, 108, 113, 123 *135, 148, 155, 156 *153, 147, 139, 131 *125, 117, 109, 103 *100, 101, 108, 121 *136, 151, 161, 162 *157, 150, 141, 132 *124, 115, 106, 99 *94, 95, 105, 120 *137, 154, 164, 166 *161, 152, 142, 132 *124, 114, 104, 95 *90, 92, 102, 119 *137, 155, 167, 170 *164, 154, 144, 133 *123, 112, 102, 92 *86, 89, 101, 119 *137, 155, 169, 172 *166, 155, 144, 133 *123, 112, 101, 90 *84, 87, 101, 119 *137, 156, 170, 175 *168, 157, 145, 133 *123, 111, 99, 88 *81, 86, 100, 119 *137, 156, 170, 176 *169, 158, 146, 134 *122, 110, 98, 87 *80, 86, 100, 119 *137, 155, 171, 178 *171, 159, 146, 134 *122, 110, 97, 85 *78, 85, 101, 119 *137, 155, 171, 179 *172, 159, 147, 134 *122, 109, 97, 84 *77, 85, 101, 119 *137, 155, 171, 180 *173, 160, 147, 134 *122, 109, 96, 83 *76, 85, 101, 119 *137, 155, 171, 181 *173, 161, 147, 134 *122, 109, 95, 83 *75, 85, 101, 119 *137, 155, 171, 181 *174, 161, 148, 134 *122, 108, 95, 82 *75, 85, 101, 119 *137, 155, 171, 182 *175, 161, 148, 134 *122, 108, 95, 81 *74, 85, 101, 119 ; ***************************************** ; STARTUP CODE ; ***************************************** !SETUP mov TURNDEG, 100 mov MAXHEAT, 30 mov SCANARC, 64 and PROFVAR, 0 mov ax, 1 int I_OVERBURN int I_KEEPSHIFT ; ***************************************** ; UNPREDICTABLE DRIVING ; ***************************************** !DRIVE ipo P_RADAR, ax ; RANGE TARGET cmp ax, 450 jae !noShoot ipo P_HEAT, ax cmp ax, MAXHEAT jb !SHOOT !noShoot cmp [0], 100 ; COLLISION CHECK jeq !noCol opo P_STEERING, 30 opo P_THROTTLE, 100 !noCol int I_LOCATE ; KEEP AWAY FROM WALLS cmp ex, 150 jb !lWall cmp ex, 850 ja !rWall jbe !vWalls ; -> not to close to left or right wall, check up and down... !lWall ; to near to left wall? cmp @1, 128 jbe !vWalls mov dx, @1 ; -> current desired heading !adjL cmp dx, 128 jbe !HSteer add dx, TURNDEG and dx, 255 ; to make sure that it remains in 0-255 ja !adjL !rWall cmp @1, 128 jae !vWalls mov dx, @1 !adjR cmp dx, 128 jae !HSteer add dx, TURNDEG jb !adjR !HSteer sub dx, @1 opo P_STEERING, dx ; steer !vWalls ; check distance to up and down wall cmp fx, 150 jb !uWall cmp fx, 850 ja !dWall jbe !KAW_END !uWall mov dx, @1 add dx, 64 and dx, 255 ; rotate the deegres into right direction :-) cmp dx, 128 jae !KAW_END !AdjU cmp dx, 128 jae !VSteer add dx, TURNDEG jb !AdjU !dWall mov dx, @1 add dx, 64 and dx, 255 cmp dx, 128 jbe !KAW_END !AdjD cmp dx, 128 jbe !VSteer add dx, TURNDEG and dx, 255 ja !AdjD !VSteer mov bx, @1 add bx, 64 and bx, 255 sub dx, bx opo P_STEERING, dx !KAW_END ; = Keep-away-from-walls_END :-) ; UNPREDICTABLE MOVEMENT ipo P_RAND, ax and ax, 96 sub ax, 64 opo P_STEERING, ax jeq !DRIVE ; fast 0-cycle conditional jumps jne !DRIVE ; ****************************************** ; SHOOT PREDICTION ; ****************************************** !SHOOT xor ax, ax int I_OVERBURN ; overburn = off opo P_THROTTLE, 20 ; reduce speed opo P_TROTATE, 128 !SCAN opo P_ARC, SCANARC !LOCK ipo P_SCAN, RANGE cmp RANGE, 500 jb !shrink cmp SCANARC, 64 jae !DRIVE shl SCANARC, 2 jeq !SCAN jne !SCAN !shrink shr SCANARC, 2 cmp @3, -1 jls !NAcc2 jeq !NAcc1 cmp @3, 1 jgr !PAcc2 jeq !PAcc1 !NAcc2 mov dx, SCANARC shl dx, 2 neg dx opo P_TROTATE, dx jeq !SPred jne !SPred !NAcc1 mov dx, SCANARC shl dx, 1 neg dx opo P_TROTATE, dx jeq !SPred jne !Spred !PAcc1 mov dx, SCANARC shl dx, 2 opo P_TROTATE, dx jeq !SPred jne !Spred !PAcc2 mov dx, SCANARC shl dx, 1 opo P_TROTATE, dx !SPred cmp SCANARC, 4 jae !SCAN shl SCANARC, 2 ipo P_HEAT, ax cmp ax, 300 ja !DRIVE ; EX = Dst --- FX = Spd --- DX ---Ang mov ex, RANGE shr ex, 8 ; Dst Index cmp @13, 0 ja !TrFW mov fx, @13 neg fx mov dx, @6 add dx, 128 and dx, 255 jeq !doTrPred jne !doTrPred !TrFW mov fx, @13 mov dx, @6 !doTrPred ; Spd Index shr fx, 4 add ex, fx add ex, dx ; now add them together add ex, 1028 ; the beginning of the table mov dx, [ex] sub dx, 128 ; sub 128 opo P_TROTATE, dx opo P_FIRE, 0 opo P_FIRE, 0 jeq !LOCK jne !LOCK