- memset(hash, 0, sizeof(hash));
- for (i = 0;i < 4096;i++)
- hashpointer[i] = &hash[i];
- distscale = 4095.0f / max(mqt_viewmaxdist, 4095);
- for (i = 0, mqt = mqt_array;i < mqt_count;i++, mqt++)
- {
- // generate index
- hashdist = (int) (mqt->dist * distscale);
- hashdist = bound(0, hashdist, 4095);
- // link to tail of hash chain (to preserve render order)
- mqt->next = NULL;
- *hashpointer[hashdist] = mqt;
- hashpointer[hashdist] = &mqt->next;
- }
- for (i = 4095;i >= 0;i--)
- if (hash[i])
- for (mqt = hash[i];mqt;mqt = mqt->next)
- mqt->callback(mqt->ent, mqt->surfacenumber, mqt->rtlight);
- mqt_count = 0;
-}