MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / grab_block

Method grab_block

src/SB/Core/x/xPtankPool.cpp:348–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346}
347
348void ptank_pool::grab_block(ptank_group_type type)
349{
350 this->ptank = NULL;
351 group_data& group = groups[type];
352 if (group.used < group.size || create_ptanks(group, 1) >= 1)
353 {
354 ptank_context** end = group.buckets + group.buckets_used;
355
356 {
357 ptank_context** it = group.buckets + 2;
358 while (it < end)
359 {
360 if (*it != NULL)
361 {
362 if ((*it)->ptank->geometry->matList.materials[0]->texture == this->rs.texture &&
363 (*it)->dst_blend == this->rs.dst_blend &&
364 (*it)->src_blend == this->rs.src_blend &&
365 !(((*it)->flags ^ this->rs.flags) & 0x1))
366 {
367 this->ptank = (*it)->ptank;
368 (*it)->flags |= rpPTANKDFLAGCNSNORMAL;
369 *it = (*it)->next;
370 group.used++;
371 return;
372 }
373 }
374 it++;
375 }
376 }
377
378 {
379 ptank_context** it = group.buckets;
380 while (it < end)
381 {
382 if (*it != NULL)
383 {
384 if ((this->rs.flags & rpPTANKDFLAGPOSITION) &&
385 !((*it)->flags & rpPTANKDFLAGPOSITION))
386 {
387 destroy_ptank((*it)->ptank);
388 (*it)->ptank = create_ptank(group.create_flags);
389 }
390 this->ptank = (*it)->ptank;
391 RpMaterialSetTexture(*this->ptank->geometry->matList.materials,
392 this->rs.texture);
393 RPATOMICPTANKPLUGINDATA(this->ptank)->publicData.srcBlend = this->rs.src_blend;
394 RPATOMICPTANKPLUGINDATA(this->ptank)->publicData.dstBlend = this->rs.dst_blend;
395 RPATOMICPTANKPLUGINDATA(this->ptank)->instFlags |= rpPTANKDFLAGARRAY;
396
397 (*it)->src_blend = this->rs.src_blend;
398 (*it)->dst_blend = this->rs.dst_blend;
399 (*it)->flags = this->rs.flags | rpPTANKDFLAGCNSNORMAL;
400 *it = (*it)->next;
401 group.used++;
402 return;
403 }
404
405 it++;

Callers

nothing calls this directly

Calls 3

create_ptanksFunction · 0.85
destroy_ptankFunction · 0.85
create_ptankFunction · 0.70

Tested by

no test coverage detected