MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / TCAMDrawObjects

Function TCAMDrawObjects

Descent3/TelComAutoMap.cpp:668–723  ·  view source on GitHub ↗

Draws all the relevant objects for automap

Source from the content-addressed store, hash-verified

666
667// Draws all the relevant objects for automap
668void TCAMDrawObjects() {
669 int i;
670 int drawit = (timer_GetTime() * 4);
671 drawit = (drawit % 2);
672
673 if (Game_mode & GM_MULTI) {
674 for (i = 0; i < MAX_PLAYERS; i++) {
675 if (i == Player_num) {
676 object *obj = &Objects[Players[Player_num].objnum];
677 if (AM_ship_model_handle != -1 && drawit)
678 DrawPolygonModel(&obj->pos, &obj->orient, AM_ship_model_handle, NULL, 0, 1, 1, 1);
679 } else if (NetPlayers[i].flags & NPF_CONNECTED) {
680 object *obj = &Objects[Players[i].objnum];
681 if ((obj->type == OBJ_PLAYER && obj->render_type == RT_POLYOBJ) || obj->type == OBJ_OBSERVER)
682 DrawColoredDisk(&Objects[Players[i].objnum].pos, 1, 1, .5f, 1.0, .3f, 3.0);
683 }
684 }
685 } else {
686 object *obj = &Objects[Players[Player_num].objnum];
687
688 if (AM_ship_model_handle != -1 && drawit)
689 DrawPolygonModel(&obj->pos, &obj->orient, AM_ship_model_handle, NULL, 0, 1, 1, 1);
690 }
691
692 float norm = timer_GetTime();
693 int int_norm = norm;
694 norm -= int_norm;
695 for (i = 0; i <= Highest_object_index; i++) {
696 object *obj = &Objects[i];
697
698 if (obj->type == OBJ_MARKER && obj->parent_handle == Player_object->handle) {
699 float size = 2.5 + (norm * 2.5);
700 float r = 1.0;
701 float g = 0;
702 float b = 1.0;
703
704 if (AM_current_marker != -1) {
705 int index = 0;
706
707 if (Game_mode & GM_MULTI)
708 index = obj->id - (Player_num * 2);
709 else
710 index = obj->id;
711
712 if (AM_current_marker == index) {
713 size = 9.0 + (norm * 9.0);
714 r = 0;
715 g = 1.0;
716 b = 1.0;
717 }
718 }
719
720 DrawColoredDisk(&obj->pos, r, g, b, 1.0, .3f, size);
721 }
722 }
723}
724
725#include "hud.h"

Callers 1

TCAMCallbackFunction · 0.85

Calls 2

DrawPolygonModelFunction · 0.85
DrawColoredDiskFunction · 0.85

Tested by

no test coverage detected