static void PTL_DebugList_f (void) { int i; Com_Printf("%i particles\n", r_numParticles); for (i = 0; i < r_numParticles; i++) { const ptl_t *p = &r_particleArray[i]; const ptlDef_t *def = p->ctrl; const value_t *pp = pps; if (!p->inuse) continue; Com_Printf("particle %i\n", i); Com_Printf(" name: %s\n", def->name); for (pp = pps; pp->string; pp++) { const char *value = ""; if (Q_streq(pp->string, "image") && p->pic) { value = p->pic->name; } else if (Q_streq(pp->string, "model") && p->model) { value = p->model->name; } else if (Q_streq(pp->string, "program") && p->program) { value = p->program->name; } else { value = Com_ValueToStr(p, pp->type, pp->ofs); } Com_Printf(" %s: %s\n", pp->string, value); } } }
/** * @brief Return a string from a node property * @param[in] node Requested node * @param[in] property Requested property * @return Return a string value of a property, else nullptr, if the type is not supported */ const char* UI_GetStringFromNodeProperty (const uiNode_t* node, const value_t* property) { const int baseType = property->type & V_UI_MASK; assert(node); assert(property); switch (baseType) { case V_NOT_UI: /* common type */ return Com_ValueToStr(node, property->type, property->ofs); case V_UI_CVAR: switch ((int)property->type) { case V_CVAR_OR_FLOAT: { const float f = UI_GetReferenceFloat(node, Com_GetValue<void*>(node, property)); const int i = f; if (f == i) return va("%i", i); else return va("%f", f); } case V_CVAR_OR_LONGSTRING: case V_CVAR_OR_STRING: case V_UI_CVAR: return UI_GetReferenceString(node, Com_GetValue<char*>(node, property)); } break; default: break; } Com_Printf("UI_GetStringFromNodeProperty: Unsupported string getter for property type 0x%X (%s@%s)\n", property->type, UI_GetPath(node), property->string); return nullptr; }