Starship/src/main/sys_lights.c
petrie911 af26374677
Match Matrix_Scale, change some file names (#52)
* stuff

* three whole files

* format

* format and such

* a switch in time

* merge prep

* nintendo switch

* format

* the great switch statement of our time

* 43AC0 matched

* stuff

* Enums everywhere

* oh god the switch

* knakyo

* new headers

* format

* fox

* everyone hates recursion

* format

* one more thing

* one more one more thing

* renames

* matches

* matrix scale why

* names and such

* cleanup

* name back
2023-12-15 17:09:49 -03:00

85 lines
2.8 KiB
C

#include "global.h"
void Lights_AddLight(Gfx** dList) {
gSPNumLights((*dList)++, 7);
gSPLight((*dList)++, &gLight->l[0], 1);
gSPLight((*dList)++, &gLight->l[1], 2);
gSPLight((*dList)++, &gLight->l[2], 3);
gSPLight((*dList)++, &gLight->l[3], 4);
gSPLight((*dList)++, &gLight->l[4], 5);
gSPLight((*dList)++, &gLight->l[5], 6);
gSPLight((*dList)++, &gLight->l[6], 7);
gSPLight((*dList)++, &gLight->a, 8);
gLight++;
}
void Lights_SetOneLight(Gfx** dList, s32 dirX, s32 dirY, s32 dirZ, s32 colR, s32 colG, s32 colB, s32 ambR, s32 ambG,
s32 ambB) {
s32 i;
for (i = 0; i < 4; i++) {
gLight->l[i].l.dir[0] = dirX;
gLight->l[i].l.dir[1] = dirY;
gLight->l[i].l.dir[2] = dirZ;
gLight->l[i].l.col[0] = colR;
gLight->l[i].l.col[1] = colG;
gLight->l[i].l.col[2] = colB;
gLight->l[i].l.colc[0] = colR;
gLight->l[i].l.colc[1] = colG;
gLight->l[i].l.colc[2] = colB;
}
for (i = 4; i < 7; i++) {
gLight->l[i].l.dir[0] = dirX;
gLight->l[i].l.dir[1] = dirY;
gLight->l[i].l.dir[2] = dirZ;
gLight->l[i].l.col[0] = 0;
gLight->l[i].l.col[1] = 0;
gLight->l[i].l.col[2] = 0;
gLight->l[i].l.colc[0] = 0;
gLight->l[i].l.colc[1] = 0;
gLight->l[i].l.colc[2] = 0;
}
gLight->a.l.col[0] = ambR;
gLight->a.l.col[1] = ambG;
gLight->a.l.col[2] = ambB;
gLight->a.l.colc[0] = ambR;
gLight->a.l.colc[1] = ambG;
gLight->a.l.colc[2] = ambB;
Lights_AddLight(dList);
}
void Lights_SetTwoLights(Gfx** dList, s32 dir1x, s32 dir1y, s32 dir1z, s32 dir2x, s32 dir2y, s32 dir2z, s32 col1r,
s32 col1g, s32 col1b, s32 col2r, s32 col2g, s32 col2b, s32 ambR, s32 ambG, s32 ambB) {
s32 i;
for (i = 0; i < 4; i++) {
gLight->l[i].l.dir[0] = dir1x;
gLight->l[i].l.dir[1] = dir1y;
gLight->l[i].l.dir[2] = dir1z;
gLight->l[i].l.col[0] = col1r;
gLight->l[i].l.col[1] = col1g;
gLight->l[i].l.col[2] = col1b;
gLight->l[i].l.colc[0] = col1r;
gLight->l[i].l.colc[1] = col1g;
gLight->l[i].l.colc[2] = col1b;
}
for (i = 4; i < 7; i++) {
gLight->l[i].l.dir[0] = dir2x;
gLight->l[i].l.dir[1] = dir2y;
gLight->l[i].l.dir[2] = dir2z;
gLight->l[i].l.col[0] = col2r;
gLight->l[i].l.col[1] = col2g;
gLight->l[i].l.col[2] = col2b;
gLight->l[i].l.colc[0] = col2r;
gLight->l[i].l.colc[1] = col2g;
gLight->l[i].l.colc[2] = col2b;
}
gLight->a.l.col[0] = ambR;
gLight->a.l.col[1] = ambG;
gLight->a.l.col[2] = ambB;
gLight->a.l.colc[0] = ambR;
gLight->a.l.colc[1] = ambG;
gLight->a.l.colc[2] = ambB;
Lights_AddLight(dList);
}