ChrisOS Research ProjectOperating systems · language systems · graphics · machine emulation
DOCUMENTATION ARCHIVEMAIN BRANCH
ChrisOS/Referência de fonte: GAMES/MINE/AI.CC

Referência de fonte: GAMES/MINE/AI.CC

Registro determinístico da fonte. O conteúdo completo do arquivo é reproduzido abaixo; esta página não substitui a interpretação arquitetural dos capítulos autorais.

Identidade do arquivo

Campo Valor
Path GAMES/MINE/AI.CC
Lines 67
Bytes 2097
SHA-256 c3ec8ed06ff1974bda5cbe6cf187a143ee77a03bf5bfd9bc335f4d89650029f4
ChrisOS revision da3df29cb397932c43d32373871fb9380e688ade

Dependências sintáticas detectadas

Linha Include
— Nenhum include de preprocessor detectado.

Símbolos detectados

Linha Símbolo
1 ai_step

Fonte completa

O bloco seguinte é o arquivo textual integral na revisão indicada. Não há elisão, abreviação ou paráfrase.

void ai_step(float px, float pz) {
    long i;
    float dx;
    float dz;
    float step;
    int nx;
    int nz;
    for (i = 1; i < 16; i = i + 1) {
        switch (g_act[i].kind) {
        case 0:
            continue;
        case 4:
            break;
        case 5:
            break;
        default:
            dx = px - g_act[i].x;
            dz = pz - g_act[i].z;
            if (g_act[i].kind == 2) {
                g_act[i].state = 4;
            } else if (g_act[i].kind == 3 && g_rain) {
                g_act[i].state = 1;
            } else if (g_act[i].kind == 3 && dx * dx + dz * dz < 36.0) {
                g_act[i].state = 2;
            } else if (g_phase == 3 && g_act[i].kind == 1 &&
                       dx * dx + dz * dz < 64.0) {
                g_act[i].state = 3;
            } else if (g_act[i].timer % 40 < 20) {
                g_act[i].state = 1;
            } else {
                g_act[i].state = 0;
            }
            step = 0.08;
            if (g_act[i].state == 2)
                step = -0.12;
            if (g_act[i].state == 3)
                step = 0.1;
            if (g_act[i].state == 0)
                step = 0.0;
            if (g_act[i].state == 4)
                step = 0.05;
            nx = (int)(g_act[i].x + step);
            nz = (int)g_act[i].z;
            if (dx < 0.0)
                nx = (int)(g_act[i].x - step);
            if (voxel_get(nx, (int)g_act[i].y, nz) != 0 &&
                voxel_get(nx, (int)g_act[i].y, nz) != 5)
                step = 0.0;
            if (g_act[i].kind == 2 &&
                voxel_get((int)g_act[i].x, (int)g_act[i].y, (int)g_act[i].z) !=
                    5)
                step = 0.0;
            g_act[i].vx = step;
            if (dz > 0.5)
                g_act[i].vz = 0.04;
            else if (dz < -0.5)
                g_act[i].vz = 0.0 - 0.04;
            else
                g_act[i].vz = 0.0;
            if (g_act[i].state == 2)
                g_act[i].vz = 0.0 - g_act[i].vz;
            break;
        }
        g_act[i].timer = g_act[i].timer + 1;
    }
}

Papel deste registro

O atlas garante rastreabilidade arquivo-a-arquivo. Responsabilidade, invariantes, ownership, concorrência, segurança, desempenho e interação entre subsistemas pertencem aos capítulos autorais e devem citar este arquivo quando aplicável.

Registro do documento ID: source-c3ec8ed06ff1974b Reviewed source: da3df29cb397 Class: generated-source-reference