Subversion Repositories Games.Carmageddon

Rev

Rev 18 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18 Rev 20
Line 1... Line 1...
1
#include "trig.h"
1
#include "trig.h"
2
#include "brender.h"
2
#include "brender/brender.h"
3
#include "harness/trace.h"
3
#include "harness/trace.h"
4
#include <math.h>
4
#include <math.h>
5
#include <stdlib.h>
5
#include <stdlib.h>
6
 
6
 
7
float gFloat_sine_table[91] = {
7
float gFloat_sine_table[91] = {
Line 176... Line 176...
176
 
176
 
177
// IDA: br_scalar __usercall FastScalarSinAngle@<ST0>(br_angle pBR_angle@<EAX>)
177
// IDA: br_scalar __usercall FastScalarSinAngle@<ST0>(br_angle pBR_angle@<EAX>)
178
br_scalar FastScalarSinAngle(br_angle pBR_angle) {
178
br_scalar FastScalarSinAngle(br_angle pBR_angle) {
179
    LOG_TRACE("(%d)", pBR_angle);
179
    LOG_TRACE("(%d)", pBR_angle);
180
 
180
 
181
    return FastScalarSin(BrAngleToDegree(pBR_angle));
181
    return FastScalarSin(BrAngleToDegrees(pBR_angle));
182
}
182
}
183
 
183
 
184
// IDA: br_scalar __usercall FastScalarCosAngle@<ST0>(br_angle pBR_angle@<EAX>)
184
// IDA: br_scalar __usercall FastScalarCosAngle@<ST0>(br_angle pBR_angle@<EAX>)
185
br_scalar FastScalarCosAngle(br_angle pBR_angle) {
185
br_scalar FastScalarCosAngle(br_angle pBR_angle) {
186
    LOG_TRACE("(%d)", pBR_angle);
186
    LOG_TRACE("(%d)", pBR_angle);
187
 
187
 
188
    return FastScalarCos(BrAngleToDegree(pBR_angle));
188
    return FastScalarCos(BrAngleToDegrees(pBR_angle));
189
}
189
}
190
 
190
 
191
// IDA: br_scalar __usercall FastScalarTanAngle@<ST0>(br_angle pBR_angle@<EAX>)
191
// IDA: br_scalar __usercall FastScalarTanAngle@<ST0>(br_angle pBR_angle@<EAX>)
192
br_scalar FastScalarTanAngle(br_angle pBR_angle) {
192
br_scalar FastScalarTanAngle(br_angle pBR_angle) {
193
    int angle_in_degrees;
193
    int angle_in_degrees;
194
    LOG_TRACE("(%d)", pBR_angle);
194
    LOG_TRACE("(%d)", pBR_angle);
195
 
195
 
196
    angle_in_degrees = BrAngleToDegree(pBR_angle);
196
    angle_in_degrees = BrAngleToDegrees(pBR_angle);
197
    return FastScalarSin(angle_in_degrees) / FastScalarCos(angle_in_degrees);
197
    return FastScalarSin(angle_in_degrees) / FastScalarCos(angle_in_degrees);
198
}
198
}
199
 
199
 
200
// IDA: float __cdecl FastFloatArcSin(float pValue)
200
// IDA: float __cdecl FastFloatArcSin(float pValue)
201
float FastFloatArcSin(float pValue) {
201
float FastFloatArcSin(float pValue) {
202
    float low_limit;
202
    float low_limit;
203
    float high_limit;
203
    float high_limit;
204
    float mid_point;
204
    float mid_point;
205
    LOG_TRACE("(%f)", pValue);
205
    LOG_TRACE("(%f)", pValue);
206
 
206
   
207
    if (pValue < 0.f) {
207
    if (pValue < 0.f) {
208
        return -FastFloatArcSin(-pValue);
208
        return -FastFloatArcSin(-pValue);
209
    }
209
    }
210
    high_limit = 90.f * pValue;
210
    high_limit = 90.f * pValue;
211
    low_limit = high_limit - 19.f;
211
    low_limit = high_limit - 19.f;